Compare commits
10 Commits
20180815-3
...
20180815-6
Author | SHA1 | Date | |
---|---|---|---|
d182766236 | |||
09e5607d7a | |||
b9dd38c0de | |||
4fa6d54a4b | |||
157e517663 | |||
e622f94dfc | |||
be7f72dfeb | |||
ec2cfdd87d | |||
2faab30e19 | |||
b33de7a530 |
25
README.md
@ -8,7 +8,7 @@ Simply place a panel, right-click it, and set a channel.
|
||||
|
||||
Then send a character, a string, or one of several control words to that channel from a Mesecons Lua Controller and the mod will try to display it. The panels use the standard 7-bit ASCII character set (with a few alterations).
|
||||
|
||||
A single character will be displayed on the connected panel.
|
||||
A single character will be displayed on the connected panel. A numeric message (i.e. not a string) will display the first digit on the connected panel.
|
||||
|
||||
Strings will be displayed using all panels in a lineup, so long as they all face the same way, starting from the panel the Lua Controller is connected to, going left to right. The other panels in the line do not need to be connected to anything - think of them as being connected together internally. Only the panel at the far left need be connected to the Lua Controller.
|
||||
|
||||
@ -20,24 +20,33 @@ You can put multiple lines of panels end to end to form independent displays, so
|
||||
|
||||
The string is padded with spaces and then trimmed to 64 characters.
|
||||
|
||||
Any unrecognized symbol or character outside the ASCII 32 - 129 range, whether part of a string or singularly is ignored, except as noted below.
|
||||
Any unrecognized symbol or character, whether part of a string or singularly is ignored, except as noted below.
|
||||
|
||||
This mod uses the full ISO-8859-1 character set (see https://en.wikipedia.org/wiki/ISO/IEC_8859-1 for details), plus a bunch of symbols stuffed into the empty 128-159 range that should be useful on a marquee:
|
||||
|
||||
* 128,129: musical notes
|
||||
* 130-140: box drawing glyphs
|
||||
* 141-144: block shades
|
||||
* 145-152: arrows
|
||||
* 153-156: explosion/splat
|
||||
* 157-159: smileys
|
||||
|
||||
The panels also respond to these control messages:
|
||||
|
||||
* the words "off", "colon" and "period" translate to a blank space, ":", and ".", respectively.
|
||||
* "del" or character code 127 displays a square with an X in it
|
||||
* "allon" or character code 128 will turn on all LEDs on the panel.
|
||||
* "cursor" or character code 129 will display a short, thick line at the bottom of the panel.
|
||||
* the keywords "off", "colon" and "period" translate to a blank space, ":", and ".", respectively (they're leftover from the nixie tubes fork, but might be useful anyway)
|
||||
* "del" is mapped to character #127, a square with an X in it.
|
||||
* "allon" is mapped to character #144, the full/all-on block graphic.
|
||||
* "cursor" or character code 31 will display a short, thick, flashing line at the bottom of the panel.
|
||||
* "off_multi" turns all panels in a lineup off
|
||||
* "allon_multi" turns on all LEDs of all panels in a lineup.
|
||||
|
||||
A byte value of 0 to 30 will change colors (i.e. string.char(0 to 30) ). Color values 0 to 11 are:
|
||||
A byte value of 0 to 27 will change colors (i.e. string.char(0 to 27) ). Color values 0 to 11 are:
|
||||
|
||||
Red (0), orange, yellow, lime, green, aqua, cyan, sky blue, blue, violet, magenta, or red-violet (11)
|
||||
|
||||
Colors 12 to 23 are the same as 0 to 11, but lower brightness.
|
||||
|
||||
Colors 23 - 30 are white, light grey, medium grey, dim grey, light blue, brown, and pink.
|
||||
Colors 24 - 27 are white, light grey, medium grey, and dim grey.
|
||||
|
||||
The left-most/"master" panel will remember the last color used, and defaults to red.
|
||||
|
||||
|
87
init.lua
@ -1,11 +1,9 @@
|
||||
-- simple LED marquee mod
|
||||
-- by Vanessa Dannenberg
|
||||
|
||||
led_marquee = {}
|
||||
|
||||
local S
|
||||
if minetest.get_modpath("intllib") then
|
||||
S = intllib.Getter()
|
||||
S = intllib.make_gettext_pair()
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
@ -48,7 +46,7 @@ local padding = " "
|
||||
local allon = string.char(128)
|
||||
for i = 1, 64 do
|
||||
padding = padding.." "
|
||||
allon = allon..string.char(128)
|
||||
allon = allon..string.char(144)
|
||||
end
|
||||
|
||||
local display_string = function(pos, channel, string)
|
||||
@ -58,27 +56,29 @@ local display_string = function(pos, channel, string)
|
||||
string = allon
|
||||
end
|
||||
local padded_string = string.sub(string..padding, 1, 64)
|
||||
local fdir = minetest.get_node(pos).param2 % 8
|
||||
local master_fdir = minetest.get_node(pos).param2 % 8
|
||||
local master_meta = minetest.get_meta(pos)
|
||||
local last_color = master_meta:get_int("last_color")
|
||||
local pos2 = pos
|
||||
local mastermeta = minetest.get_meta(pos)
|
||||
local lastcolor = mastermeta:get_int("lastcolor")
|
||||
if not lastcolor or lastcolor < 0 or lastcolor > 30 then
|
||||
lastcolor = 0
|
||||
mastermeta:set_int("lastcolor", 0)
|
||||
|
||||
if not last_color or last_color < 0 or last_color > 27 then
|
||||
last_color = 0
|
||||
master_meta:set_int("last_color", 0)
|
||||
end
|
||||
for i = 1, 64 do
|
||||
local node = minetest.get_node(pos2)
|
||||
local fdir = node.param2 % 8
|
||||
local meta = minetest.get_meta(pos2)
|
||||
local setchan = meta:get_string("channel")
|
||||
if not string.match(node.name, "led_marquee:char_") or (setchan ~= nil and setchan ~= "" and setchan ~= channel) then break end
|
||||
local asc = string.byte(padded_string, i, i)
|
||||
if (node.param2 % 8) == fdir and asc > 31 and asc < 130 then
|
||||
minetest.swap_node(pos2, { name = "led_marquee:char_"..asc, param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
if master_fdir == fdir and asc > 30 and asc < 256 then
|
||||
minetest.swap_node(pos2, { name = "led_marquee:char_"..asc, param2 = master_fdir + (last_color*8)})
|
||||
pos2.x = pos2.x + fdir_to_right[fdir+1][1]
|
||||
pos2.z = pos2.z + fdir_to_right[fdir+1][2]
|
||||
elseif asc < 31 then
|
||||
lastcolor = asc
|
||||
mastermeta:set_int("lastcolor", asc)
|
||||
elseif asc < 28 then
|
||||
last_color = asc
|
||||
master_meta:set_int("last_color", asc)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -86,37 +86,38 @@ end
|
||||
local on_digiline_receive_string = function(pos, node, channel, msg)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local setchan = meta:get_string("channel")
|
||||
local lastcolor = meta:get_int("lastcolor")
|
||||
if not lastcolor or lastcolor < 0 or lastcolor > 30 then
|
||||
lastcolor = 0
|
||||
meta:set_int("lastcolor", 0)
|
||||
local last_color = meta:get_int("last_color")
|
||||
if not last_color or last_color < 0 or last_color > 27 then
|
||||
last_color = 0
|
||||
meta:set_int("last_color", 0)
|
||||
end
|
||||
local fdir = node.param2 % 8
|
||||
|
||||
if setchan ~= channel then return end
|
||||
if msg and msg ~= "" and type(msg) == "string" then
|
||||
if string.len(msg) > 1 then
|
||||
if msg == "off" then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_32", param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_32", param2 = fdir + (last_color*8)})
|
||||
elseif msg == "colon" then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_58", param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_58", param2 = fdir + (last_color*8)})
|
||||
elseif msg == "period" then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_46", param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_46", param2 = fdir + (last_color*8)})
|
||||
elseif msg == "del" then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_127", param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_127", param2 = fdir + (last_color*8)})
|
||||
elseif msg == "allon" then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_128", param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_144", param2 = fdir + (last_color*8)})
|
||||
elseif msg == "cursor" then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_129", param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_31", param2 = fdir + (last_color*8)})
|
||||
else
|
||||
display_string(pos, channel, msg)
|
||||
end
|
||||
else
|
||||
local asc = string.byte(msg)
|
||||
if asc > 31 and asc < 130 then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_"..asc, param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
elseif asc < 31 then
|
||||
lastcolor = asc
|
||||
meta:set_int("lastcolor", asc)
|
||||
if asc > 30 and asc < 256 then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_"..asc, param2 = fdir + (last_color*8)})
|
||||
elseif asc < 28 then
|
||||
last_color = asc
|
||||
meta:set_int("last_color", asc)
|
||||
elseif msg == "get" then -- get value as ASCII numerical value
|
||||
digiline:receptor_send(pos, digiline.rules.default, channel, tonumber(string.match(minetest.get_node(pos).name,"led_marquee:char_(.+)"))) -- wonderfully horrible string manipulaiton
|
||||
elseif msg == "getstr" then -- get actual char
|
||||
@ -125,14 +126,14 @@ local on_digiline_receive_string = function(pos, node, channel, msg)
|
||||
end
|
||||
elseif msg and type(msg) == "number" then
|
||||
if msg == 0 then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_32", param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
elseif msg > 31 and alnum_chars[msg - 31] ~= nil then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_"..tostring(msg), param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_32", param2 = fdir + (last_color*8)})
|
||||
elseif msg > 30 then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_"..tostring(msg), param2 = fdir + (last_color*8)})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for i = 32, 129 do
|
||||
for i = 31, 255 do
|
||||
local groups = { cracky = 2, not_in_creative_inventory = 1}
|
||||
local light = LIGHT_MAX-2
|
||||
local description = S("Alphanumeric LED marquee panel ("..i..")")
|
||||
@ -142,29 +143,29 @@ for i = 32, 129 do
|
||||
"led_marquee_char_"..i..".png",
|
||||
}
|
||||
|
||||
if i == 32 then
|
||||
groups = {cracky = 2}
|
||||
light = nil
|
||||
description = S("Alphanumeric LED marquee panel")
|
||||
end
|
||||
|
||||
if i == 129 then
|
||||
if i == 31 then
|
||||
tiles = {
|
||||
{ name="led_marquee_base.png", color="white"},
|
||||
{ name="led_marquee_leds_off.png", color="white"},
|
||||
{
|
||||
name = "led_marquee_char_129.png",
|
||||
name = "led_marquee_char_31.png",
|
||||
animation = {type = "vertical_frames", aspect_w = 32, aspect_h = 32, length = 0.75}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
if i == 32 then
|
||||
groups = {cracky = 2}
|
||||
light = nil
|
||||
description = S("Alphanumeric LED marquee panel")
|
||||
end
|
||||
|
||||
minetest.register_node("led_marquee:char_"..i, {
|
||||
description = description,
|
||||
drawtype = "mesh",
|
||||
mesh = "led_marquee.obj",
|
||||
tiles = tiles,
|
||||
palette="palette.png",
|
||||
palette="led_marquee_palette.png",
|
||||
use_texture_alpha = true,
|
||||
groups = groups,
|
||||
paramtype = "light",
|
||||
|
Before Width: | Height: | Size: 353 B After Width: | Height: | Size: 348 B |
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 338 B |
BIN
textures/led_marquee_char_130.png
Normal file
After Width: | Height: | Size: 210 B |
BIN
textures/led_marquee_char_131.png
Normal file
After Width: | Height: | Size: 279 B |
BIN
textures/led_marquee_char_132.png
Normal file
After Width: | Height: | Size: 262 B |
BIN
textures/led_marquee_char_133.png
Normal file
After Width: | Height: | Size: 274 B |
BIN
textures/led_marquee_char_134.png
Normal file
After Width: | Height: | Size: 276 B |
BIN
textures/led_marquee_char_135.png
Normal file
After Width: | Height: | Size: 268 B |
BIN
textures/led_marquee_char_136.png
Normal file
After Width: | Height: | Size: 302 B |
BIN
textures/led_marquee_char_137.png
Normal file
After Width: | Height: | Size: 268 B |
BIN
textures/led_marquee_char_138.png
Normal file
After Width: | Height: | Size: 272 B |
BIN
textures/led_marquee_char_139.png
Normal file
After Width: | Height: | Size: 272 B |
BIN
textures/led_marquee_char_140.png
Normal file
After Width: | Height: | Size: 306 B |
BIN
textures/led_marquee_char_141.png
Normal file
After Width: | Height: | Size: 305 B |
BIN
textures/led_marquee_char_142.png
Normal file
After Width: | Height: | Size: 302 B |
BIN
textures/led_marquee_char_143.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
textures/led_marquee_char_144.png
Normal file
After Width: | Height: | Size: 270 B |
BIN
textures/led_marquee_char_145.png
Normal file
After Width: | Height: | Size: 336 B |
BIN
textures/led_marquee_char_146.png
Normal file
After Width: | Height: | Size: 318 B |
BIN
textures/led_marquee_char_147.png
Normal file
After Width: | Height: | Size: 314 B |
BIN
textures/led_marquee_char_148.png
Normal file
After Width: | Height: | Size: 309 B |
BIN
textures/led_marquee_char_149.png
Normal file
After Width: | Height: | Size: 323 B |
BIN
textures/led_marquee_char_150.png
Normal file
After Width: | Height: | Size: 316 B |
BIN
textures/led_marquee_char_151.png
Normal file
After Width: | Height: | Size: 359 B |
BIN
textures/led_marquee_char_152.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
textures/led_marquee_char_153.png
Normal file
After Width: | Height: | Size: 244 B |
BIN
textures/led_marquee_char_154.png
Normal file
After Width: | Height: | Size: 325 B |
BIN
textures/led_marquee_char_155.png
Normal file
After Width: | Height: | Size: 362 B |
BIN
textures/led_marquee_char_156.png
Normal file
After Width: | Height: | Size: 379 B |
BIN
textures/led_marquee_char_157.png
Normal file
After Width: | Height: | Size: 494 B |
BIN
textures/led_marquee_char_158.png
Normal file
After Width: | Height: | Size: 518 B |
BIN
textures/led_marquee_char_159.png
Normal file
After Width: | Height: | Size: 500 B |
BIN
textures/led_marquee_char_160.png
Normal file
After Width: | Height: | Size: 96 B |
BIN
textures/led_marquee_char_161.png
Normal file
After Width: | Height: | Size: 336 B |
BIN
textures/led_marquee_char_162.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
textures/led_marquee_char_163.png
Normal file
After Width: | Height: | Size: 399 B |
BIN
textures/led_marquee_char_164.png
Normal file
After Width: | Height: | Size: 369 B |
BIN
textures/led_marquee_char_165.png
Normal file
After Width: | Height: | Size: 332 B |
BIN
textures/led_marquee_char_166.png
Normal file
After Width: | Height: | Size: 266 B |
BIN
textures/led_marquee_char_167.png
Normal file
After Width: | Height: | Size: 396 B |
BIN
textures/led_marquee_char_168.png
Normal file
After Width: | Height: | Size: 203 B |
BIN
textures/led_marquee_char_169.png
Normal file
After Width: | Height: | Size: 438 B |
BIN
textures/led_marquee_char_170.png
Normal file
After Width: | Height: | Size: 363 B |
BIN
textures/led_marquee_char_171.png
Normal file
After Width: | Height: | Size: 293 B |
BIN
textures/led_marquee_char_172.png
Normal file
After Width: | Height: | Size: 230 B |
BIN
textures/led_marquee_char_173.png
Normal file
After Width: | Height: | Size: 203 B |
BIN
textures/led_marquee_char_174.png
Normal file
After Width: | Height: | Size: 461 B |
BIN
textures/led_marquee_char_175.png
Normal file
After Width: | Height: | Size: 203 B |
BIN
textures/led_marquee_char_176.png
Normal file
After Width: | Height: | Size: 280 B |
BIN
textures/led_marquee_char_177.png
Normal file
After Width: | Height: | Size: 297 B |
BIN
textures/led_marquee_char_178.png
Normal file
After Width: | Height: | Size: 319 B |
BIN
textures/led_marquee_char_179.png
Normal file
After Width: | Height: | Size: 291 B |
BIN
textures/led_marquee_char_180.png
Normal file
After Width: | Height: | Size: 250 B |
BIN
textures/led_marquee_char_181.png
Normal file
After Width: | Height: | Size: 307 B |
BIN
textures/led_marquee_char_182.png
Normal file
After Width: | Height: | Size: 343 B |
BIN
textures/led_marquee_char_183.png
Normal file
After Width: | Height: | Size: 216 B |
BIN
textures/led_marquee_char_184.png
Normal file
After Width: | Height: | Size: 227 B |
BIN
textures/led_marquee_char_185.png
Normal file
After Width: | Height: | Size: 304 B |
BIN
textures/led_marquee_char_186.png
Normal file
After Width: | Height: | Size: 345 B |
BIN
textures/led_marquee_char_187.png
Normal file
After Width: | Height: | Size: 317 B |
BIN
textures/led_marquee_char_188.png
Normal file
After Width: | Height: | Size: 465 B |
BIN
textures/led_marquee_char_189.png
Normal file
After Width: | Height: | Size: 435 B |
BIN
textures/led_marquee_char_190.png
Normal file
After Width: | Height: | Size: 478 B |
BIN
textures/led_marquee_char_191.png
Normal file
After Width: | Height: | Size: 348 B |
BIN
textures/led_marquee_char_192.png
Normal file
After Width: | Height: | Size: 408 B |
BIN
textures/led_marquee_char_193.png
Normal file
After Width: | Height: | Size: 402 B |
BIN
textures/led_marquee_char_194.png
Normal file
After Width: | Height: | Size: 426 B |
BIN
textures/led_marquee_char_195.png
Normal file
After Width: | Height: | Size: 413 B |
BIN
textures/led_marquee_char_196.png
Normal file
After Width: | Height: | Size: 394 B |
BIN
textures/led_marquee_char_197.png
Normal file
After Width: | Height: | Size: 418 B |
BIN
textures/led_marquee_char_198.png
Normal file
After Width: | Height: | Size: 404 B |
BIN
textures/led_marquee_char_199.png
Normal file
After Width: | Height: | Size: 364 B |
BIN
textures/led_marquee_char_200.png
Normal file
After Width: | Height: | Size: 343 B |
BIN
textures/led_marquee_char_201.png
Normal file
After Width: | Height: | Size: 339 B |
BIN
textures/led_marquee_char_202.png
Normal file
After Width: | Height: | Size: 359 B |
BIN
textures/led_marquee_char_203.png
Normal file
After Width: | Height: | Size: 328 B |
BIN
textures/led_marquee_char_204.png
Normal file
After Width: | Height: | Size: 326 B |
BIN
textures/led_marquee_char_205.png
Normal file
After Width: | Height: | Size: 321 B |
BIN
textures/led_marquee_char_206.png
Normal file
After Width: | Height: | Size: 354 B |
BIN
textures/led_marquee_char_207.png
Normal file
After Width: | Height: | Size: 310 B |
BIN
textures/led_marquee_char_208.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
textures/led_marquee_char_209.png
Normal file
After Width: | Height: | Size: 362 B |
BIN
textures/led_marquee_char_210.png
Normal file
After Width: | Height: | Size: 347 B |
BIN
textures/led_marquee_char_211.png
Normal file
After Width: | Height: | Size: 348 B |
BIN
textures/led_marquee_char_212.png
Normal file
After Width: | Height: | Size: 365 B |
BIN
textures/led_marquee_char_213.png
Normal file
After Width: | Height: | Size: 349 B |
BIN
textures/led_marquee_char_214.png
Normal file
After Width: | Height: | Size: 325 B |
BIN
textures/led_marquee_char_215.png
Normal file
After Width: | Height: | Size: 322 B |
BIN
textures/led_marquee_char_216.png
Normal file
After Width: | Height: | Size: 364 B |
BIN
textures/led_marquee_char_217.png
Normal file
After Width: | Height: | Size: 341 B |
BIN
textures/led_marquee_char_218.png
Normal file
After Width: | Height: | Size: 339 B |
BIN
textures/led_marquee_char_219.png
Normal file
After Width: | Height: | Size: 359 B |
BIN
textures/led_marquee_char_220.png
Normal file
After Width: | Height: | Size: 340 B |
BIN
textures/led_marquee_char_221.png
Normal file
After Width: | Height: | Size: 376 B |
BIN
textures/led_marquee_char_222.png
Normal file
After Width: | Height: | Size: 324 B |
BIN
textures/led_marquee_char_223.png
Normal file
After Width: | Height: | Size: 355 B |
BIN
textures/led_marquee_char_224.png
Normal file
After Width: | Height: | Size: 381 B |
BIN
textures/led_marquee_char_225.png
Normal file
After Width: | Height: | Size: 372 B |