From 520fcb1366259c277ae6d966c0a6d5148bb89c98 Mon Sep 17 00:00:00 2001 From: h-v-smacker Date: Sun, 23 Sep 2018 06:48:02 +0300 Subject: small improvements --- init.lua | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 830bbe0..fb39cd2 100644 --- a/init.lua +++ b/init.lua @@ -87,7 +87,8 @@ minetest.register_node("railroad_paraphernalia:switch_with_arrow", { gain = 0.3, }) mesecon.receptor_on(pos, switch_get_rules(minetest.get_node(pos).param2)) - end + end, + drop = "railroad_paraphernalia:switch_with_arrow" }) minetest.register_node("railroad_paraphernalia:switch_with_arrow_act", { @@ -186,7 +187,8 @@ minetest.register_node("railroad_paraphernalia:switch_with_lamp", { gain = 0.3, }) mesecon.receptor_on(pos, switch_get_rules(minetest.get_node(pos).param2)) - end + end, + drop = "railroad_paraphernalia:switch_with_lamp" }) @@ -355,7 +357,8 @@ minetest.register_node("railroad_paraphernalia:track_blocker", { gain = 0.3, }) mesecon.receptor_on(pos, switch_get_rules(minetest.get_node(pos).param2)) - end + end, + drop = "railroad_paraphernalia:track_blocker" }) minetest.register_node("railroad_paraphernalia:track_blocker_act", { @@ -441,7 +444,16 @@ minetest.register_node("railroad_paraphernalia:shunting_signal", { max_hear_distance = 20, gain = 0.3, }) - end + end, + luaautomation = { + getstate = "off", + setstate = function(pos, node, newstate) + if newstate == "on" then + advtrains.ndb.swap_node(pos, {name = "railroad_paraphernalia:shunting_signal_act", param2 = node.param2}, true) + end + end, + }, + drop = "railroad_paraphernalia:shunting_signal" }) @@ -476,6 +488,14 @@ minetest.register_node("railroad_paraphernalia:shunting_signal_act", { gain = 0.3, }) end, + luaautomation = { + getstate = "on", + setstate = function(pos, node, newstate) + if newstate == "off" then + advtrains.ndb.swap_node(pos, {name = "railroad_paraphernalia:shunting_signal", param2 = node.param2}, true) + end + end, + }, drop = "railroad_paraphernalia:shunting_signal" }) -- cgit v1.2.3