diff options
| author | gbl08ma <gbl08ma@gmail.com> | 2017-02-05 22:40:43 +0000 | 
|---|---|---|
| committer | gbl08ma <gbl08ma@gmail.com> | 2017-02-05 22:40:43 +0000 | 
| commit | f2f528e5dcef4b5956ec7707ec91c2fef52fcce5 (patch) | |
| tree | 7f6d802757b222c081fe4ea81507e27c7886ba5e | |
Initial public release
| -rw-r--r-- | LICENSE.txt | 188 | ||||
| -rw-r--r-- | README.md | 44 | ||||
| -rw-r--r-- | characters | 282 | ||||
| -rw-r--r-- | depends.txt | 2 | ||||
| -rw-r--r-- | init.lua | 251 | ||||
| -rw-r--r-- | screenshot.png | bin | 0 -> 66424 bytes | |||
| -rw-r--r-- | textures/t_0.png | bin | 0 -> 277 bytes | |||
| -rw-r--r-- | textures/t_1.png | bin | 0 -> 279 bytes | |||
| -rw-r--r-- | textures/t_2.png | bin | 0 -> 285 bytes | |||
| -rw-r--r-- | textures/t_3.png | bin | 0 -> 282 bytes | |||
| -rw-r--r-- | textures/t_4.png | bin | 0 -> 288 bytes | |||
| -rw-r--r-- | textures/t_5.png | bin | 0 -> 282 bytes | |||
| -rw-r--r-- | textures/t_6.png | bin | 0 -> 282 bytes | |||
| -rw-r--r-- | textures/t_7.png | bin | 0 -> 282 bytes | |||
| -rw-r--r-- | textures/t_8.png | bin | 0 -> 277 bytes | |||
| -rw-r--r-- | textures/t_9.png | bin | 0 -> 282 bytes | |||
| -rw-r--r-- | textures/t_a.png | bin | 0 -> 284 bytes | |||
| -rw-r--r-- | textures/t_a_.png | bin | 0 -> 285 bytes | |||
| -rw-r--r-- | textures/t_am.png | bin | 0 -> 316 bytes | |||
| -rw-r--r-- | textures/t_ap.png | bin | 0 -> 273 bytes | |||
| -rw-r--r-- | textures/t_as.png | bin | 0 -> 279 bytes | |||
| -rw-r--r-- | textures/t_at.png | bin | 0 -> 288 bytes | |||
| -rw-r--r-- | textures/t_b.png | bin | 0 -> 284 bytes | |||
| -rw-r--r-- | textures/t_b_.png | bin | 0 -> 283 bytes | |||
| -rw-r--r-- | textures/t_bl.png | bin | 0 -> 281 bytes | |||
| -rw-r--r-- | textures/t_br.png | bin | 0 -> 281 bytes | |||
| -rw-r--r-- | textures/t_c.png | bin | 0 -> 278 bytes | |||
| -rw-r--r-- | textures/t_c_.png | bin | 0 -> 280 bytes | |||
| -rw-r--r-- | textures/t_ca.png | bin | 0 -> 280 bytes | |||
| -rw-r--r-- | textures/t_cl.png | bin | 0 -> 279 bytes | |||
| -rw-r--r-- | textures/t_cm.png | bin | 0 -> 275 bytes | |||
| -rw-r--r-- | textures/t_co.png | bin | 0 -> 264 bytes | |||
| -rw-r--r-- | textures/t_cr.png | bin | 0 -> 279 bytes | |||
| -rw-r--r-- | textures/t_d.png | bin | 0 -> 285 bytes | |||
| -rw-r--r-- | textures/t_d_.png | bin | 0 -> 280 bytes | |||
| -rw-r--r-- | textures/t_dl.png | bin | 0 -> 285 bytes | |||
| -rw-r--r-- | textures/t_dt.png | bin | 0 -> 273 bytes | |||
| -rw-r--r-- | textures/t_dv.png | bin | 0 -> 285 bytes | |||
| -rw-r--r-- | textures/t_e.png | bin | 0 -> 278 bytes | |||
| -rw-r--r-- | textures/t_e_.png | bin | 0 -> 285 bytes | |||
| -rw-r--r-- | textures/t_eq.png | bin | 0 -> 273 bytes | |||
| -rw-r--r-- | textures/t_ex.png | bin | 0 -> 276 bytes | |||
| -rw-r--r-- | textures/t_f.png | bin | 0 -> 280 bytes | |||
| -rw-r--r-- | textures/t_f_.png | bin | 0 -> 288 bytes | |||
| -rw-r--r-- | textures/t_g.png | bin | 0 -> 285 bytes | |||
| -rw-r--r-- | textures/t_g_.png | bin | 0 -> 281 bytes | |||
| -rw-r--r-- | textures/t_gt.png | bin | 0 -> 279 bytes | |||
| -rw-r--r-- | textures/t_h.png | bin | 0 -> 285 bytes | |||
| -rw-r--r-- | textures/t_h_.png | bin | 0 -> 284 bytes | |||
| -rw-r--r-- | textures/t_ha.png | bin | 0 -> 277 bytes | |||
| -rw-r--r-- | textures/t_hs.png | bin | 0 -> 312 bytes | |||
| -rw-r--r-- | textures/t_i.png | bin | 0 -> 281 bytes | |||
| -rw-r--r-- | textures/t_i_.png | bin | 0 -> 279 bytes | |||
| -rw-r--r-- | textures/t_j.png | bin | 0 -> 279 bytes | |||
| -rw-r--r-- | textures/t_j_.png | bin | 0 -> 282 bytes | |||
| -rw-r--r-- | textures/t_k.png | bin | 0 -> 289 bytes | |||
| -rw-r--r-- | textures/t_k_.png | bin | 0 -> 286 bytes | |||
| -rw-r--r-- | textures/t_l.png | bin | 0 -> 279 bytes | |||
| -rw-r--r-- | textures/t_l_.png | bin | 0 -> 281 bytes | |||
| -rw-r--r-- | textures/t_lt.png | bin | 0 -> 279 bytes | |||
| -rw-r--r-- | textures/t_m.png | bin | 0 -> 279 bytes | |||
| -rw-r--r-- | textures/t_m_.png | bin | 0 -> 281 bytes | |||
| -rw-r--r-- | textures/t_mn.png | bin | 0 -> 273 bytes | |||
| -rw-r--r-- | textures/t_n.png | bin | 0 -> 280 bytes | |||
| -rw-r--r-- | textures/t_n_.png | bin | 0 -> 286 bytes | |||
| -rw-r--r-- | textures/t_o.png | bin | 0 -> 276 bytes | |||
| -rw-r--r-- | textures/t_o_.png | bin | 0 -> 277 bytes | |||
| -rw-r--r-- | textures/t_p.png | bin | 0 -> 283 bytes | |||
| -rw-r--r-- | textures/t_p_.png | bin | 0 -> 284 bytes | |||
| -rw-r--r-- | textures/t_pr.png | bin | 0 -> 292 bytes | |||
| -rw-r--r-- | textures/t_ps.png | bin | 0 -> 277 bytes | |||
| -rw-r--r-- | textures/t_q.png | bin | 0 -> 286 bytes | |||
| -rw-r--r-- | textures/t_q_.png | bin | 0 -> 279 bytes | |||
| -rw-r--r-- | textures/t_qo.png | bin | 0 -> 273 bytes | |||
| -rw-r--r-- | textures/t_qu.png | bin | 0 -> 281 bytes | |||
| -rw-r--r-- | textures/t_r.png | bin | 0 -> 279 bytes | |||
| -rw-r--r-- | textures/t_r_.png | bin | 0 -> 282 bytes | |||
| -rw-r--r-- | textures/t_re.png | bin | 0 -> 283 bytes | |||
| -rw-r--r-- | textures/t_s.png | bin | 0 -> 280 bytes | |||
| -rw-r--r-- | textures/t_s_.png | bin | 0 -> 282 bytes | |||
| -rw-r--r-- | textures/t_sl.png | bin | 0 -> 277 bytes | |||
| -rw-r--r-- | textures/t_sm.png | bin | 0 -> 276 bytes | |||
| -rw-r--r-- | textures/t_sp.png | bin | 0 -> 231 bytes | |||
| -rw-r--r-- | textures/t_sr.png | bin | 0 -> 277 bytes | |||
| -rw-r--r-- | textures/t_t.png | bin | 0 -> 281 bytes | |||
| -rw-r--r-- | textures/t_t_.png | bin | 0 -> 283 bytes | |||
| -rw-r--r-- | textures/t_tl.png | bin | 0 -> 275 bytes | |||
| -rw-r--r-- | textures/t_u.png | bin | 0 -> 279 bytes | |||
| -rw-r--r-- | textures/t_u_.png | bin | 0 -> 280 bytes | |||
| -rw-r--r-- | textures/t_un.png | bin | 0 -> 273 bytes | |||
| -rw-r--r-- | textures/t_v.png | bin | 0 -> 282 bytes | |||
| -rw-r--r-- | textures/t_v_.png | bin | 0 -> 283 bytes | |||
| -rw-r--r-- | textures/t_vb.png | bin | 0 -> 273 bytes | |||
| -rw-r--r-- | textures/t_w.png | bin | 0 -> 281 bytes | |||
| -rw-r--r-- | textures/t_w_.png | bin | 0 -> 283 bytes | |||
| -rw-r--r-- | textures/t_x.png | bin | 0 -> 282 bytes | |||
| -rw-r--r-- | textures/t_x_.png | bin | 0 -> 282 bytes | |||
| -rw-r--r-- | textures/t_y.png | bin | 0 -> 284 bytes | |||
| -rw-r--r-- | textures/t_y_.png | bin | 0 -> 285 bytes | |||
| -rw-r--r-- | textures/t_z.png | bin | 0 -> 279 bytes | |||
| -rw-r--r-- | textures/t_z_.png | bin | 0 -> 281 bytes | |||
| -rw-r--r-- | textures/textline_anyside.png | bin | 0 -> 144 bytes | |||
| -rw-r--r-- | textures/textline_background.png | bin | 0 -> 218 bytes | |||
| -rw-r--r-- | textures/textline_icon.png | bin | 0 -> 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. + + + +## 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 Binary files differnew file mode 100644 index 0000000..a69e83c --- /dev/null +++ b/screenshot.png diff --git a/textures/t_0.png b/textures/t_0.png Binary files differnew file mode 100644 index 0000000..94eca9b --- /dev/null +++ b/textures/t_0.png diff --git a/textures/t_1.png b/textures/t_1.png Binary files differnew file mode 100644 index 0000000..12ff6c3 --- /dev/null +++ b/textures/t_1.png diff --git a/textures/t_2.png b/textures/t_2.png Binary files differnew file mode 100644 index 0000000..6d194d0 --- /dev/null +++ b/textures/t_2.png diff --git a/textures/t_3.png b/textures/t_3.png Binary files differnew file mode 100644 index 0000000..bb2c010 --- /dev/null +++ b/textures/t_3.png diff --git a/textures/t_4.png b/textures/t_4.png Binary files differnew file mode 100644 index 0000000..c4aa8b8 --- /dev/null +++ b/textures/t_4.png diff --git a/textures/t_5.png b/textures/t_5.png Binary files differnew file mode 100644 index 0000000..c88947c --- /dev/null +++ b/textures/t_5.png diff --git a/textures/t_6.png b/textures/t_6.png Binary files differnew file mode 100644 index 0000000..9a8a6d4 --- /dev/null +++ b/textures/t_6.png diff --git a/textures/t_7.png b/textures/t_7.png Binary files differnew file mode 100644 index 0000000..be6f684 --- /dev/null +++ b/textures/t_7.png diff --git a/textures/t_8.png b/textures/t_8.png Binary files differnew file mode 100644 index 0000000..de6aa99 --- /dev/null +++ b/textures/t_8.png diff --git a/textures/t_9.png b/textures/t_9.png Binary files differnew file mode 100644 index 0000000..bbd3d4d --- /dev/null +++ b/textures/t_9.png diff --git a/textures/t_a.png b/textures/t_a.png Binary files differnew file mode 100644 index 0000000..e0ff7fd --- /dev/null +++ b/textures/t_a.png diff --git a/textures/t_a_.png b/textures/t_a_.png Binary files differnew file mode 100644 index 0000000..f58d5f8 --- /dev/null +++ b/textures/t_a_.png diff --git a/textures/t_am.png b/textures/t_am.png Binary files differnew file mode 100644 index 0000000..9de4d82 --- /dev/null +++ b/textures/t_am.png diff --git a/textures/t_ap.png b/textures/t_ap.png Binary files differnew file mode 100644 index 0000000..910cb41 --- /dev/null +++ b/textures/t_ap.png diff --git a/textures/t_as.png b/textures/t_as.png Binary files differnew file mode 100644 index 0000000..f5a3f46 --- /dev/null +++ b/textures/t_as.png diff --git a/textures/t_at.png b/textures/t_at.png Binary files differnew file mode 100644 index 0000000..391f2e4 --- /dev/null +++ b/textures/t_at.png diff --git a/textures/t_b.png b/textures/t_b.png Binary files differnew file mode 100644 index 0000000..cf86a8d --- /dev/null +++ b/textures/t_b.png diff --git a/textures/t_b_.png b/textures/t_b_.png Binary files differnew file mode 100644 index 0000000..12682b3 --- /dev/null +++ b/textures/t_b_.png diff --git a/textures/t_bl.png b/textures/t_bl.png Binary files differnew file mode 100644 index 0000000..da8878f --- /dev/null +++ b/textures/t_bl.png diff --git a/textures/t_br.png b/textures/t_br.png Binary files differnew file mode 100644 index 0000000..e0dd776 --- /dev/null +++ b/textures/t_br.png diff --git a/textures/t_c.png b/textures/t_c.png Binary files differnew file mode 100644 index 0000000..bada45b --- /dev/null +++ b/textures/t_c.png diff --git a/textures/t_c_.png b/textures/t_c_.png Binary files differnew file mode 100644 index 0000000..2fc41a0 --- /dev/null +++ b/textures/t_c_.png diff --git a/textures/t_ca.png b/textures/t_ca.png Binary files differnew file mode 100644 index 0000000..817f0eb --- /dev/null +++ b/textures/t_ca.png diff --git a/textures/t_cl.png b/textures/t_cl.png Binary files differnew file mode 100644 index 0000000..a06b128 --- /dev/null +++ b/textures/t_cl.png diff --git a/textures/t_cm.png b/textures/t_cm.png Binary files differnew file mode 100644 index 0000000..bd1e106 --- /dev/null +++ b/textures/t_cm.png diff --git a/textures/t_co.png b/textures/t_co.png Binary files differnew file mode 100644 index 0000000..7249904 --- /dev/null +++ b/textures/t_co.png diff --git a/textures/t_cr.png b/textures/t_cr.png Binary files differnew file mode 100644 index 0000000..1a6edcb --- /dev/null +++ b/textures/t_cr.png diff --git a/textures/t_d.png b/textures/t_d.png Binary files differnew file mode 100644 index 0000000..59dbc77 --- /dev/null +++ b/textures/t_d.png diff --git a/textures/t_d_.png b/textures/t_d_.png Binary files differnew file mode 100644 index 0000000..d8f9ffb --- /dev/null +++ b/textures/t_d_.png diff --git a/textures/t_dl.png b/textures/t_dl.png Binary files differnew file mode 100644 index 0000000..6f7f825 --- /dev/null +++ b/textures/t_dl.png diff --git a/textures/t_dt.png b/textures/t_dt.png Binary files differnew file mode 100644 index 0000000..9ab92f2 --- /dev/null +++ b/textures/t_dt.png diff --git a/textures/t_dv.png b/textures/t_dv.png Binary files differnew file mode 100644 index 0000000..8139210 --- /dev/null +++ b/textures/t_dv.png diff --git a/textures/t_e.png b/textures/t_e.png Binary files differnew file mode 100644 index 0000000..fc769af --- /dev/null +++ b/textures/t_e.png diff --git a/textures/t_e_.png b/textures/t_e_.png Binary files differnew file mode 100644 index 0000000..ea070dc --- /dev/null +++ b/textures/t_e_.png diff --git a/textures/t_eq.png b/textures/t_eq.png Binary files differnew file mode 100644 index 0000000..204c77c --- /dev/null +++ b/textures/t_eq.png diff --git a/textures/t_ex.png b/textures/t_ex.png Binary files differnew file mode 100644 index 0000000..c616200 --- /dev/null +++ b/textures/t_ex.png diff --git a/textures/t_f.png b/textures/t_f.png Binary files differnew file mode 100644 index 0000000..aab539e --- /dev/null +++ b/textures/t_f.png diff --git a/textures/t_f_.png b/textures/t_f_.png Binary files differnew file mode 100644 index 0000000..5dd0914 --- /dev/null +++ b/textures/t_f_.png diff --git a/textures/t_g.png b/textures/t_g.png Binary files differnew file mode 100644 index 0000000..ca8ff52 --- /dev/null +++ b/textures/t_g.png diff --git a/textures/t_g_.png b/textures/t_g_.png Binary files differnew file mode 100644 index 0000000..364931b --- /dev/null +++ b/textures/t_g_.png diff --git a/textures/t_gt.png b/textures/t_gt.png Binary files differnew file mode 100644 index 0000000..fea2f49 --- /dev/null +++ b/textures/t_gt.png diff --git a/textures/t_h.png b/textures/t_h.png Binary files differnew file mode 100644 index 0000000..0b2f946 --- /dev/null +++ b/textures/t_h.png diff --git a/textures/t_h_.png b/textures/t_h_.png Binary files differnew file mode 100644 index 0000000..23f59e8 --- /dev/null +++ b/textures/t_h_.png diff --git a/textures/t_ha.png b/textures/t_ha.png Binary files differnew file mode 100644 index 0000000..5f9a654 --- /dev/null +++ b/textures/t_ha.png diff --git a/textures/t_hs.png b/textures/t_hs.png Binary files differnew file mode 100644 index 0000000..8d02ceb --- /dev/null +++ b/textures/t_hs.png diff --git a/textures/t_i.png b/textures/t_i.png Binary files differnew file mode 100644 index 0000000..dfde1bf --- /dev/null +++ b/textures/t_i.png diff --git a/textures/t_i_.png b/textures/t_i_.png Binary files differnew file mode 100644 index 0000000..bb4bbd7 --- /dev/null +++ b/textures/t_i_.png diff --git a/textures/t_j.png b/textures/t_j.png Binary files differnew file mode 100644 index 0000000..dcd9e2f --- /dev/null +++ b/textures/t_j.png diff --git a/textures/t_j_.png b/textures/t_j_.png Binary files differnew file mode 100644 index 0000000..14da4f9 --- /dev/null +++ b/textures/t_j_.png diff --git a/textures/t_k.png b/textures/t_k.png Binary files differnew file mode 100644 index 0000000..4aa2667 --- /dev/null +++ b/textures/t_k.png diff --git a/textures/t_k_.png b/textures/t_k_.png Binary files differnew file mode 100644 index 0000000..b381606 --- /dev/null +++ b/textures/t_k_.png diff --git a/textures/t_l.png b/textures/t_l.png Binary files differnew file mode 100644 index 0000000..e335ce8 --- /dev/null +++ b/textures/t_l.png diff --git a/textures/t_l_.png b/textures/t_l_.png Binary files differnew file mode 100644 index 0000000..ec38de1 --- /dev/null +++ b/textures/t_l_.png diff --git a/textures/t_lt.png b/textures/t_lt.png Binary files differnew file mode 100644 index 0000000..062509b --- /dev/null +++ b/textures/t_lt.png diff --git a/textures/t_m.png b/textures/t_m.png Binary files differnew file mode 100644 index 0000000..897dd2e --- /dev/null +++ b/textures/t_m.png diff --git a/textures/t_m_.png b/textures/t_m_.png Binary files differnew file mode 100644 index 0000000..ed401b6 --- /dev/null +++ b/textures/t_m_.png diff --git a/textures/t_mn.png b/textures/t_mn.png Binary files differnew file mode 100644 index 0000000..af1d050 --- /dev/null +++ b/textures/t_mn.png diff --git a/textures/t_n.png b/textures/t_n.png Binary files differnew file mode 100644 index 0000000..f5f47a4 --- /dev/null +++ b/textures/t_n.png diff --git a/textures/t_n_.png b/textures/t_n_.png Binary files differnew file mode 100644 index 0000000..7c5bef5 --- /dev/null +++ b/textures/t_n_.png diff --git a/textures/t_o.png b/textures/t_o.png Binary files differnew file mode 100644 index 0000000..62ee9b4 --- /dev/null +++ b/textures/t_o.png diff --git a/textures/t_o_.png b/textures/t_o_.png Binary files differnew file mode 100644 index 0000000..5629f70 --- /dev/null +++ b/textures/t_o_.png diff --git a/textures/t_p.png b/textures/t_p.png Binary files differnew file mode 100644 index 0000000..cfd2614 --- /dev/null +++ b/textures/t_p.png diff --git a/textures/t_p_.png b/textures/t_p_.png Binary files differnew file mode 100644 index 0000000..63dcfce --- /dev/null +++ b/textures/t_p_.png diff --git a/textures/t_pr.png b/textures/t_pr.png Binary files differnew file mode 100644 index 0000000..0948fa5 --- /dev/null +++ b/textures/t_pr.png diff --git a/textures/t_ps.png b/textures/t_ps.png Binary files differnew file mode 100644 index 0000000..3c7675c --- /dev/null +++ b/textures/t_ps.png diff --git a/textures/t_q.png b/textures/t_q.png Binary files differnew file mode 100644 index 0000000..6336150 --- /dev/null +++ b/textures/t_q.png diff --git a/textures/t_q_.png b/textures/t_q_.png Binary files differnew file mode 100644 index 0000000..cceb6f6 --- /dev/null +++ b/textures/t_q_.png diff --git a/textures/t_qo.png b/textures/t_qo.png Binary files differnew file mode 100644 index 0000000..00dadee --- /dev/null +++ b/textures/t_qo.png diff --git a/textures/t_qu.png b/textures/t_qu.png Binary files differnew file mode 100644 index 0000000..01e796a --- /dev/null +++ b/textures/t_qu.png diff --git a/textures/t_r.png b/textures/t_r.png Binary files differnew file mode 100644 index 0000000..3d32df6 --- /dev/null +++ b/textures/t_r.png diff --git a/textures/t_r_.png b/textures/t_r_.png Binary files differnew file mode 100644 index 0000000..4f0ecdf --- /dev/null +++ b/textures/t_r_.png diff --git a/textures/t_re.png b/textures/t_re.png Binary files differnew file mode 100644 index 0000000..2b63aff --- /dev/null +++ b/textures/t_re.png diff --git a/textures/t_s.png b/textures/t_s.png Binary files differnew file mode 100644 index 0000000..9e773ce --- /dev/null +++ b/textures/t_s.png diff --git a/textures/t_s_.png b/textures/t_s_.png Binary files differnew file mode 100644 index 0000000..78249e2 --- /dev/null +++ b/textures/t_s_.png diff --git a/textures/t_sl.png b/textures/t_sl.png Binary files differnew file mode 100644 index 0000000..1cdde87 --- /dev/null +++ b/textures/t_sl.png diff --git a/textures/t_sm.png b/textures/t_sm.png Binary files differnew file mode 100644 index 0000000..f4cbc48 --- /dev/null +++ b/textures/t_sm.png diff --git a/textures/t_sp.png b/textures/t_sp.png Binary files differnew file mode 100644 index 0000000..09fd733 --- /dev/null +++ b/textures/t_sp.png diff --git a/textures/t_sr.png b/textures/t_sr.png Binary files differnew file mode 100644 index 0000000..7928ba9 --- /dev/null +++ b/textures/t_sr.png diff --git a/textures/t_t.png b/textures/t_t.png Binary files differnew file mode 100644 index 0000000..2df13cd --- /dev/null +++ b/textures/t_t.png diff --git a/textures/t_t_.png b/textures/t_t_.png Binary files differnew file mode 100644 index 0000000..0f463f0 --- /dev/null +++ b/textures/t_t_.png diff --git a/textures/t_tl.png b/textures/t_tl.png Binary files differnew file mode 100644 index 0000000..cf34eb1 --- /dev/null +++ b/textures/t_tl.png diff --git a/textures/t_u.png b/textures/t_u.png Binary files differnew file mode 100644 index 0000000..dcc7e74 --- /dev/null +++ b/textures/t_u.png diff --git a/textures/t_u_.png b/textures/t_u_.png Binary files differnew file mode 100644 index 0000000..4e2099f --- /dev/null +++ b/textures/t_u_.png diff --git a/textures/t_un.png b/textures/t_un.png Binary files differnew file mode 100644 index 0000000..5c6834c --- /dev/null +++ b/textures/t_un.png diff --git a/textures/t_v.png b/textures/t_v.png Binary files differnew file mode 100644 index 0000000..de4f0c9 --- /dev/null +++ b/textures/t_v.png diff --git a/textures/t_v_.png b/textures/t_v_.png Binary files differnew file mode 100644 index 0000000..6fa0d4d --- /dev/null +++ b/textures/t_v_.png diff --git a/textures/t_vb.png b/textures/t_vb.png Binary files differnew file mode 100644 index 0000000..6926380 --- /dev/null +++ b/textures/t_vb.png diff --git a/textures/t_w.png b/textures/t_w.png Binary files differnew file mode 100644 index 0000000..15e61b9 --- /dev/null +++ b/textures/t_w.png diff --git a/textures/t_w_.png b/textures/t_w_.png Binary files differnew file mode 100644 index 0000000..a1f5317 --- /dev/null +++ b/textures/t_w_.png diff --git a/textures/t_x.png b/textures/t_x.png Binary files differnew file mode 100644 index 0000000..f79be97 --- /dev/null +++ b/textures/t_x.png diff --git a/textures/t_x_.png b/textures/t_x_.png Binary files differnew file mode 100644 index 0000000..ed0ba14 --- /dev/null +++ b/textures/t_x_.png diff --git a/textures/t_y.png b/textures/t_y.png Binary files differnew file mode 100644 index 0000000..d80eb1a --- /dev/null +++ b/textures/t_y.png diff --git a/textures/t_y_.png b/textures/t_y_.png Binary files differnew file mode 100644 index 0000000..7c88047 --- /dev/null +++ b/textures/t_y_.png diff --git a/textures/t_z.png b/textures/t_z.png Binary files differnew file mode 100644 index 0000000..43d9016 --- /dev/null +++ b/textures/t_z.png diff --git a/textures/t_z_.png b/textures/t_z_.png Binary files differnew file mode 100644 index 0000000..16ddb36 --- /dev/null +++ b/textures/t_z_.png diff --git a/textures/textline_anyside.png b/textures/textline_anyside.png Binary files differnew file mode 100644 index 0000000..10c97c7 --- /dev/null +++ b/textures/textline_anyside.png diff --git a/textures/textline_background.png b/textures/textline_background.png Binary files differnew file mode 100644 index 0000000..b0c4e71 --- /dev/null +++ b/textures/textline_background.png diff --git a/textures/textline_icon.png b/textures/textline_icon.png Binary files differnew file mode 100644 index 0000000..219c343 --- /dev/null +++ b/textures/textline_icon.png  | 
