aboutsummaryrefslogtreecommitdiff
path: root/advtrains/advtrains_luaautomation/p_mesecon_iface.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-02-20 11:31:14 +0100
committerorwell96 <mono96.mml@gmail.com>2017-02-20 11:31:14 +0100
commit6b5f5ea34589088e479e0150a8fdc3ff8e44ca78 (patch)
tree4e706cbfbc03ffd55ef598396a215c9d557d989c /advtrains/advtrains_luaautomation/p_mesecon_iface.lua
parente4e76322ba74e1ffb465ca5bbfc420d8857aea01 (diff)
downloadadvtrains-6b5f5ea34589088e479e0150a8fdc3ff8e44ca78.tar.gz
advtrains-6b5f5ea34589088e479e0150a8fdc3ff8e44ca78.tar.bz2
advtrains-6b5f5ea34589088e479e0150a8fdc3ff8e44ca78.zip
Fix manual operation of mesecon switches
Diffstat (limited to 'advtrains/advtrains_luaautomation/p_mesecon_iface.lua')
-rw-r--r--advtrains/advtrains_luaautomation/p_mesecon_iface.lua17
1 files changed, 5 insertions, 12 deletions
diff --git a/advtrains/advtrains_luaautomation/p_mesecon_iface.lua b/advtrains/advtrains_luaautomation/p_mesecon_iface.lua
index d7e1052..95e5d8a 100644
--- a/advtrains/advtrains_luaautomation/p_mesecon_iface.lua
+++ b/advtrains/advtrains_luaautomation/p_mesecon_iface.lua
@@ -9,13 +9,9 @@ minetest.override_item("mesecons_switch:mesecon_switch_off", {
save_in_nodedb=1,
},
on_rightclick = function (pos, node)
- if(mesecon.flipstate(pos, node) == "on") then
- mesecon.receptor_on(pos)
- else
- mesecon.receptor_off(pos)
- end
+ advtrains.ndb.swap_node(pos, {name="mesecons_switch:mesecon_switch_on", param2=node.param2})
+ mesecon.receptor_on(pos)
minetest.sound_play("mesecons_switch", {pos=pos})
- advtrains.ndb.update(pos, node)
end,
on_updated_from_nodedb = function(pos, node)
mesecon.receptor_off(pos)
@@ -35,15 +31,12 @@ minetest.override_item("mesecons_switch:mesecon_switch_on", {
groups = {
dig_immediate=2,
save_in_nodedb=1,
+ not_in_creative_inventory=1,
},
on_rightclick = function (pos, node)
- if(mesecon.flipstate(pos, node) == "on") then
- mesecon.receptor_on(pos)
- else
- mesecon.receptor_off(pos)
- end
+ advtrains.ndb.swap_node(pos, {name="mesecons_switch:mesecon_switch_off", param2=node.param2})
+ mesecon.receptor_off(pos)
minetest.sound_play("mesecons_switch", {pos=pos})
- advtrains.ndb.update(pos, node)
end,
on_updated_from_nodedb = function(pos, node)
mesecon.receptor_on(pos)