Screw buttonlike rules for wall signals and use regular rules.
This commit is contained in:
parent
e9fb8f9f1b
commit
dab50fe064
|
@ -2,31 +2,7 @@
|
||||||
--signals.lua
|
--signals.lua
|
||||||
|
|
||||||
--this code /should/ work but does not.
|
--this code /should/ work but does not.
|
||||||
local mrules_wallsignal_l, mrules_wallsignal_r
|
local mrules_wallsignal = advtrains.meseconrules
|
||||||
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
|
|
||||||
|
|
||||||
for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red", als="green"}}) do
|
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,
|
light_source = 1,
|
||||||
sunlight_propagates=true,
|
sunlight_propagates=true,
|
||||||
mesecons = {effector = {
|
mesecons = {effector = {
|
||||||
rules = mrules_wallsignal_r,
|
rules = mrules_wallsignal,
|
||||||
["action_"..f.as] = function (pos, node)
|
["action_"..f.as] = function (pos, node)
|
||||||
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2})
|
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue