mirror of
https://github.com/mt-mods/nixie_tubes.git
synced 2024-12-04 21:23:47 +01:00
move "cursor" to char(31), move "all on" to char(144)
(to match what's used in led_marquee)
This commit is contained in:
parent
dcfac384fc
commit
975741cfe8
14
init.lua
14
init.lua
@ -250,6 +250,7 @@ Map of display wires:
|
|||||||
]]--
|
]]--
|
||||||
|
|
||||||
local alnum_chars = {
|
local alnum_chars = {
|
||||||
|
{ string.char(31), { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } }, -- "cursor" segment
|
||||||
{ " ", { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } }, -- 32
|
{ " ", { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } }, -- 32
|
||||||
{ "!", { 0,0,0,0,1,1,0,0,0,0,0,0,0,0,0 } },
|
{ "!", { 0,0,0,0,1,1,0,0,0,0,0,0,0,0,0 } },
|
||||||
{ '"', { 0,0,0,0,0,1,0,1,0,0,0,0,0,0,0 } },
|
{ '"', { 0,0,0,0,0,1,0,1,0,0,0,0,0,0,0 } },
|
||||||
@ -346,8 +347,7 @@ local alnum_chars = {
|
|||||||
{ "}", { 1,0,0,1,0,0,0,0,1,1,1,0,0,0,0 } },
|
{ "}", { 1,0,0,1,0,0,0,0,1,1,1,0,0,0,0 } },
|
||||||
{ "~", { 0,1,0,0,0,1,1,0,0,1,0,0,0,0,0 } },
|
{ "~", { 0,1,0,0,0,1,1,0,0,1,0,0,0,0,0 } },
|
||||||
{ string.char(127), { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 } }, -- "DEL"
|
{ string.char(127), { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 } }, -- "DEL"
|
||||||
{ string.char(128), { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 } }, -- all-on
|
{ string.char(144), { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 } }, -- all-on
|
||||||
{ string.char(129), { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } }, -- "cursor" segment
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local fdir_to_right = {
|
local fdir_to_right = {
|
||||||
@ -379,7 +379,7 @@ local display_string = function(pos, channel, string)
|
|||||||
local setchan = meta:get_string("channel")
|
local setchan = meta:get_string("channel")
|
||||||
if not string.match(node.name, "nixie_tubes:alnum_") or (setchan ~= nil and setchan ~= "" and setchan ~= channel) then break end
|
if not string.match(node.name, "nixie_tubes:alnum_") or (setchan ~= nil and setchan ~= "" and setchan ~= channel) then break end
|
||||||
local asc = string.byte(padded_string, i, i)
|
local asc = string.byte(padded_string, i, i)
|
||||||
if node.param2 == fdir and asc > 31 and alnum_chars[asc - 31] then
|
if node.param2 == fdir and ((asc > 30 and asc < 128) or asc == 144) then
|
||||||
minetest.swap_node(pos2, { name = "nixie_tubes:alnum_"..asc, param2 = node.param2})
|
minetest.swap_node(pos2, { name = "nixie_tubes:alnum_"..asc, param2 = node.param2})
|
||||||
end
|
end
|
||||||
pos2.x = pos2.x + fdir_to_right[fdir+1][1]
|
pos2.x = pos2.x + fdir_to_right[fdir+1][1]
|
||||||
@ -402,15 +402,15 @@ local on_digiline_receive_alnum = function(pos, node, channel, msg)
|
|||||||
elseif msg == "del" then
|
elseif msg == "del" then
|
||||||
minetest.swap_node(pos, { name = "nixie_tubes:alnum_127", param2 = node.param2})
|
minetest.swap_node(pos, { name = "nixie_tubes:alnum_127", param2 = node.param2})
|
||||||
elseif msg == "allon" then
|
elseif msg == "allon" then
|
||||||
minetest.swap_node(pos, { name = "nixie_tubes:alnum_128", param2 = node.param2})
|
minetest.swap_node(pos, { name = "nixie_tubes:alnum_144", param2 = node.param2})
|
||||||
elseif msg == "cursor" then
|
elseif msg == "cursor" then
|
||||||
minetest.swap_node(pos, { name = "nixie_tubes:alnum_129", param2 = node.param2})
|
minetest.swap_node(pos, { name = "nixie_tubes:alnum_31", param2 = node.param2})
|
||||||
else
|
else
|
||||||
display_string(pos, channel, msg)
|
display_string(pos, channel, msg)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local asc = string.byte(msg)
|
local asc = string.byte(msg)
|
||||||
if asc > 31 and alnum_chars[asc - 31] then
|
if (asc > 30 and asc < 128) or asc == 144 then
|
||||||
minetest.swap_node(pos, { name = "nixie_tubes:alnum_"..asc, param2 = node.param2})
|
minetest.swap_node(pos, { name = "nixie_tubes:alnum_"..asc, param2 = node.param2})
|
||||||
elseif msg == "get" then -- get value as ASCII numerical value
|
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,"nixie_tubes:alnum_(.+)"))) -- wonderfully horrible string manipulaiton
|
digiline:receptor_send(pos, digiline.rules.default, channel, tonumber(string.match(minetest.get_node(pos).name,"nixie_tubes:alnum_(.+)"))) -- wonderfully horrible string manipulaiton
|
||||||
@ -421,7 +421,7 @@ local on_digiline_receive_alnum = function(pos, node, channel, msg)
|
|||||||
elseif msg and type(msg) == "number" then
|
elseif msg and type(msg) == "number" then
|
||||||
if msg == 0 then
|
if msg == 0 then
|
||||||
minetest.swap_node(pos, { name = "nixie_tubes:alnum_32", param2 = node.param2})
|
minetest.swap_node(pos, { name = "nixie_tubes:alnum_32", param2 = node.param2})
|
||||||
elseif msg > 31 and alnum_chars[msg - 31] ~= nil then
|
elseif (msg > 30 and msg < 128) or msg == 144 then
|
||||||
minetest.swap_node(pos, { name = "nixie_tubes:alnum_"..tostring(msg), param2 = node.param2})
|
minetest.swap_node(pos, { name = "nixie_tubes:alnum_"..tostring(msg), param2 = node.param2})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user