summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2019-05-16 23:59:24 -0500
committercheapie <no-email-for-you@example.com>2019-05-16 23:59:24 -0500
commit0f4f603e2e8c9aa3f8e736ff6c6cf78bb6f3f493 (patch)
treec71820f4b4cda09e8a90f650b50cce23d9a9bddb
downloadelevatorparts-0f4f603e2e8c9aa3f8e736ff6c6cf78bb6f3f493.tar
elevatorparts-0f4f603e2e8c9aa3f8e736ff6c6cf78bb6f3f493.tar.gz
elevatorparts-0f4f603e2e8c9aa3f8e736ff6c6cf78bb6f3f493.tar.bz2
elevatorparts-0f4f603e2e8c9aa3f8e736ff6c6cf78bb6f3f493.tar.xz
elevatorparts-0f4f603e2e8c9aa3f8e736ff6c6cf78bb6f3f493.zip
Add initial content
-rw-r--r--COPYING24
-rw-r--r--depends.txt1
-rw-r--r--init.lua1263
-rw-r--r--textures/elevatorparts_callbutton_bg.pngbin0 -> 5937 bytes
-rw-r--r--textures/elevatorparts_callbutton_down.pngbin0 -> 7578 bytes
-rw-r--r--textures/elevatorparts_callbutton_down_centered.pngbin0 -> 315 bytes
-rw-r--r--textures/elevatorparts_callbutton_light.pngbin0 -> 222 bytes
-rw-r--r--textures/elevatorparts_callbutton_up.pngbin0 -> 7578 bytes
-rw-r--r--textures/elevatorparts_generic_bg.pngbin0 -> 3100 bytes
-rw-r--r--textures/elevatorparts_lantern_down_off.pngbin0 -> 230 bytes
-rw-r--r--textures/elevatorparts_lantern_down_on.pngbin0 -> 230 bytes
-rw-r--r--textures/elevatorparts_lantern_up_off.pngbin0 -> 225 bytes
-rw-r--r--textures/elevatorparts_lantern_up_on.pngbin0 -> 225 bytes
-rw-r--r--textures/elevatorparts_pi_0.pngbin0 -> 242 bytes
-rw-r--r--textures/elevatorparts_pi_1.pngbin0 -> 198 bytes
-rw-r--r--textures/elevatorparts_pi_2.pngbin0 -> 238 bytes
-rw-r--r--textures/elevatorparts_pi_3.pngbin0 -> 213 bytes
-rw-r--r--textures/elevatorparts_pi_4.pngbin0 -> 237 bytes
-rw-r--r--textures/elevatorparts_pi_5.pngbin0 -> 240 bytes
-rw-r--r--textures/elevatorparts_pi_6.pngbin0 -> 237 bytes
-rw-r--r--textures/elevatorparts_pi_7.pngbin0 -> 220 bytes
-rw-r--r--textures/elevatorparts_pi_8.pngbin0 -> 222 bytes
-rw-r--r--textures/elevatorparts_pi_9.pngbin0 -> 234 bytes
-rw-r--r--textures/elevatorparts_pi_a.pngbin0 -> 235 bytes
-rw-r--r--textures/elevatorparts_pi_arrow_down.pngbin0 -> 236 bytes
-rw-r--r--textures/elevatorparts_pi_arrow_up.pngbin0 -> 240 bytes
-rw-r--r--textures/elevatorparts_pi_b.pngbin0 -> 241 bytes
-rw-r--r--textures/elevatorparts_pi_c.pngbin0 -> 241 bytes
-rw-r--r--textures/elevatorparts_pi_d.pngbin0 -> 236 bytes
-rw-r--r--textures/elevatorparts_pi_dash.pngbin0 -> 205 bytes
-rw-r--r--textures/elevatorparts_pi_e.pngbin0 -> 222 bytes
-rw-r--r--textures/elevatorparts_pi_f.pngbin0 -> 228 bytes
-rw-r--r--textures/elevatorparts_pi_h.pngbin0 -> 245 bytes
-rw-r--r--textures/elevatorparts_pi_j.pngbin0 -> 224 bytes
-rw-r--r--textures/elevatorparts_pi_l.pngbin0 -> 220 bytes
-rw-r--r--textures/elevatorparts_pi_n.pngbin0 -> 236 bytes
-rw-r--r--textures/elevatorparts_pi_p.pngbin0 -> 240 bytes
-rw-r--r--textures/elevatorparts_pi_r.pngbin0 -> 224 bytes
-rw-r--r--textures/elevatorparts_pi_t.pngbin0 -> 235 bytes
-rw-r--r--textures/elevatorparts_pi_u.pngbin0 -> 227 bytes
-rw-r--r--textures/elevatorparts_pi_y.pngbin0 -> 235 bytes
-rw-r--r--textures/elevatorparts_pilantern_bg.pngbin0 -> 2446 bytes
-rw-r--r--textures/elevatorparts_transparent.pngbin0 -> 165 bytes
43 files changed, 1288 insertions, 0 deletions
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..68a49da
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,24 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>
diff --git a/depends.txt b/depends.txt
new file mode 100644
index 0000000..da1d119
--- /dev/null
+++ b/depends.txt
@@ -0,0 +1 @@
+digilines
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..6cd1d57
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,1263 @@
+minetest.register_node("elevatorparts:callbutton_up",{
+ description = "Up Call Button (unprogrammed)",
+ groups = {
+ dig_immediate = 2,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,35=elevatorparts_callbutton_up.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ {-0.16, -0.37, 0.45, 0.17, 0.13, 0.48},
+ },
+ },
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec","field[channel;Channel;${channel}")
+ end,
+ on_receive_fields = function(pos,_,fields,sender)
+ local name = sender:get_player_name()
+ if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
+ minetest.record_protection_violation(pos,name)
+ return
+ end
+ local meta = minetest.get_meta(pos)
+ if fields.channel then
+ meta:set_string("channel",fields.channel)
+ meta:set_string("formspec","")
+ local node = minetest.get_node(pos)
+ node.name = "elevatorparts:callbutton_up_off"
+ minetest.swap_node(pos,node)
+ end
+ end,
+})
+
+minetest.register_node("elevatorparts:callbutton_up_off",{
+ description = "Up Call Button (programmed, off state - you hacker you!)",
+ groups = {
+ dig_immediate = 2,
+ not_in_creative_inventory = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,35=elevatorparts_callbutton_up.png",
+ },
+ drop = "elevatorparts:callbutton_up",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ {-0.16, -0.37, 0.45, 0.17, 0.13, 0.48},
+ },
+ },
+ on_punch = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press")
+ end,
+ on_rightclick = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press")
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "up_light_on" then
+ node.name = "elevatorparts:callbutton_up_on"
+ minetest.swap_node(pos,node)
+ end
+ end
+ },
+ },
+})
+
+minetest.register_node("elevatorparts:callbutton_up_on",{
+ description = "Up Call Button (programmed, on state - you hacker you!)",
+ groups = {
+ dig_immediate = 2,
+ not_in_creative_inventory = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,35=elevatorparts_callbutton_up.png:33,36=elevatorparts_callbutton_light.png",
+ },
+ drop = "elevatorparts:callbutton_up",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ {-0.16, -0.37, 0.45, 0.17, 0.13, 0.48},
+ },
+ },
+ on_punch = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press")
+ end,
+ on_rightclick = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press")
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "up_light_off" then
+ node.name = "elevatorparts:callbutton_up_off"
+ minetest.swap_node(pos,node)
+ end
+ end
+ },
+ },
+})
+
+minetest.register_node("elevatorparts:callbutton_down",{
+ description = "Down Call Button (unprogrammed)",
+ groups = {
+ dig_immediate = 2,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,35=elevatorparts_callbutton_down.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ {-0.16, -0.37, 0.45, 0.17, 0.13, 0.48},
+ },
+ },
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec","field[channel;Channel;${channel}")
+ end,
+ on_receive_fields = function(pos,_,fields,sender)
+ local name = sender:get_player_name()
+ if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
+ minetest.record_protection_violation(pos,name)
+ return
+ end
+ local meta = minetest.get_meta(pos)
+ if fields.channel then
+ meta:set_string("channel",fields.channel)
+ meta:set_string("formspec","")
+ local node = minetest.get_node(pos)
+ node.name = "elevatorparts:callbutton_down_off"
+ minetest.swap_node(pos,node)
+ end
+ end,
+})
+
+minetest.register_node("elevatorparts:callbutton_down_off",{
+ description = "Down Call Button (programmed, off state - you hacker you!)",
+ groups = {
+ dig_immediate = 2,
+ not_in_creative_inventory = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,35=elevatorparts_callbutton_down.png",
+ },
+ drop = "elevatorparts:callbutton_down",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ {-0.16, -0.37, 0.45, 0.17, 0.13, 0.48},
+ },
+ },
+ on_punch = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press")
+ end,
+ on_rightclick = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press")
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "down_light_on" then
+ node.name = "elevatorparts:callbutton_down_on"
+ minetest.swap_node(pos,node)
+ end
+ end
+ },
+ },
+})
+
+minetest.register_node("elevatorparts:callbutton_down_on",{
+ description = "Down Call Button (programmed, on state - you hacker you!)",
+ groups = {
+ dig_immediate = 2,
+ not_in_creative_inventory = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,35=elevatorparts_callbutton_down.png:33,36=elevatorparts_callbutton_light.png",
+ },
+ drop = "elevatorparts:callbutton_down",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ {-0.16, -0.37, 0.45, 0.17, 0.13, 0.48},
+ },
+ },
+ on_punch = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press")
+ end,
+ on_rightclick = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press")
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "down_light_off" then
+ node.name = "elevatorparts:callbutton_down_off"
+ minetest.swap_node(pos,node)
+ end
+ end
+ },
+ },
+})
+
+minetest.register_node("elevatorparts:callbutton_both",{
+ description = "Up and Down Call Buttons (unprogrammed)",
+ groups = {
+ dig_immediate = 2,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,28=elevatorparts_callbutton_up.png:24,43=elevatorparts_callbutton_down.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ {-0.16, -0.37, 0.45, 0.17, 0.13, 0.48},
+ },
+ },
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec","field[channel;Channel;${channel}")
+ end,
+ on_receive_fields = function(pos,_,fields,sender)
+ local name = sender:get_player_name()
+ if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
+ minetest.record_protection_violation(pos,name)
+ return
+ end
+ local meta = minetest.get_meta(pos)
+ if fields.channel then
+ meta:set_string("channel",fields.channel)
+ meta:set_string("formspec","")
+ meta:set_string("infotext","Left-click for up or right-click for down")
+ local node = minetest.get_node(pos)
+ node.name = "elevatorparts:callbutton_both_off"
+ minetest.swap_node(pos,node)
+ end
+ end,
+})
+
+minetest.register_node("elevatorparts:callbutton_both_off",{
+ description = "Up and Down Call Buttons (programmed, both off state - you hacker you!)",
+ groups = {
+ dig_immediate = 2,
+ not_in_creative_inventory = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,28=elevatorparts_callbutton_up.png:24,43=elevatorparts_callbutton_down.png",
+ },
+ drop = "elevatorparts:callbutton_both",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ {-0.16, -0.37, 0.45, 0.17, 0.13, 0.48},
+ },
+ },
+ on_punch = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press")
+ end,
+ on_rightclick = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press")
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "up_light_on" then
+ node.name = "elevatorparts:callbutton_both_upon"
+ minetest.swap_node(pos,node)
+ elseif msg == "down_light_on" then
+ node.name = "elevatorparts:callbutton_both_downon"
+ minetest.swap_node(pos,node)
+ end
+ end
+ },
+ },
+})
+
+minetest.register_node("elevatorparts:callbutton_both_upon",{
+ description = "Up and Down Call Buttons (programmed, up on, down off state - you hacker you!)",
+ groups = {
+ dig_immediate = 2,
+ not_in_creative_inventory = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,28=elevatorparts_callbutton_up.png:24,43=elevatorparts_callbutton_down.png:33,29=elevatorparts_callbutton_light.png",
+ },
+ drop = "elevatorparts:callbutton_both",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ {-0.16, -0.37, 0.45, 0.17, 0.13, 0.48},
+ },
+ },
+ on_punch = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press")
+ end,
+ on_rightclick = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press")
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "up_light_off" then
+ node.name = "elevatorparts:callbutton_both_off"
+ minetest.swap_node(pos,node)
+ elseif msg == "down_light_on" then
+ node.name = "elevatorparts:callbutton_both_on"
+ minetest.swap_node(pos,node)
+ end
+ end
+ },
+ },
+})
+
+minetest.register_node("elevatorparts:callbutton_both_downon",{
+ description = "Up and Down Call Buttons (programmed, up off, down on state - you hacker you!)",
+ groups = {
+ dig_immediate = 2,
+ not_in_creative_inventory = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,28=elevatorparts_callbutton_up.png:24,43=elevatorparts_callbutton_down.png:33,44=elevatorparts_callbutton_light.png",
+ },
+ drop = "elevatorparts:callbutton_both",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ {-0.16, -0.37, 0.45, 0.17, 0.13, 0.48},
+ },
+ },
+ on_punch = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press")
+ end,
+ on_rightclick = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press")
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "up_light_on" then
+ node.name = "elevatorparts:callbutton_both_on"
+ minetest.swap_node(pos,node)
+ elseif msg == "down_light_off" then
+ node.name = "elevatorparts:callbutton_both_off"
+ minetest.swap_node(pos,node)
+ end
+ end
+ },
+ },
+})
+
+minetest.register_node("elevatorparts:callbutton_both_on",{
+ description = "Up and Down Call Buttons (programmed, both on state - you hacker you!)",
+ groups = {
+ dig_immediate = 2,
+ not_in_creative_inventory = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,28=elevatorparts_callbutton_up.png:24,43=elevatorparts_callbutton_down.png:33,29=elevatorparts_callbutton_light.png:33,44=elevatorparts_callbutton_light.png",
+ },
+ drop = "elevatorparts:callbutton_both",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ {-0.16, -0.37, 0.45, 0.17, 0.13, 0.48},
+ },
+ },
+ on_punch = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press")
+ end,
+ on_rightclick = function(pos)
+ digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press")
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "up_light_off" then
+ node.name = "elevatorparts:callbutton_both_downon"
+ minetest.swap_node(pos,node)
+ elseif msg == "down_light_off" then
+ node.name = "elevatorparts:callbutton_both_upon"
+ minetest.swap_node(pos,node)
+ end
+ end
+ },
+ },
+})
+
+local chars = {
+ ["0"] = "elevatorparts_pi_0.png",
+ ["1"] = "elevatorparts_pi_1.png",
+ ["2"] = "elevatorparts_pi_2.png",
+ ["3"] = "elevatorparts_pi_3.png",
+ ["4"] = "elevatorparts_pi_4.png",
+ ["5"] = "elevatorparts_pi_5.png",
+ ["6"] = "elevatorparts_pi_6.png",
+ ["7"] = "elevatorparts_pi_7.png",
+ ["8"] = "elevatorparts_pi_8.png",
+ ["9"] = "elevatorparts_pi_9.png",
+ ["a"] = "elevatorparts_pi_a.png",
+ ["b"] = "elevatorparts_pi_b.png",
+ ["c"] = "elevatorparts_pi_c.png",
+ ["d"] = "elevatorparts_pi_d.png",
+ ["e"] = "elevatorparts_pi_e.png",
+ ["f"] = "elevatorparts_pi_f.png",
+ ["g"] = "elevatorparts_pi_9.png",
+ ["h"] = "elevatorparts_pi_h.png",
+ ["i"] = "elevatorparts_pi_1.png",
+ ["j"] = "elevatorparts_pi_j.png",
+ ["l"] = "elevatorparts_pi_l.png",
+ ["n"] = "elevatorparts_pi_n.png",
+ ["o"] = "elevatorparts_pi_0.png",
+ ["p"] = "elevatorparts_pi_p.png",
+ ["r"] = "elevatorparts_pi_r.png",
+ ["s"] = "elevatorparts_pi_5.png",
+ ["t"] = "elevatorparts_pi_t.png",
+ ["u"] = "elevatorparts_pi_u.png",
+ ["y"] = "elevatorparts_pi_y.png",
+ ["z"] = "elevatorparts_pi_2.png",
+ ["-"] = "elevatorparts_pi_dash.png",
+ [" "] = "elevatorparts_transparent.png",
+}
+
+minetest.register_entity("elevatorparts:pi_entity",{
+ initial_properties = {
+ visual = "upright_sprite",
+ physical = false,
+ collisionbox = {0,0,0,0,0,0,},
+ textures = {"elevatorparts_transparent.png",},
+ },
+})
+
+local function removeEntity(pos)
+ local entitiesNearby = minetest.get_objects_inside_radius(pos,0.5)
+ for _,i in pairs(entitiesNearby) do
+ if i:get_luaentity() and i:get_luaentity().name == "elevatorparts:pi_entity" then
+ i:remove()
+ end
+ end
+end
+
+local function generateTexture(text,uparrow,downarrow)
+ local out = string.format("[combine:64x64:0,0=elevatorparts_transparent.png")
+ local pos = 0
+ for i=1,string.len(text),1 do
+ local char = string.sub(text,i,i)
+ out = out..string.format(":%d,7=%s",pos*12+22,chars[char] or chars["-"])
+ pos = pos+1
+ end
+ if uparrow then out = out..":6,7=elevatorparts_pi_arrow_up.png"
+ elseif downarrow then out = out..":6,7=elevatorparts_pi_arrow_down.png" end
+ return out
+end
+
+local function updateDisplay(pos)
+ removeEntity(pos)
+ local meta = minetest.get_meta(pos)
+ local text = meta:get_string("text")
+ local entity = minetest.add_entity(pos,"elevatorparts:pi_entity")
+ local nname = minetest.get_node(pos).name
+ local fdir = minetest.facedir_to_dir(minetest.get_node(pos).param2)
+ local uparrow = meta:get_int("uparrow") > 0
+ local downarrow = meta:get_int("downarrow") > 0
+ local etex = generateTexture(text,uparrow,downarrow)
+ entity:set_properties({textures={etex}})
+ entity:set_yaw((fdir.x ~= 0) and math.pi/2 or 0)
+ entity:setpos(vector.add(pos,vector.multiply(fdir,0.45)))
+end
+
+local pi_ignore = {
+ up_light_on = true,
+ up_light_off = true,
+ down_light_on = true,
+ down_light_off = true,
+ up_press = true,
+ down_press = true,
+ arrow_up = true,
+ arrow_down = true,
+ arrow_off = true,
+}
+
+minetest.register_node("elevatorparts:pilantern_up_off",{
+ description = "PI + Up Lantern Combo",
+ groups = {
+ dig_immediate = 2,
+ elevatorparts_pi_lbm = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_pilantern_bg.png:25,37=elevatorparts_lantern_up_off.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ },
+ },
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec","field[channel;Channel;${channel}")
+ end,
+ on_receive_fields = function(pos,_,fields,sender)
+ local name = sender:get_player_name()
+ if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
+ minetest.record_protection_violation(pos,name)
+ return
+ end
+ local meta = minetest.get_meta(pos)
+ if fields.channel then
+ meta:set_string("channel",fields.channel)
+ end
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "up_light_on" then
+ node.name = "elevatorparts:pilantern_up_on"
+ minetest.swap_node(pos,node)
+ elseif msg == "arrow_up" then
+ meta:set_int("uparrow",1)
+ meta:set_int("downarrow",0)
+ elseif msg == "arrow_down" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",1)
+ elseif msg == "arrow_off" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",0)
+ elseif not pi_ignore[msg] then
+ meta:set_string("text",string.sub(" "..msg,-3,-1))
+ end
+ updateDisplay(pos)
+ end
+ },
+ },
+})
+
+minetest.register_node("elevatorparts:pilantern_up_on",{
+ description = "PI + Up Lantern Combo (on state - you hacker you!)",
+ groups = {
+ dig_immediate = 2,
+ not_in_creative_inventory = 1,
+ elevatorparts_pi_lbm = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_pilantern_bg.png:25,37=elevatorparts_lantern_up_on.png",
+ },
+ drop = "elevatorparts:pilantern_up_off",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ },
+ },
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec","field[channel;Channel;${channel}")
+ end,
+ on_receive_fields = function(pos,_,fields,sender)
+ local name = sender:get_player_name()
+ if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
+ minetest.record_protection_violation(pos,name)
+ return
+ end
+ local meta = minetest.get_meta(pos)
+ if fields.channel then
+ meta:set_string("channel",fields.channel)
+ end
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "up_light_off" then
+ node.name = "elevatorparts:pilantern_up_off"
+ minetest.swap_node(pos,node)
+ elseif msg == "arrow_up" then
+ meta:set_int("uparrow",1)
+ meta:set_int("downarrow",0)
+ elseif msg == "arrow_down" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",1)
+ elseif msg == "arrow_off" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",0)
+ elseif not pi_ignore[msg] then
+ meta:set_string("text",string.sub(" "..msg,-3,-1))
+ end
+ updateDisplay(pos)
+ end
+ },
+ },
+})
+
+minetest.register_node("elevatorparts:pilantern_down_off",{
+ description = "PI + Down Lantern Combo",
+ groups = {
+ dig_immediate = 2,
+ elevatorparts_pi_lbm = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_pilantern_bg.png:25,37=elevatorparts_lantern_down_off.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ },
+ },
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec","field[channel;Channel;${channel}")
+ end,
+ on_receive_fields = function(pos,_,fields,sender)
+ local name = sender:get_player_name()
+ if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
+ minetest.record_protection_violation(pos,name)
+ return
+ end
+ local meta = minetest.get_meta(pos)
+ if fields.channel then
+ meta:set_string("channel",fields.channel)
+ end
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "down_light_on" then
+ node.name = "elevatorparts:pilantern_down_on"
+ minetest.swap_node(pos,node)
+ elseif msg == "arrow_up" then
+ meta:set_int("uparrow",1)
+ meta:set_int("downarrow",0)
+ elseif msg == "arrow_down" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",1)
+ elseif msg == "arrow_off" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",0)
+ elseif not pi_ignore[msg] then
+ meta:set_string("text",string.sub(" "..msg,-3,-1))
+ end
+ updateDisplay(pos)
+ end
+ },
+ },
+})
+
+minetest.register_node("elevatorparts:pilantern_down_on",{
+ description = "PI + Down Lantern Combo (on state - you hacker you!)",
+ groups = {
+ dig_immediate = 2,
+ not_in_creative_inventory = 1,
+ elevatorparts_pi_lbm = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_pilantern_bg.png:25,37=elevatorparts_lantern_down_on.png",
+ },
+ drop = "elevatorparts:pilantern_down_off",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ },
+ },
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec","field[channel;Channel;${channel}")
+ end,
+ on_receive_fields = function(pos,_,fields,sender)
+ local name = sender:get_player_name()
+ if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
+ minetest.record_protection_violation(pos,name)
+ return
+ end
+ local meta = minetest.get_meta(pos)
+ if fields.channel then
+ meta:set_string("channel",fields.channel)
+ end
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "down_light_off" then
+ node.name = "elevatorparts:pilantern_down_off"
+ minetest.swap_node(pos,node)
+ elseif msg == "arrow_up" then
+ meta:set_int("uparrow",1)
+ meta:set_int("downarrow",0)
+ elseif msg == "arrow_down" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",1)
+ elseif msg == "arrow_off" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",0)
+ elseif not pi_ignore[msg] then
+ meta:set_string("text",string.sub(" "..msg,-3,-1))
+ end
+ updateDisplay(pos)
+ end
+ },
+ },
+})
+
+minetest.register_node("elevatorparts:pilantern_updown_off",{
+ description = "PI + Up and Down Lantern Combo",
+ groups = {
+ dig_immediate = 2,
+ elevatorparts_pi_lbm = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_pilantern_bg.png:10,37=elevatorparts_lantern_up_off.png:39,37=elevatorparts_lantern_down_off.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ },
+ },
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec","field[channel;Channel;${channel}")
+ end,
+ on_receive_fields = function(pos,_,fields,sender)
+ local name = sender:get_player_name()
+ if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
+ minetest.record_protection_violation(pos,name)
+ return
+ end
+ local meta = minetest.get_meta(pos)
+ if fields.channel then
+ meta:set_string("channel",fields.channel)
+ end
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "up_light_on" then
+ node.name = "elevatorparts:pilantern_updown_upon"
+ minetest.swap_node(pos,node)
+ elseif msg == "down_light_on" then
+ node.name = "elevatorparts:pilantern_updown_downon"
+ minetest.swap_node(pos,node)
+ elseif msg == "arrow_up" then
+ meta:set_int("uparrow",1)
+ meta:set_int("downarrow",0)
+ elseif msg == "arrow_down" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",1)
+ elseif msg == "arrow_off" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",0)
+ elseif not pi_ignore[msg] then
+ meta:set_string("text",string.sub(" "..msg,-3,-1))
+ end
+ updateDisplay(pos)
+ end
+ },
+ },
+})
+
+minetest.register_node("elevatorparts:pilantern_updown_upon",{
+ description = "PI + Up and Down Lantern Combo (up on, down off state - you hacker you!)",
+ groups = {
+ dig_immediate = 2,
+ not_in_creative_inventory = 1,
+ elevatorparts_pi_lbm = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_pilantern_bg.png:10,37=elevatorparts_lantern_up_on.png:39,37=elevatorparts_lantern_down_off.png",
+ },
+ drop = "elevatorparts:pilantern_updown_off",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ },
+ },
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec","field[channel;Channel;${channel}")
+ end,
+ on_receive_fields = function(pos,_,fields,sender)
+ local name = sender:get_player_name()
+ if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
+ minetest.record_protection_violation(pos,name)
+ return
+ end
+ local meta = minetest.get_meta(pos)
+ if fields.channel then
+ meta:set_string("channel",fields.channel)
+ end
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "up_light_off" then
+ node.name = "elevatorparts:pilantern_updown_off"
+ minetest.swap_node(pos,node)
+ elseif msg == "down_light_on" then
+ node.name = "elevatorparts:pilantern_updown_bothon"
+ minetest.swap_node(pos,node)
+ elseif msg == "arrow_up" then
+ meta:set_int("uparrow",1)
+ meta:set_int("downarrow",0)
+ elseif msg == "arrow_down" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",1)
+ elseif msg == "arrow_off" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",0)
+ elseif not pi_ignore[msg] then
+ meta:set_string("text",string.sub(" "..msg,-3,-1))
+ end
+ updateDisplay(pos)
+ end
+ },
+ },
+})
+
+minetest.register_node("elevatorparts:pilantern_updown_downon",{
+ description = "PI + Up and Down Lantern Combo (up off, down on state - you hacker you!)",
+ groups = {
+ dig_immediate = 2,
+ not_in_creative_inventory = 1,
+ elevatorparts_pi_lbm = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_pilantern_bg.png:10,37=elevatorparts_lantern_up_off.png:39,37=elevatorparts_lantern_down_on.png",
+ },
+ drop = "elevatorparts:pilantern_updown_off",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ },
+ },
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec","field[channel;Channel;${channel}")
+ end,
+ on_receive_fields = function(pos,_,fields,sender)
+ local name = sender:get_player_name()
+ if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
+ minetest.record_protection_violation(pos,name)
+ return
+ end
+ local meta = minetest.get_meta(pos)
+ if fields.channel then
+ meta:set_string("channel",fields.channel)
+ end
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "up_light_on" then
+ node.name = "elevatorparts:pilantern_updown_bothon"
+ minetest.swap_node(pos,node)
+ elseif msg == "down_light_off" then
+ node.name = "elevatorparts:pilantern_updown_off"
+ minetest.swap_node(pos,node)
+ elseif msg == "arrow_up" then
+ meta:set_int("uparrow",1)
+ meta:set_int("downarrow",0)
+ elseif msg == "arrow_down" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",1)
+ elseif msg == "arrow_off" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",0)
+ elseif not pi_ignore[msg] then
+ meta:set_string("text",string.sub(" "..msg,-3,-1))
+ end
+ updateDisplay(pos)
+ end
+ },
+ },
+})
+
+minetest.register_node("elevatorparts:pilantern_updown_bothon",{
+ description = "PI + Up and Down Lantern Combo (both on state - you hacker you!)",
+ groups = {
+ dig_immediate = 2,
+ not_in_creative_inventory = 1,
+ elevatorparts_pi_lbm = 1,
+ },
+ tiles = {
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "elevatorparts_generic_bg.png",
+ "[combine:64x64:0,0=elevatorparts_pilantern_bg.png:10,37=elevatorparts_lantern_up_on.png:39,37=elevatorparts_lantern_down_on.png",
+ },
+ drop = "elevatorparts:pilantern_updown_off",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, 0.48, 0.5, 0.5, 0.5 },
+ },
+ },
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec","field[channel;Channel;${channel}")
+ end,
+ on_receive_fields = function(pos,_,fields,sender)
+ local name = sender:get_player_name()
+ if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
+ minetest.record_protection_violation(pos,name)
+ return
+ end
+ local meta = minetest.get_meta(pos)
+ if fields.channel then
+ meta:set_string("channel",fields.channel)
+ end
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ msg = string.lower(msg)
+ if msg == "up_light_off" then
+ node.name = "elevatorparts:pilantern_updown_downon"
+ minetest.swap_node(pos,node)
+ elseif msg == "down_light_off" then
+ node.name = "elevatorparts:pilantern_updown_upon"
+ minetest.swap_node(pos,node)
+ elseif msg == "arrow_up" then
+ meta:set_int("uparrow",1)
+ meta:set_int("downarrow",0)
+ elseif msg == "arrow_down" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",1)
+ elseif msg == "arrow_off" then
+ meta:set_int("uparrow",0)
+ meta:set_int("downarrow",0)
+ elseif not pi_ignore[msg] then
+ meta:set_string("text",string.sub(" "..msg,-3,-1))
+ end
+ updateDisplay(pos)
+ end
+ },
+ },
+})
+
+minetest.register_lbm({
+ name = "elevatorparts:pi_respawn",
+ label = "Respawn PI display entities",
+ nodenames = {"group:elevatorparts_pi_lbm"},
+ run_at_every_load = true,
+ action = updateDisplay,
+})
+
+minetest.register_craft({
+ output = "elevatorparts:callbutton_up",
+ recipe = {
+ {"basic_materials:plastic_sheet","mesecons_button:button_off","basic_materials:plastic_sheet"},
+ {"mesecons_luacontroller:luacontroller0000","mesecons_lightstone:lightstone_blue_off","basic_materials:plastic_sheet"},
+ {"basic_materials:plastic_sheet","","basic_materials:plastic_sheet"},
+ },
+})
+
+minetest.register_craft({
+ output = "elevatorparts:callbutton_down",
+ recipe = {
+ {"basic_materials:plastic_sheet","","basic_materials:plastic_sheet"},
+ {"mesecons_luacontroller:luacontroller0000","mesecons_lightstone:lightstone_blue_off","basic_materials:plastic_sheet"},
+ {"basic_materials:plastic_sheet","mesecons_button:button_off","basic_materials:plastic_sheet"},
+ },
+})
+
+minetest.register_craft({
+ output = "elevatorparts:callbutton_both",
+ recipe = {
+ {"basic_materials:plastic_sheet","mesecons_button:button_off","basic_materials:plastic_sheet"},
+ {"mesecons_luacontroller:luacontroller0000","mesecons_lightstone:lightstone_blue_off","basic_materials:plastic_sheet"},
+ {"basic_materials:plastic_sheet","mesecons_button:button_off","basic_materials:plastic_sheet"},
+ },
+})
+
+minetest.register_craft({
+ output = "elevatorparts:pilantern_up_off",
+ recipe = {
+ {"basic_materials:plastic_sheet","basic_materials:plastic_sheet","basic_materials:plastic_sheet"},
+ {"mesecons_luacontroller:luacontroller0000","digilines:lcd","basic_materials:plastic_sheet"},
+ {"basic_materials:plastic_sheet","mesecons_lightstone:lightstone_green_off","basic_materials:plastic_sheet"},
+ },
+})
+
+minetest.register_craft({
+ output = "elevatorparts:pilantern_down_off",
+ recipe = {
+ {"basic_materials:plastic_sheet","basic_materials:plastic_sheet","basic_materials:plastic_sheet"},
+ {"mesecons_luacontroller:luacontroller0000","digilines:lcd","basic_materials:plastic_sheet"},
+ {"basic_materials:plastic_sheet","mesecons_lightstone:lightstone_red_off","basic_materials:plastic_sheet"},
+ },
+})
+
+minetest.register_craft({
+ output = "elevatorparts:pilantern_updown_off",
+ recipe = {
+ {"basic_materials:plastic_sheet","basic_materials:plastic_sheet","basic_materials:plastic_sheet"},
+ {"mesecons_luacontroller:luacontroller0000","digilines:lcd","basic_materials:plastic_sheet"},
+ {"mesecons_lightstone:lightstone_green_off","basic_materials:plastic_sheet","mesecons_lightstone:lightstone_red_off"},
+ },
+})
diff --git a/textures/elevatorparts_callbutton_bg.png b/textures/elevatorparts_callbutton_bg.png
new file mode 100644
index 0000000..018a32b
--- /dev/null
+++ b/textures/elevatorparts_callbutton_bg.png
Binary files differ
diff --git a/textures/elevatorparts_callbutton_down.png b/textures/elevatorparts_callbutton_down.png
new file mode 100644
index 0000000..14bb89e
--- /dev/null
+++ b/textures/elevatorparts_callbutton_down.png
Binary files differ
diff --git a/textures/elevatorparts_callbutton_down_centered.png b/textures/elevatorparts_callbutton_down_centered.png
new file mode 100644
index 0000000..a80142e
--- /dev/null
+++ b/textures/elevatorparts_callbutton_down_centered.png
Binary files differ
diff --git a/textures/elevatorparts_callbutton_light.png b/textures/elevatorparts_callbutton_light.png
new file mode 100644
index 0000000..eb36837
--- /dev/null
+++ b/textures/elevatorparts_callbutton_light.png
Binary files differ
diff --git a/textures/elevatorparts_callbutton_up.png b/textures/elevatorparts_callbutton_up.png
new file mode 100644
index 0000000..29176ed
--- /dev/null
+++ b/textures/elevatorparts_callbutton_up.png
Binary files differ
diff --git a/textures/elevatorparts_generic_bg.png b/textures/elevatorparts_generic_bg.png
new file mode 100644
index 0000000..6b2e7ed
--- /dev/null
+++ b/textures/elevatorparts_generic_bg.png
Binary files differ
diff --git a/textures/elevatorparts_lantern_down_off.png b/textures/elevatorparts_lantern_down_off.png
new file mode 100644
index 0000000..824ab82
--- /dev/null
+++ b/textures/elevatorparts_lantern_down_off.png
Binary files differ
diff --git a/textures/elevatorparts_lantern_down_on.png b/textures/elevatorparts_lantern_down_on.png
new file mode 100644
index 0000000..fc46486
--- /dev/null
+++ b/textures/elevatorparts_lantern_down_on.png
Binary files differ
diff --git a/textures/elevatorparts_lantern_up_off.png b/textures/elevatorparts_lantern_up_off.png
new file mode 100644
index 0000000..fac7a8a
--- /dev/null
+++ b/textures/elevatorparts_lantern_up_off.png
Binary files differ
diff --git a/textures/elevatorparts_lantern_up_on.png b/textures/elevatorparts_lantern_up_on.png
new file mode 100644
index 0000000..37d55a3
--- /dev/null
+++ b/textures/elevatorparts_lantern_up_on.png
Binary files differ
diff --git a/textures/elevatorparts_pi_0.png b/textures/elevatorparts_pi_0.png
new file mode 100644
index 0000000..8b77586
--- /dev/null
+++ b/textures/elevatorparts_pi_0.png
Binary files differ
diff --git a/textures/elevatorparts_pi_1.png b/textures/elevatorparts_pi_1.png
new file mode 100644
index 0000000..b56c849
--- /dev/null
+++ b/textures/elevatorparts_pi_1.png
Binary files differ
diff --git a/textures/elevatorparts_pi_2.png b/textures/elevatorparts_pi_2.png
new file mode 100644
index 0000000..2556b36
--- /dev/null
+++ b/textures/elevatorparts_pi_2.png
Binary files differ
diff --git a/textures/elevatorparts_pi_3.png b/textures/elevatorparts_pi_3.png
new file mode 100644
index 0000000..3a189f3
--- /dev/null
+++ b/textures/elevatorparts_pi_3.png
Binary files differ
diff --git a/textures/elevatorparts_pi_4.png b/textures/elevatorparts_pi_4.png
new file mode 100644
index 0000000..20b936c
--- /dev/null
+++ b/textures/elevatorparts_pi_4.png
Binary files differ
diff --git a/textures/elevatorparts_pi_5.png b/textures/elevatorparts_pi_5.png
new file mode 100644
index 0000000..35bc3ca
--- /dev/null
+++ b/textures/elevatorparts_pi_5.png
Binary files differ
diff --git a/textures/elevatorparts_pi_6.png b/textures/elevatorparts_pi_6.png
new file mode 100644
index 0000000..f73b024
--- /dev/null
+++ b/textures/elevatorparts_pi_6.png
Binary files differ
diff --git a/textures/elevatorparts_pi_7.png b/textures/elevatorparts_pi_7.png
new file mode 100644
index 0000000..8e792e9
--- /dev/null
+++ b/textures/elevatorparts_pi_7.png
Binary files differ
diff --git a/textures/elevatorparts_pi_8.png b/textures/elevatorparts_pi_8.png
new file mode 100644
index 0000000..e7b5f02
--- /dev/null
+++ b/textures/elevatorparts_pi_8.png
Binary files differ
diff --git a/textures/elevatorparts_pi_9.png b/textures/elevatorparts_pi_9.png
new file mode 100644
index 0000000..3e2f2c1
--- /dev/null
+++ b/textures/elevatorparts_pi_9.png
Binary files differ
diff --git a/textures/elevatorparts_pi_a.png b/textures/elevatorparts_pi_a.png
new file mode 100644
index 0000000..6ffb6d1
--- /dev/null
+++ b/textures/elevatorparts_pi_a.png
Binary files differ
diff --git a/textures/elevatorparts_pi_arrow_down.png b/textures/elevatorparts_pi_arrow_down.png
new file mode 100644
index 0000000..a704aba
--- /dev/null
+++ b/textures/elevatorparts_pi_arrow_down.png
Binary files differ
diff --git a/textures/elevatorparts_pi_arrow_up.png b/textures/elevatorparts_pi_arrow_up.png
new file mode 100644
index 0000000..20ff5e0
--- /dev/null
+++ b/textures/elevatorparts_pi_arrow_up.png
Binary files differ
diff --git a/textures/elevatorparts_pi_b.png b/textures/elevatorparts_pi_b.png
new file mode 100644
index 0000000..fa24c4a
--- /dev/null
+++ b/textures/elevatorparts_pi_b.png
Binary files differ
diff --git a/textures/elevatorparts_pi_c.png b/textures/elevatorparts_pi_c.png
new file mode 100644
index 0000000..6eb3258
--- /dev/null
+++ b/textures/elevatorparts_pi_c.png
Binary files differ
diff --git a/textures/elevatorparts_pi_d.png b/textures/elevatorparts_pi_d.png
new file mode 100644
index 0000000..c91e1ad
--- /dev/null
+++ b/textures/elevatorparts_pi_d.png
Binary files differ
diff --git a/textures/elevatorparts_pi_dash.png b/textures/elevatorparts_pi_dash.png
new file mode 100644
index 0000000..8202f93
--- /dev/null
+++ b/textures/elevatorparts_pi_dash.png
Binary files differ
diff --git a/textures/elevatorparts_pi_e.png b/textures/elevatorparts_pi_e.png
new file mode 100644
index 0000000..1cb74a0
--- /dev/null
+++ b/textures/elevatorparts_pi_e.png
Binary files differ
diff --git a/textures/elevatorparts_pi_f.png b/textures/elevatorparts_pi_f.png
new file mode 100644
index 0000000..3cc8c8b
--- /dev/null
+++ b/textures/elevatorparts_pi_f.png
Binary files differ
diff --git a/textures/elevatorparts_pi_h.png b/textures/elevatorparts_pi_h.png
new file mode 100644
index 0000000..a96f814
--- /dev/null
+++ b/textures/elevatorparts_pi_h.png
Binary files differ
diff --git a/textures/elevatorparts_pi_j.png b/textures/elevatorparts_pi_j.png
new file mode 100644
index 0000000..70a577c
--- /dev/null
+++ b/textures/elevatorparts_pi_j.png
Binary files differ
diff --git a/textures/elevatorparts_pi_l.png b/textures/elevatorparts_pi_l.png
new file mode 100644
index 0000000..144e47b
--- /dev/null
+++ b/textures/elevatorparts_pi_l.png
Binary files differ
diff --git a/textures/elevatorparts_pi_n.png b/textures/elevatorparts_pi_n.png
new file mode 100644
index 0000000..03b9bb8
--- /dev/null
+++ b/textures/elevatorparts_pi_n.png
Binary files differ
diff --git a/textures/elevatorparts_pi_p.png b/textures/elevatorparts_pi_p.png
new file mode 100644
index 0000000..a6e87be
--- /dev/null
+++ b/textures/elevatorparts_pi_p.png
Binary files differ
diff --git a/textures/elevatorparts_pi_r.png b/textures/elevatorparts_pi_r.png
new file mode 100644
index 0000000..a92d3e7
--- /dev/null
+++ b/textures/elevatorparts_pi_r.png
Binary files differ
diff --git a/textures/elevatorparts_pi_t.png b/textures/elevatorparts_pi_t.png
new file mode 100644
index 0000000..94d504c
--- /dev/null
+++ b/textures/elevatorparts_pi_t.png
Binary files differ
diff --git a/textures/elevatorparts_pi_u.png b/textures/elevatorparts_pi_u.png
new file mode 100644
index 0000000..af24dfb
--- /dev/null
+++ b/textures/elevatorparts_pi_u.png
Binary files differ
diff --git a/textures/elevatorparts_pi_y.png b/textures/elevatorparts_pi_y.png
new file mode 100644
index 0000000..b7b939b
--- /dev/null
+++ b/textures/elevatorparts_pi_y.png
Binary files differ
diff --git a/textures/elevatorparts_pilantern_bg.png b/textures/elevatorparts_pilantern_bg.png
new file mode 100644
index 0000000..fd3f13b
--- /dev/null
+++ b/textures/elevatorparts_pilantern_bg.png
Binary files differ
diff --git a/textures/elevatorparts_transparent.png b/textures/elevatorparts_transparent.png
new file mode 100644
index 0000000..489aca7
--- /dev/null
+++ b/textures/elevatorparts_transparent.png
Binary files differ