diff options
-rw-r--r-- | advtrains/advtrains/signals.lua | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/advtrains/advtrains/signals.lua b/advtrains/advtrains/signals.lua index 3278c39..ceb4166 100644 --- a/advtrains/advtrains/signals.lua +++ b/advtrains/advtrains/signals.lua @@ -2,31 +2,7 @@ --signals.lua --this code /should/ work but does not. -local mrules_wallsignal_l, mrules_wallsignal_r -if mesecon then - mrules_wallsignal_l = function(node, isright) - local rules = mesecon.rules.buttonlike - if node.param2 == 1 then - rules=mesecon.rotate_rules_left(rules) - elseif node.param2 == 2 then - rules=mesecon.rotate_rules_right(mesecon.rotate_rules_right(rules)) - elseif node.param2 == 3 then - rules=mesecon.rotate_rules_right(rules) - end - return rules - end - mrules_wallsignal_r = function(node) - local rules = mesecon.rules.buttonlike - if node.param2 == 3 then - rules=mesecon.rotate_rules_left(rules) - elseif node.param2 == 0 then - rules=mesecon.rotate_rules_right(mesecon.rotate_rules_right(rules)) - elseif node.param2 == 1 then - rules=mesecon.rotate_rules_right(rules) - end - return rules - end -end +local mrules_wallsignal = advtrains.meseconrules for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red", als="green"}}) do @@ -141,7 +117,7 @@ for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red", light_source = 1, sunlight_propagates=true, mesecons = {effector = { - rules = mrules_wallsignal_r, + rules = mrules_wallsignal, ["action_"..f.as] = function (pos, node) advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2}) end |