summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgbl08ma <gbl08ma@gmail.com>2017-02-05 22:40:43 +0000
committergbl08ma <gbl08ma@gmail.com>2017-02-05 22:40:43 +0000
commitf2f528e5dcef4b5956ec7707ec91c2fef52fcce5 (patch)
tree7f6d802757b222c081fe4ea81507e27c7886ba5e
Initial public release
-rw-r--r--LICENSE.txt188
-rw-r--r--README.md44
-rw-r--r--characters282
-rw-r--r--depends.txt2
-rw-r--r--init.lua251
-rw-r--r--screenshot.pngbin0 -> 66424 bytes
-rw-r--r--textures/t_0.pngbin0 -> 277 bytes
-rw-r--r--textures/t_1.pngbin0 -> 279 bytes
-rw-r--r--textures/t_2.pngbin0 -> 285 bytes
-rw-r--r--textures/t_3.pngbin0 -> 282 bytes
-rw-r--r--textures/t_4.pngbin0 -> 288 bytes
-rw-r--r--textures/t_5.pngbin0 -> 282 bytes
-rw-r--r--textures/t_6.pngbin0 -> 282 bytes
-rw-r--r--textures/t_7.pngbin0 -> 282 bytes
-rw-r--r--textures/t_8.pngbin0 -> 277 bytes
-rw-r--r--textures/t_9.pngbin0 -> 282 bytes
-rw-r--r--textures/t_a.pngbin0 -> 284 bytes
-rw-r--r--textures/t_a_.pngbin0 -> 285 bytes
-rw-r--r--textures/t_am.pngbin0 -> 316 bytes
-rw-r--r--textures/t_ap.pngbin0 -> 273 bytes
-rw-r--r--textures/t_as.pngbin0 -> 279 bytes
-rw-r--r--textures/t_at.pngbin0 -> 288 bytes
-rw-r--r--textures/t_b.pngbin0 -> 284 bytes
-rw-r--r--textures/t_b_.pngbin0 -> 283 bytes
-rw-r--r--textures/t_bl.pngbin0 -> 281 bytes
-rw-r--r--textures/t_br.pngbin0 -> 281 bytes
-rw-r--r--textures/t_c.pngbin0 -> 278 bytes
-rw-r--r--textures/t_c_.pngbin0 -> 280 bytes
-rw-r--r--textures/t_ca.pngbin0 -> 280 bytes
-rw-r--r--textures/t_cl.pngbin0 -> 279 bytes
-rw-r--r--textures/t_cm.pngbin0 -> 275 bytes
-rw-r--r--textures/t_co.pngbin0 -> 264 bytes
-rw-r--r--textures/t_cr.pngbin0 -> 279 bytes
-rw-r--r--textures/t_d.pngbin0 -> 285 bytes
-rw-r--r--textures/t_d_.pngbin0 -> 280 bytes
-rw-r--r--textures/t_dl.pngbin0 -> 285 bytes
-rw-r--r--textures/t_dt.pngbin0 -> 273 bytes
-rw-r--r--textures/t_dv.pngbin0 -> 285 bytes
-rw-r--r--textures/t_e.pngbin0 -> 278 bytes
-rw-r--r--textures/t_e_.pngbin0 -> 285 bytes
-rw-r--r--textures/t_eq.pngbin0 -> 273 bytes
-rw-r--r--textures/t_ex.pngbin0 -> 276 bytes
-rw-r--r--textures/t_f.pngbin0 -> 280 bytes
-rw-r--r--textures/t_f_.pngbin0 -> 288 bytes
-rw-r--r--textures/t_g.pngbin0 -> 285 bytes
-rw-r--r--textures/t_g_.pngbin0 -> 281 bytes
-rw-r--r--textures/t_gt.pngbin0 -> 279 bytes
-rw-r--r--textures/t_h.pngbin0 -> 285 bytes
-rw-r--r--textures/t_h_.pngbin0 -> 284 bytes
-rw-r--r--textures/t_ha.pngbin0 -> 277 bytes
-rw-r--r--textures/t_hs.pngbin0 -> 312 bytes
-rw-r--r--textures/t_i.pngbin0 -> 281 bytes
-rw-r--r--textures/t_i_.pngbin0 -> 279 bytes
-rw-r--r--textures/t_j.pngbin0 -> 279 bytes
-rw-r--r--textures/t_j_.pngbin0 -> 282 bytes
-rw-r--r--textures/t_k.pngbin0 -> 289 bytes
-rw-r--r--textures/t_k_.pngbin0 -> 286 bytes
-rw-r--r--textures/t_l.pngbin0 -> 279 bytes
-rw-r--r--textures/t_l_.pngbin0 -> 281 bytes
-rw-r--r--textures/t_lt.pngbin0 -> 279 bytes
-rw-r--r--textures/t_m.pngbin0 -> 279 bytes
-rw-r--r--textures/t_m_.pngbin0 -> 281 bytes
-rw-r--r--textures/t_mn.pngbin0 -> 273 bytes
-rw-r--r--textures/t_n.pngbin0 -> 280 bytes
-rw-r--r--textures/t_n_.pngbin0 -> 286 bytes
-rw-r--r--textures/t_o.pngbin0 -> 276 bytes
-rw-r--r--textures/t_o_.pngbin0 -> 277 bytes
-rw-r--r--textures/t_p.pngbin0 -> 283 bytes
-rw-r--r--textures/t_p_.pngbin0 -> 284 bytes
-rw-r--r--textures/t_pr.pngbin0 -> 292 bytes
-rw-r--r--textures/t_ps.pngbin0 -> 277 bytes
-rw-r--r--textures/t_q.pngbin0 -> 286 bytes
-rw-r--r--textures/t_q_.pngbin0 -> 279 bytes
-rw-r--r--textures/t_qo.pngbin0 -> 273 bytes
-rw-r--r--textures/t_qu.pngbin0 -> 281 bytes
-rw-r--r--textures/t_r.pngbin0 -> 279 bytes
-rw-r--r--textures/t_r_.pngbin0 -> 282 bytes
-rw-r--r--textures/t_re.pngbin0 -> 283 bytes
-rw-r--r--textures/t_s.pngbin0 -> 280 bytes
-rw-r--r--textures/t_s_.pngbin0 -> 282 bytes
-rw-r--r--textures/t_sl.pngbin0 -> 277 bytes
-rw-r--r--textures/t_sm.pngbin0 -> 276 bytes
-rw-r--r--textures/t_sp.pngbin0 -> 231 bytes
-rw-r--r--textures/t_sr.pngbin0 -> 277 bytes
-rw-r--r--textures/t_t.pngbin0 -> 281 bytes
-rw-r--r--textures/t_t_.pngbin0 -> 283 bytes
-rw-r--r--textures/t_tl.pngbin0 -> 275 bytes
-rw-r--r--textures/t_u.pngbin0 -> 279 bytes
-rw-r--r--textures/t_u_.pngbin0 -> 280 bytes
-rw-r--r--textures/t_un.pngbin0 -> 273 bytes
-rw-r--r--textures/t_v.pngbin0 -> 282 bytes
-rw-r--r--textures/t_v_.pngbin0 -> 283 bytes
-rw-r--r--textures/t_vb.pngbin0 -> 273 bytes
-rw-r--r--textures/t_w.pngbin0 -> 281 bytes
-rw-r--r--textures/t_w_.pngbin0 -> 283 bytes
-rw-r--r--textures/t_x.pngbin0 -> 282 bytes
-rw-r--r--textures/t_x_.pngbin0 -> 282 bytes
-rw-r--r--textures/t_y.pngbin0 -> 284 bytes
-rw-r--r--textures/t_y_.pngbin0 -> 285 bytes
-rw-r--r--textures/t_z.pngbin0 -> 279 bytes
-rw-r--r--textures/t_z_.pngbin0 -> 281 bytes
-rw-r--r--textures/textline_anyside.pngbin0 -> 144 bytes
-rw-r--r--textures/textline_background.pngbin0 -> 218 bytes
-rw-r--r--textures/textline_icon.pngbin0 -> 211 bytes
104 files changed, 767 insertions, 0 deletions
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..a231a2e
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,188 @@
+The LGPLv3 applies to all code in this project.
+The WTFPL applies to textures and any other content in this project which is not source code.
+
+=============================================================
+
+GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
+
+=============================================================
+
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ Version 2, December 2004
+
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
+
+ Everyone is permitted to copy and distribute verbatim or modified
+ copies of this license document, and changing it is allowed as long
+ as the name is changed.
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e467c0f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,44 @@
+Textline
+==========
+
+This is a [Minetest](http://www.minetest.net/) mod that adds a text screen that is three blocks wide and is controlled with [Digilines](https://github.com/minetest-mods/digilines/). It works very similarly to the LCD screen that comes with Digilines, but is meant to be readable from farther away.
+
+![Screenshot](https://raw.githubusercontent.com/gbl08ma/textline/screenshot.png?raw=true)
+
+## Features
+
+* Dimensions: 3x1
+* Always stands vertically (can't be floor- or ceiling-mounted)
+* Four lines of orange text with 27 characters each, on a black background
+* Explicit line breaks with the newline character (\n) or the pipe (|) character. No text wrapping, for maximum control of the output.
+* Memory: the display "remembers" what it was displaying across server shutdowns. No need to constantly refresh its contents.
+* Optimized for frequent refreshes: its contents can change every second without excessive object generation.
+
+## Installing
+
+Just install it like any other Minetest mod.
+
+1. [Download](https://github.com/gbl08ma/textline/archive/master.zip)
+
+1. Extract the ZIP into the Minetest mods folder (usually `mods`);
+
+1. Rename the `textline-master` folder to `textline`;
+
+1. This mod depends on Digilines, make sure you have it installed;
+
+1. In Minetest, enable the mod in the world settings.
+
+## Usage
+
+A display consists of three separate nodes that must be placed individually. The center node is responsible for displaying the text it receives through Digilines; the two blocks to the sides make the rest of the background for the display.
+
+The background node appears in the inventory as an orange square with "BKG" written on it. The center node appears as "TXT".
+
+Digilines should be connected to the "TXT" block. You can configure its channel by clicking with the place/use button on them (default: right-click). Then you can just use it as a standard Digilines receiver. For example, for a screen running on channel `test`, you could execute the following code on a connected LuaController:
+
+`digiline_send("test", "This is a test\nThis is the second line\nThird line\nFourth line")`
+
+## License
+
+See LICENSE.txt
+
diff --git a/characters b/characters
new file mode 100644
index 0000000..b6884e8
--- /dev/null
+++ b/characters
@@ -0,0 +1,282 @@
+A
+t_a_
+7
+B
+t_b_
+5
+C
+t_c_
+6
+D
+t_d_
+6
+E
+t_e_
+5
+F
+t_f_
+5
+G
+t_g_
+6
+H
+t_h_
+6
+I
+t_i_
+1
+J
+t_j_
+4
+K
+t_k_
+5
+L
+t_l_
+4
+M
+t_m_
+7
+N
+t_n_
+6
+O
+t_o_
+6
+P
+t_p_
+5
+Q
+t_q_
+7
+R
+t_r_
+5
+S
+t_s_
+5
+T
+t_t_
+5
+U
+t_u_
+6
+V
+t_v_
+7
+W
+t_w_
+9
+X
+t_x_
+5
+Y
+t_y_
+7
+Z
+t_z_
+5
+a
+t_a
+5
+b
+t_b
+5
+c
+t_c
+4
+d
+t_d
+5
+e
+t_e
+4
+f
+t_f
+4
+g
+t_g
+5
+h
+t_h
+5
+i
+t_i
+1
+j
+t_j
+1
+k
+t_k
+4
+l
+t_l
+1
+m
+t_m
+7
+n
+t_n
+5
+o
+t_o
+5
+p
+t_p
+5
+q
+t_q
+5
+r
+t_r
+3
+s
+t_s
+4
+t
+t_t
+3
+u
+t_u
+4
+v
+t_v
+5
+w
+t_w
+7
+x
+t_x
+5
+y
+t_y
+4
+z
+t_z
+4
+
+t_sp
+2
+0
+t_0
+4
+1
+t_1
+2
+2
+t_2
+4
+3
+t_3
+4
+4
+t_4
+4
+5
+t_5
+4
+6
+t_6
+4
+7
+t_7
+4
+8
+t_8
+4
+9
+t_9
+4
+(
+t_bl
+2
+)
+t_br
+2
+{
+t_cl
+3
+}
+t_cr
+3
+[
+t_sl
+2
+]
+t_sr
+2
+'
+t_ap
+1
+!
+t_ex
+1
+?
+t_qu
+4
+@
+t_at
+5
+#
+t_hs
+5
+$
+t_dl
+4
+%
+t_pr
+5
+^
+t_ca
+3
+&
+t_am
+5
+*
+t_as
+3
+_
+t_un
+3
++
+t_ps
+3
+-
+t_mn
+3
+=
+t_eq
+3
+;
+t_sm
+1
+:
+t_co
+1
+,
+t_cm
+2
+"
+t_qo
+3
+/
+t_dv
+5
+~
+t_tl
+4
+<
+t_lt
+3
+>
+t_gt
+3
+\
+t_re
+5
+|
+t_vb
+1
+.
+t_dt
+1
diff --git a/depends.txt b/depends.txt
new file mode 100644
index 0000000..2cec86e
--- /dev/null
+++ b/depends.txt
@@ -0,0 +1,2 @@
+default
+digilines
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..a3609c5
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,251 @@
+-- Textline: wide character displays for Minetest, controlled with Digilines
+-- Based on the LCD that comes with Digilines
+-- Copyright 2017 Gabriel Maia <gabriel@tny.im>, http://github.com/gbl08ma
+-- Copyright 2017 Segvault http://segvault.tny.im
+-- See the included license file LICENSE.txt
+-- Font: 04.jp.org
+
+textline = {}
+-- load characters map
+local chars_file = io.open(minetest.get_modpath("textline").."/characters", "r")
+local charmap = {}
+local max_chars = 27
+if not chars_file then
+ print("[textline] E: character map file not found")
+else
+ while true do
+ local char = chars_file:read("*l")
+ if char == nil then
+ break
+ end
+ local img = chars_file:read("*l")
+ chars_file:read("*l")
+ charmap[char] = img
+ end
+end
+
+local textlines = {
+ -- on ceiling
+ --* [0] = {delta = {x = 0, y = 0.4, z = 0}, pitch = math.pi / -2},
+ -- on ground
+ --* [1] = {delta = {x = 0, y =-0.4, z = 0}, pitch = math.pi / 2},
+ -- sides
+ [2] = {delta = {x = 0.43, y = 0, z = 0}, yaw = math.pi / -2},
+ [3] = {delta = {x = -0.43, y = 0, z = 0}, yaw = math.pi / 2},
+ [4] = {delta = {x = 0, y = 0, z = 0.43}, yaw = 0},
+ [5] = {delta = {x = 0, y = 0, z = -0.43}, yaw = math.pi},
+}
+
+local reset_meta = function(pos)
+ minetest.get_meta(pos):set_string("formspec", "field[channel;Channel;${channel}]")
+end
+
+local clearscreen = function(pos)
+ local objects = minetest.get_objects_inside_radius(pos, 0.5)
+ for _, o in ipairs(objects) do
+ if o:get_luaentity().name == "textline:text" then
+ o:remove()
+ end
+ end
+end
+
+local prepare_writing = function(pos)
+ lcd_info = textlines[minetest.get_node(pos).param2]
+ if lcd_info == nil then return end
+ local text = minetest.add_entity(
+ {x = pos.x + lcd_info.delta.x,
+ y = pos.y + lcd_info.delta.y,
+ z = pos.z + lcd_info.delta.z}, "textline:text")
+ text:setyaw(lcd_info.yaw or 0)
+ return text
+end
+
+local on_digiline_receive = function(pos, node, channel, msg)
+ local meta = minetest.get_meta(pos)
+ local setchan = meta:get_string("channel")
+ if setchan ~= channel then return end
+
+ meta:set_string("text", msg)
+ if msg ~= "" then
+ local text = meta:get_string("text")
+ local objects = minetest.get_objects_inside_radius(pos, 0.5)
+ for _, o in ipairs(objects) do
+ local lentity = o:get_luaentity()
+ if lentity ~= nil then
+ local lname = lentity.name
+ if lname ~= nil and lname == "textline:text" then
+ o:set_properties({textures={textline:generate_texture(textline:create_lines(text))}})
+ end
+ end
+ end
+ end
+end
+
+local lcd_box = {
+ type = "wallmounted",
+ wall_top = {-8/16, 7/16, -8/16, 8/16, 8/16, 8/16}
+}
+
+minetest.register_node("textline:lcd", {
+ drawtype = "nodebox",
+ description = "Textline",
+ inventory_image = "textline_icon.png",
+ wield_image = "textline_icon.png",
+ tiles = {"textline_anyside.png"},
+
+ paramtype = "light",
+ sunlight_propagates = true,
+ paramtype2 = "wallmounted",
+ node_box = lcd_box,
+ selection_box = lcd_box,
+ groups = {choppy = 3, dig_immediate = 2},
+
+ after_place_node = function (pos, placer, itemstack)
+ local param2 = minetest.get_node(pos).param2
+ if param2 == 0 or param2 == 1 then
+ minetest.add_node(pos, {name = "textline:lcd", param2 = 3})
+ end
+ prepare_writing (pos)
+ end,
+
+ on_construct = function(pos)
+ reset_meta(pos)
+ end,
+
+ on_destruct = function(pos)
+ clearscreen(pos)
+ end,
+
+ on_receive_fields = function(pos, formname, fields, sender)
+ if (fields.channel) then
+ minetest.get_meta(pos):set_string("channel", fields.channel)
+ end
+ end,
+
+ digiline =
+ {
+ receptor = {},
+ effector = {
+ action = on_digiline_receive
+ },
+ },
+
+ light_source = 0,
+})
+
+minetest.register_node("textline:background", {
+ drawtype = "nodebox",
+ description = "Textline background",
+ inventory_image = "textline_background.png",
+ wield_image = "textline_background.png",
+ tiles = {"textline_anyside.png"},
+
+ paramtype = "light",
+ sunlight_propagates = true,
+ paramtype2 = "wallmounted",
+ node_box = lcd_box,
+ selection_box = lcd_box,
+ groups = {choppy = 3, dig_immediate = 2},
+
+ light_source = 0,
+})
+
+minetest.register_entity("textline:text", {
+ collisionbox = { 0, 0, 0, 0, 0, 0 },
+ visual = "upright_sprite",
+ visual_size = {x=3, y=1},
+ textures = {},
+
+ on_activate = function(self)
+ local meta = minetest.get_meta(self.object:getpos())
+ local text = meta:get_string("text")
+ self.object:set_properties({textures={textline:generate_texture(textline:create_lines(text))}})
+ end
+})
+
+-- CONSTANTS
+local LCD_WIDTH = 160
+local LCD_HEIGHT = 34
+local LCD_PADDING = 1
+
+local LINE_LENGTH = max_chars
+local NUMBER_OF_LINES = 4
+
+local LINE_HEIGHT = 7
+local LINE_SPACING = 1
+local CHAR_WIDTH = 5
+
+function textline:create_lines(text)
+ local line_num = 1
+ local tab = {}
+ for line in string.gmatch(text, '([^|\n]+)') do
+ table.insert(tab, line)
+ line_num = line_num+1
+ if line_num > NUMBER_OF_LINES then
+ return tab
+ end
+ end
+ return tab
+end
+
+function textline:generate_texture(lines)
+ local texture = "[combine:"..LCD_WIDTH .."x"..LCD_HEIGHT
+ local ypos = -2
+ for i = 1, #lines do
+ texture = texture..self:generate_line(lines[i], ypos)
+ ypos = ypos + LINE_HEIGHT + LINE_SPACING
+ end
+ return texture
+end
+
+function textline:generate_line(s, ypos)
+ local i = 1
+ local parsed = {}
+ local width = 0
+ local chars = 0
+ while chars < max_chars and i <= #s do
+ local file = nil
+ if charmap[s:sub(i, i)] ~= nil then
+ file = charmap[s:sub(i, i)]
+ i = i + 1
+ elseif i < #s and charmap[s:sub(i, i + 1)] ~= nil then
+ file = charmap[s:sub(i, i + 1)]
+ i = i + 2
+ else
+ print("[textline] W: unknown symbol in '"..s.."' at "..i)
+ i = i + 1
+ end
+ if file ~= nil then
+ width = width + CHAR_WIDTH
+ table.insert(parsed, file)
+ chars = chars + 1
+ end
+ end
+ width = width - 1
+
+ local texture = ""
+ local xpos = LCD_PADDING
+ for i = 1, #parsed do
+ texture = texture..":"..xpos..","..ypos.."="..parsed[i]..".png"
+ xpos = xpos + CHAR_WIDTH + 1
+ end
+ return texture
+end
+
+minetest.register_craft({
+ output = "textline:lcd 2",
+ recipe = {
+ {"default:steel_ingot", "digilines:wire_std_00000000", "default:steel_ingot"},
+ {"mesecons_lightstone:lightstone_green_off","mesecons_lightstone:lightstone_green_off","default:glass"},
+ {"default:glass","default:glass","default:glass"}
+ }
+})
+
+minetest.register_craft({
+ output = "textline:background 2",
+ recipe = {
+ {"default:steel_ingot", "default:glass", "default:steel_ingot"},
+ {"mesecons_lightstone:lightstone_green_off","mesecons_lightstone:lightstone_green_off","default:glass"},
+ {"default:glass","default:glass","default:glass"}
+ }
+})
diff --git a/screenshot.png b/screenshot.png
new file mode 100644
index 0000000..a69e83c
--- /dev/null
+++ b/screenshot.png
Binary files differ
diff --git a/textures/t_0.png b/textures/t_0.png
new file mode 100644
index 0000000..94eca9b
--- /dev/null
+++ b/textures/t_0.png
Binary files differ
diff --git a/textures/t_1.png b/textures/t_1.png
new file mode 100644
index 0000000..12ff6c3
--- /dev/null
+++ b/textures/t_1.png
Binary files differ
diff --git a/textures/t_2.png b/textures/t_2.png
new file mode 100644
index 0000000..6d194d0
--- /dev/null
+++ b/textures/t_2.png
Binary files differ
diff --git a/textures/t_3.png b/textures/t_3.png
new file mode 100644
index 0000000..bb2c010
--- /dev/null
+++ b/textures/t_3.png
Binary files differ
diff --git a/textures/t_4.png b/textures/t_4.png
new file mode 100644
index 0000000..c4aa8b8
--- /dev/null
+++ b/textures/t_4.png
Binary files differ
diff --git a/textures/t_5.png b/textures/t_5.png
new file mode 100644
index 0000000..c88947c
--- /dev/null
+++ b/textures/t_5.png
Binary files differ
diff --git a/textures/t_6.png b/textures/t_6.png
new file mode 100644
index 0000000..9a8a6d4
--- /dev/null
+++ b/textures/t_6.png
Binary files differ
diff --git a/textures/t_7.png b/textures/t_7.png
new file mode 100644
index 0000000..be6f684
--- /dev/null
+++ b/textures/t_7.png
Binary files differ
diff --git a/textures/t_8.png b/textures/t_8.png
new file mode 100644
index 0000000..de6aa99
--- /dev/null
+++ b/textures/t_8.png
Binary files differ
diff --git a/textures/t_9.png b/textures/t_9.png
new file mode 100644
index 0000000..bbd3d4d
--- /dev/null
+++ b/textures/t_9.png
Binary files differ
diff --git a/textures/t_a.png b/textures/t_a.png
new file mode 100644
index 0000000..e0ff7fd
--- /dev/null
+++ b/textures/t_a.png
Binary files differ
diff --git a/textures/t_a_.png b/textures/t_a_.png
new file mode 100644
index 0000000..f58d5f8
--- /dev/null
+++ b/textures/t_a_.png
Binary files differ
diff --git a/textures/t_am.png b/textures/t_am.png
new file mode 100644
index 0000000..9de4d82
--- /dev/null
+++ b/textures/t_am.png
Binary files differ
diff --git a/textures/t_ap.png b/textures/t_ap.png
new file mode 100644
index 0000000..910cb41
--- /dev/null
+++ b/textures/t_ap.png
Binary files differ
diff --git a/textures/t_as.png b/textures/t_as.png
new file mode 100644
index 0000000..f5a3f46
--- /dev/null
+++ b/textures/t_as.png
Binary files differ
diff --git a/textures/t_at.png b/textures/t_at.png
new file mode 100644
index 0000000..391f2e4
--- /dev/null
+++ b/textures/t_at.png
Binary files differ
diff --git a/textures/t_b.png b/textures/t_b.png
new file mode 100644
index 0000000..cf86a8d
--- /dev/null
+++ b/textures/t_b.png
Binary files differ
diff --git a/textures/t_b_.png b/textures/t_b_.png
new file mode 100644
index 0000000..12682b3
--- /dev/null
+++ b/textures/t_b_.png
Binary files differ
diff --git a/textures/t_bl.png b/textures/t_bl.png
new file mode 100644
index 0000000..da8878f
--- /dev/null
+++ b/textures/t_bl.png
Binary files differ
diff --git a/textures/t_br.png b/textures/t_br.png
new file mode 100644
index 0000000..e0dd776
--- /dev/null
+++ b/textures/t_br.png
Binary files differ
diff --git a/textures/t_c.png b/textures/t_c.png
new file mode 100644
index 0000000..bada45b
--- /dev/null
+++ b/textures/t_c.png
Binary files differ
diff --git a/textures/t_c_.png b/textures/t_c_.png
new file mode 100644
index 0000000..2fc41a0
--- /dev/null
+++ b/textures/t_c_.png
Binary files differ
diff --git a/textures/t_ca.png b/textures/t_ca.png
new file mode 100644
index 0000000..817f0eb
--- /dev/null
+++ b/textures/t_ca.png
Binary files differ
diff --git a/textures/t_cl.png b/textures/t_cl.png
new file mode 100644
index 0000000..a06b128
--- /dev/null
+++ b/textures/t_cl.png
Binary files differ
diff --git a/textures/t_cm.png b/textures/t_cm.png
new file mode 100644
index 0000000..bd1e106
--- /dev/null
+++ b/textures/t_cm.png
Binary files differ
diff --git a/textures/t_co.png b/textures/t_co.png
new file mode 100644
index 0000000..7249904
--- /dev/null
+++ b/textures/t_co.png
Binary files differ
diff --git a/textures/t_cr.png b/textures/t_cr.png
new file mode 100644
index 0000000..1a6edcb
--- /dev/null
+++ b/textures/t_cr.png
Binary files differ
diff --git a/textures/t_d.png b/textures/t_d.png
new file mode 100644
index 0000000..59dbc77
--- /dev/null
+++ b/textures/t_d.png
Binary files differ
diff --git a/textures/t_d_.png b/textures/t_d_.png
new file mode 100644
index 0000000..d8f9ffb
--- /dev/null
+++ b/textures/t_d_.png
Binary files differ
diff --git a/textures/t_dl.png b/textures/t_dl.png
new file mode 100644
index 0000000..6f7f825
--- /dev/null
+++ b/textures/t_dl.png
Binary files differ
diff --git a/textures/t_dt.png b/textures/t_dt.png
new file mode 100644
index 0000000..9ab92f2
--- /dev/null
+++ b/textures/t_dt.png
Binary files differ
diff --git a/textures/t_dv.png b/textures/t_dv.png
new file mode 100644
index 0000000..8139210
--- /dev/null
+++ b/textures/t_dv.png
Binary files differ
diff --git a/textures/t_e.png b/textures/t_e.png
new file mode 100644
index 0000000..fc769af
--- /dev/null
+++ b/textures/t_e.png
Binary files differ
diff --git a/textures/t_e_.png b/textures/t_e_.png
new file mode 100644
index 0000000..ea070dc
--- /dev/null
+++ b/textures/t_e_.png
Binary files differ
diff --git a/textures/t_eq.png b/textures/t_eq.png
new file mode 100644
index 0000000..204c77c
--- /dev/null
+++ b/textures/t_eq.png
Binary files differ
diff --git a/textures/t_ex.png b/textures/t_ex.png
new file mode 100644
index 0000000..c616200
--- /dev/null
+++ b/textures/t_ex.png
Binary files differ
diff --git a/textures/t_f.png b/textures/t_f.png
new file mode 100644
index 0000000..aab539e
--- /dev/null
+++ b/textures/t_f.png
Binary files differ
diff --git a/textures/t_f_.png b/textures/t_f_.png
new file mode 100644
index 0000000..5dd0914
--- /dev/null
+++ b/textures/t_f_.png
Binary files differ
diff --git a/textures/t_g.png b/textures/t_g.png
new file mode 100644
index 0000000..ca8ff52
--- /dev/null
+++ b/textures/t_g.png
Binary files differ
diff --git a/textures/t_g_.png b/textures/t_g_.png
new file mode 100644
index 0000000..364931b
--- /dev/null
+++ b/textures/t_g_.png
Binary files differ
diff --git a/textures/t_gt.png b/textures/t_gt.png
new file mode 100644
index 0000000..fea2f49
--- /dev/null
+++ b/textures/t_gt.png
Binary files differ
diff --git a/textures/t_h.png b/textures/t_h.png
new file mode 100644
index 0000000..0b2f946
--- /dev/null
+++ b/textures/t_h.png
Binary files differ
diff --git a/textures/t_h_.png b/textures/t_h_.png
new file mode 100644
index 0000000..23f59e8
--- /dev/null
+++ b/textures/t_h_.png
Binary files differ
diff --git a/textures/t_ha.png b/textures/t_ha.png
new file mode 100644
index 0000000..5f9a654
--- /dev/null
+++ b/textures/t_ha.png
Binary files differ
diff --git a/textures/t_hs.png b/textures/t_hs.png
new file mode 100644
index 0000000..8d02ceb
--- /dev/null
+++ b/textures/t_hs.png
Binary files differ
diff --git a/textures/t_i.png b/textures/t_i.png
new file mode 100644
index 0000000..dfde1bf
--- /dev/null
+++ b/textures/t_i.png
Binary files differ
diff --git a/textures/t_i_.png b/textures/t_i_.png
new file mode 100644
index 0000000..bb4bbd7
--- /dev/null
+++ b/textures/t_i_.png
Binary files differ
diff --git a/textures/t_j.png b/textures/t_j.png
new file mode 100644
index 0000000..dcd9e2f
--- /dev/null
+++ b/textures/t_j.png
Binary files differ
diff --git a/textures/t_j_.png b/textures/t_j_.png
new file mode 100644
index 0000000..14da4f9
--- /dev/null
+++ b/textures/t_j_.png
Binary files differ
diff --git a/textures/t_k.png b/textures/t_k.png
new file mode 100644
index 0000000..4aa2667
--- /dev/null
+++ b/textures/t_k.png
Binary files differ
diff --git a/textures/t_k_.png b/textures/t_k_.png
new file mode 100644
index 0000000..b381606
--- /dev/null
+++ b/textures/t_k_.png
Binary files differ
diff --git a/textures/t_l.png b/textures/t_l.png
new file mode 100644
index 0000000..e335ce8
--- /dev/null
+++ b/textures/t_l.png
Binary files differ
diff --git a/textures/t_l_.png b/textures/t_l_.png
new file mode 100644
index 0000000..ec38de1
--- /dev/null
+++ b/textures/t_l_.png
Binary files differ
diff --git a/textures/t_lt.png b/textures/t_lt.png
new file mode 100644
index 0000000..062509b
--- /dev/null
+++ b/textures/t_lt.png
Binary files differ
diff --git a/textures/t_m.png b/textures/t_m.png
new file mode 100644
index 0000000..897dd2e
--- /dev/null
+++ b/textures/t_m.png
Binary files differ
diff --git a/textures/t_m_.png b/textures/t_m_.png
new file mode 100644
index 0000000..ed401b6
--- /dev/null
+++ b/textures/t_m_.png
Binary files differ
diff --git a/textures/t_mn.png b/textures/t_mn.png
new file mode 100644
index 0000000..af1d050
--- /dev/null
+++ b/textures/t_mn.png
Binary files differ
diff --git a/textures/t_n.png b/textures/t_n.png
new file mode 100644
index 0000000..f5f47a4
--- /dev/null
+++ b/textures/t_n.png
Binary files differ
diff --git a/textures/t_n_.png b/textures/t_n_.png
new file mode 100644
index 0000000..7c5bef5
--- /dev/null
+++ b/textures/t_n_.png
Binary files differ
diff --git a/textures/t_o.png b/textures/t_o.png
new file mode 100644
index 0000000..62ee9b4
--- /dev/null
+++ b/textures/t_o.png
Binary files differ
diff --git a/textures/t_o_.png b/textures/t_o_.png
new file mode 100644
index 0000000..5629f70
--- /dev/null
+++ b/textures/t_o_.png
Binary files differ
diff --git a/textures/t_p.png b/textures/t_p.png
new file mode 100644
index 0000000..cfd2614
--- /dev/null
+++ b/textures/t_p.png
Binary files differ
diff --git a/textures/t_p_.png b/textures/t_p_.png
new file mode 100644
index 0000000..63dcfce
--- /dev/null
+++ b/textures/t_p_.png
Binary files differ
diff --git a/textures/t_pr.png b/textures/t_pr.png
new file mode 100644
index 0000000..0948fa5
--- /dev/null
+++ b/textures/t_pr.png
Binary files differ
diff --git a/textures/t_ps.png b/textures/t_ps.png
new file mode 100644
index 0000000..3c7675c
--- /dev/null
+++ b/textures/t_ps.png
Binary files differ
diff --git a/textures/t_q.png b/textures/t_q.png
new file mode 100644
index 0000000..6336150
--- /dev/null
+++ b/textures/t_q.png
Binary files differ
diff --git a/textures/t_q_.png b/textures/t_q_.png
new file mode 100644
index 0000000..cceb6f6
--- /dev/null
+++ b/textures/t_q_.png
Binary files differ
diff --git a/textures/t_qo.png b/textures/t_qo.png
new file mode 100644
index 0000000..00dadee
--- /dev/null
+++ b/textures/t_qo.png
Binary files differ
diff --git a/textures/t_qu.png b/textures/t_qu.png
new file mode 100644
index 0000000..01e796a
--- /dev/null
+++ b/textures/t_qu.png
Binary files differ
diff --git a/textures/t_r.png b/textures/t_r.png
new file mode 100644
index 0000000..3d32df6
--- /dev/null
+++ b/textures/t_r.png
Binary files differ
diff --git a/textures/t_r_.png b/textures/t_r_.png
new file mode 100644
index 0000000..4f0ecdf
--- /dev/null
+++ b/textures/t_r_.png
Binary files differ
diff --git a/textures/t_re.png b/textures/t_re.png
new file mode 100644
index 0000000..2b63aff
--- /dev/null
+++ b/textures/t_re.png
Binary files differ
diff --git a/textures/t_s.png b/textures/t_s.png
new file mode 100644
index 0000000..9e773ce
--- /dev/null
+++ b/textures/t_s.png
Binary files differ
diff --git a/textures/t_s_.png b/textures/t_s_.png
new file mode 100644
index 0000000..78249e2
--- /dev/null
+++ b/textures/t_s_.png
Binary files differ
diff --git a/textures/t_sl.png b/textures/t_sl.png
new file mode 100644
index 0000000..1cdde87
--- /dev/null
+++ b/textures/t_sl.png
Binary files differ
diff --git a/textures/t_sm.png b/textures/t_sm.png
new file mode 100644
index 0000000..f4cbc48
--- /dev/null
+++ b/textures/t_sm.png
Binary files differ
diff --git a/textures/t_sp.png b/textures/t_sp.png
new file mode 100644
index 0000000..09fd733
--- /dev/null
+++ b/textures/t_sp.png
Binary files differ
diff --git a/textures/t_sr.png b/textures/t_sr.png
new file mode 100644
index 0000000..7928ba9
--- /dev/null
+++ b/textures/t_sr.png
Binary files differ
diff --git a/textures/t_t.png b/textures/t_t.png
new file mode 100644
index 0000000..2df13cd
--- /dev/null
+++ b/textures/t_t.png
Binary files differ
diff --git a/textures/t_t_.png b/textures/t_t_.png
new file mode 100644
index 0000000..0f463f0
--- /dev/null
+++ b/textures/t_t_.png
Binary files differ
diff --git a/textures/t_tl.png b/textures/t_tl.png
new file mode 100644
index 0000000..cf34eb1
--- /dev/null
+++ b/textures/t_tl.png
Binary files differ
diff --git a/textures/t_u.png b/textures/t_u.png
new file mode 100644
index 0000000..dcc7e74
--- /dev/null
+++ b/textures/t_u.png
Binary files differ
diff --git a/textures/t_u_.png b/textures/t_u_.png
new file mode 100644
index 0000000..4e2099f
--- /dev/null
+++ b/textures/t_u_.png
Binary files differ
diff --git a/textures/t_un.png b/textures/t_un.png
new file mode 100644
index 0000000..5c6834c
--- /dev/null
+++ b/textures/t_un.png
Binary files differ
diff --git a/textures/t_v.png b/textures/t_v.png
new file mode 100644
index 0000000..de4f0c9
--- /dev/null
+++ b/textures/t_v.png
Binary files differ
diff --git a/textures/t_v_.png b/textures/t_v_.png
new file mode 100644
index 0000000..6fa0d4d
--- /dev/null
+++ b/textures/t_v_.png
Binary files differ
diff --git a/textures/t_vb.png b/textures/t_vb.png
new file mode 100644
index 0000000..6926380
--- /dev/null
+++ b/textures/t_vb.png
Binary files differ
diff --git a/textures/t_w.png b/textures/t_w.png
new file mode 100644
index 0000000..15e61b9
--- /dev/null
+++ b/textures/t_w.png
Binary files differ
diff --git a/textures/t_w_.png b/textures/t_w_.png
new file mode 100644
index 0000000..a1f5317
--- /dev/null
+++ b/textures/t_w_.png
Binary files differ
diff --git a/textures/t_x.png b/textures/t_x.png
new file mode 100644
index 0000000..f79be97
--- /dev/null
+++ b/textures/t_x.png
Binary files differ
diff --git a/textures/t_x_.png b/textures/t_x_.png
new file mode 100644
index 0000000..ed0ba14
--- /dev/null
+++ b/textures/t_x_.png
Binary files differ
diff --git a/textures/t_y.png b/textures/t_y.png
new file mode 100644
index 0000000..d80eb1a
--- /dev/null
+++ b/textures/t_y.png
Binary files differ
diff --git a/textures/t_y_.png b/textures/t_y_.png
new file mode 100644
index 0000000..7c88047
--- /dev/null
+++ b/textures/t_y_.png
Binary files differ
diff --git a/textures/t_z.png b/textures/t_z.png
new file mode 100644
index 0000000..43d9016
--- /dev/null
+++ b/textures/t_z.png
Binary files differ
diff --git a/textures/t_z_.png b/textures/t_z_.png
new file mode 100644
index 0000000..16ddb36
--- /dev/null
+++ b/textures/t_z_.png
Binary files differ
diff --git a/textures/textline_anyside.png b/textures/textline_anyside.png
new file mode 100644
index 0000000..10c97c7
--- /dev/null
+++ b/textures/textline_anyside.png
Binary files differ
diff --git a/textures/textline_background.png b/textures/textline_background.png
new file mode 100644
index 0000000..b0c4e71
--- /dev/null
+++ b/textures/textline_background.png
Binary files differ
diff --git a/textures/textline_icon.png b/textures/textline_icon.png
new file mode 100644
index 0000000..219c343
--- /dev/null
+++ b/textures/textline_icon.png
Binary files differ