mirror of
https://github.com/mt-mods/led_marquee.git
synced 2024-11-24 00:03:47 +01:00
31-color support
This commit is contained in:
parent
54b5ac53ad
commit
bb9f8575bc
10
README.md
10
README.md
@ -31,7 +31,15 @@ The panels also respond to these control messages:
|
||||
* "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 7 will change colors (i.e. string.char(0 to 7) ). You can select from red (0), orange, yellow, green, cyan, blue, purple, or magenta (7). The left-most/"master" panel will remember the last color used, and defaults to red.
|
||||
A byte value of 0 to 30 will change colors (i.e. string.char(0 to 30) ). 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.
|
||||
|
||||
The left-most/"master" panel will remember the last color used, and defaults to red.
|
||||
|
||||
You can use "get" and "getstr" to read the one character from the connected panel. These messages will not read the other panels in the lineup.
|
||||
|
||||
|
32
init.lua
32
init.lua
@ -12,7 +12,7 @@ end
|
||||
|
||||
local marquee_cbox = {
|
||||
type = "fixed",
|
||||
fixed = { -16/32, -8/16, 15/32, 16/32, 8/16, 16/32 }
|
||||
fixed = { -16/32, -8/16, -16/32, 16/32, 8/16, -15/32 }
|
||||
}
|
||||
|
||||
-- the following functions based on the so-named ones in Jeija's digilines mod
|
||||
@ -54,7 +54,7 @@ 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 % 4
|
||||
local fdir = minetest.get_node(pos).param2 % 8
|
||||
local pos2 = pos
|
||||
local mastermeta = minetest.get_meta(pos)
|
||||
local lastcolor = mastermeta:get_int("lastcolor")
|
||||
@ -69,11 +69,11 @@ local display_string = function(pos, channel, string)
|
||||
|
||||
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 % 4) == fdir and asc > 31 and asc < 130 then
|
||||
minetest.swap_node(pos2, { name = "led_marquee:char_"..asc, param2 = (node.param2 % 4) + (lastcolor*32)})
|
||||
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)})
|
||||
pos2.x = pos2.x + fdir_to_right[fdir+1][1]
|
||||
pos2.z = pos2.z + fdir_to_right[fdir+1][2]
|
||||
elseif asc < 8 then
|
||||
elseif asc < 31 then
|
||||
lastcolor = asc
|
||||
mastermeta:set_int("lastcolor", asc)
|
||||
end
|
||||
@ -93,25 +93,25 @@ local on_digiline_receive_string = function(pos, node, channel, msg)
|
||||
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 % 4) + (lastcolor*32)})
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_32", param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
elseif msg == "colon" then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_58", param2 = (node.param2 % 4) + (lastcolor*32)})
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_58", param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
elseif msg == "period" then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_46", param2 = (node.param2 % 4) + (lastcolor*32)})
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_46", param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
elseif msg == "del" then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_127", param2 = (node.param2 % 4) + (lastcolor*32)})
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_127", param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
elseif msg == "allon" then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_128", param2 = (node.param2 % 4) + (lastcolor*32)})
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_128", param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
elseif msg == "cursor" then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_129", param2 = (node.param2 % 4) + (lastcolor*32)})
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_129", param2 = (node.param2 % 8) + (lastcolor*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 % 4) + (lastcolor*32)})
|
||||
elseif asc < 8 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)
|
||||
elseif msg == "get" then -- get value as ASCII numerical value
|
||||
@ -122,9 +122,9 @@ 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 % 4) + (lastcolor*32)})
|
||||
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 % 4) + (lastcolor*32)})
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_"..tostring(msg), param2 = (node.param2 % 8) + (lastcolor*8)})
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -165,7 +165,7 @@ for i = 32, 129 do
|
||||
use_texture_alpha = true,
|
||||
groups = groups,
|
||||
paramtype = "light",
|
||||
paramtype2 = "colorfacedir",
|
||||
paramtype2 = "colorwallmounted",
|
||||
light_source = light,
|
||||
selection_box = marquee_cbox,
|
||||
collision_box = marquee_cbox,
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,30 +1,30 @@
|
||||
# Blender v2.79 (sub 0) OBJ File: 'LED marquee.blend'
|
||||
# www.blender.org
|
||||
o Cube_Cube_LEDs
|
||||
v 0.500000 -0.468750 0.453125
|
||||
v -0.500000 -0.468750 0.453125
|
||||
v -0.500000 0.468750 0.453125
|
||||
v 0.500000 0.468750 0.453125
|
||||
v 0.500000 -0.500000 0.437500
|
||||
v 0.500000 -0.484375 0.437500
|
||||
v 0.500000 -0.468750 0.453125
|
||||
v 0.500000 0.468750 0.453125
|
||||
v 0.500000 0.484375 0.437500
|
||||
v 0.500000 0.500000 0.437500
|
||||
v 0.500000 0.500000 0.500000
|
||||
v 0.500000 -0.500000 0.500000
|
||||
v -0.500000 0.500000 0.500000
|
||||
v -0.453125 -0.500000 -0.468750
|
||||
v -0.453125 0.500000 -0.468750
|
||||
v -0.453125 0.500000 0.468750
|
||||
v -0.453125 -0.500000 0.468750
|
||||
v -0.437500 -0.500000 -0.500000
|
||||
v -0.437500 -0.500000 -0.484375
|
||||
v -0.453125 -0.500000 -0.468750
|
||||
v -0.453125 -0.500000 0.468750
|
||||
v -0.437500 -0.500000 0.484375
|
||||
v -0.437500 -0.500000 0.500000
|
||||
v -0.500000 -0.500000 0.500000
|
||||
v -0.500000 0.500000 0.437500
|
||||
v -0.500000 0.484375 0.437500
|
||||
v -0.500000 0.468750 0.453125
|
||||
v -0.500000 -0.468750 0.453125
|
||||
v -0.500000 -0.484375 0.437500
|
||||
v -0.500000 -0.500000 0.437500
|
||||
v 0.500000 -0.468750 0.449125
|
||||
v -0.500000 -0.468750 0.449125
|
||||
v -0.500000 0.468750 0.449125
|
||||
v 0.500000 0.468750 0.449125
|
||||
v -0.500000 -0.500000 -0.500000
|
||||
v -0.500000 0.500000 0.500000
|
||||
v -0.500000 0.500000 -0.500000
|
||||
v -0.437500 0.500000 0.500000
|
||||
v -0.437500 0.500000 0.484375
|
||||
v -0.453125 0.500000 0.468750
|
||||
v -0.453125 0.500000 -0.468750
|
||||
v -0.437500 0.500000 -0.484375
|
||||
v -0.437500 0.500000 -0.500000
|
||||
v -0.449125 -0.500000 -0.468750
|
||||
v -0.449125 0.500000 -0.468750
|
||||
v -0.449125 0.500000 0.468750
|
||||
v -0.449125 -0.500000 0.468750
|
||||
vt 0.667843 0.000000
|
||||
vt 0.667843 0.015513
|
||||
vt 0.681855 0.031026
|
||||
@ -73,14 +73,14 @@ vt 0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vn 1.0000 0.0000 -0.0000
|
||||
vn 0.0000 -0.0000 1.0000
|
||||
vn -1.0000 -0.0000 0.0000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn -0.0000 0.0000 -1.0000
|
||||
vn -0.0000 -0.7071 -0.7071
|
||||
vn -0.0000 0.7071 -0.7071
|
||||
vn -1.0000 -0.0000 -0.0000
|
||||
vn -0.0000 1.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.7071 0.0000 -0.7071
|
||||
vn 0.7071 0.0000 0.7071
|
||||
g Cube_Cube_LEDs_Cube_Cube_LEDs_base
|
||||
s off
|
||||
f 5/1/1 6/2/1 7/3/1 8/4/1 9/5/1 10/6/1 11/7/1 12/8/1
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 87 B After Width: | Height: | Size: 131 B |
Loading…
Reference in New Issue
Block a user