diff options
author | orwell96 <mono96.mml@gmail.com> | 2017-03-12 12:18:35 +0100 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2017-03-12 12:19:18 +0100 |
commit | dab50fe064d630abca6348c1ec0d462c6882bcd0 (patch) | |
tree | 3d024bebadfd47a05d857705c3c211407411748b | |
parent | e9fb8f9f1b2d1854c561950cc44aa96321690d2d (diff) | |
download | advtrains-dab50fe064d630abca6348c1ec0d462c6882bcd0.tar.gz advtrains-dab50fe064d630abca6348c1ec0d462c6882bcd0.tar.bz2 advtrains-dab50fe064d630abca6348c1ec0d462c6882bcd0.zip |
Screw buttonlike rules for wall signals and use regular rules.
-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 |