diff options
Diffstat (limited to 'advtrains')
-rw-r--r-- | advtrains/signals.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/advtrains/signals.lua b/advtrains/signals.lua index 75f9213..669e825 100644 --- a/advtrains/signals.lua +++ b/advtrains/signals.lua @@ -10,6 +10,23 @@ local function can_dig_func(pos) return true end +local function aspect(b) +return { + main = { + free = b, + speed = -1, + }, + shunt = { + free = false, + }, + dst = { + free = true, + speed = -1, + }, + info = {} +} +end + for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red", als="green"}}) do advtrains.trackplacer.register_tracktype("advtrains:retrosignal", "") @@ -64,6 +81,9 @@ for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red", else advtrains.ndb.swap_node(pos, {name = "advtrains:retrosignal_off"..rotation, param2 = node.param2}, true) end + end, + get_aspect = function(pos, node) + return aspect(r=="on") end }, can_dig = can_dig_func, @@ -117,6 +137,9 @@ for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red", advtrains.ndb.swap_node(pos, {name = "advtrains:signal_off"..rotation, param2 = node.param2}, true) end end, + get_aspect = function(pos, node) + return aspect(r=="on") + end, getstate = f.ls, setstate = function(pos, node, newstate) if newstate == f.als then @@ -180,6 +203,9 @@ for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red", advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_off", param2 = node.param2}, true) end end, + get_aspect = function(pos, node) + return aspect(r=="on") + end, getstate = f.ls, setstate = function(pos, node, newstate) if newstate == f.als then |