diff --git a/README.md b/README.md index 14a54a2..98bbfbd 100644 --- a/README.md +++ b/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. diff --git a/init.lua b/init.lua index 6c315cd..b12a176 100644 --- a/init.lua +++ b/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, diff --git a/models/LED marquee.blend b/models/LED marquee.blend index f84a96e..bd5df4d 100644 Binary files a/models/LED marquee.blend and b/models/LED marquee.blend differ diff --git a/models/LED marquee.blend1 b/models/LED marquee.blend1 index 0380274..1d525d7 100644 Binary files a/models/LED marquee.blend1 and b/models/LED marquee.blend1 differ diff --git a/models/led_marquee.obj b/models/led_marquee.obj index c4d6f63..ff2bcd9 100644 --- a/models/led_marquee.obj +++ b/models/led_marquee.obj @@ -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 diff --git a/textures/palette.png b/textures/palette.png index 248c128..3856c7b 100644 Binary files a/textures/palette.png and b/textures/palette.png differ