aboutsummaryrefslogtreecommitdiff
path: root/advtrains/signals.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2020-01-30 08:45:16 +0100
committerorwell96 <orwell@bleipb.de>2021-02-10 16:36:24 +0100
commit119a09b784ad3f3c6bfd327f32164cb099f47f10 (patch)
treebf1d37de3ede0aa3d37e73ca64b7122dfd7edd54 /advtrains/signals.lua
parent573d6b06b28c39872c1c036fc191c1c5e4b289a9 (diff)
downloadadvtrains-119a09b784ad3f3c6bfd327f32164cb099f47f10.tar.gz
advtrains-119a09b784ad3f3c6bfd327f32164cb099f47f10.tar.bz2
advtrains-119a09b784ad3f3c6bfd327f32164cb099f47f10.zip
Simplify Signal Aspect Table (H#132) [breaks compatibility with signal API]
Diffstat (limited to 'advtrains/signals.lua')
-rw-r--r--advtrains/signals.lua22
1 files changed, 7 insertions, 15 deletions
diff --git a/advtrains/signals.lua b/advtrains/signals.lua
index 2bad1d4..1940518 100644
--- a/advtrains/signals.lua
+++ b/advtrains/signals.lua
@@ -12,18 +12,10 @@ end
local function aspect(b)
return {
- main = {
- free = b,
- speed = -1,
- },
- shunt = {
- free = false,
- proceed_as_main = true
- },
- dst = {
- free = true,
- speed = -1,
- },
+ main = (not b) and 0, -- b ? false : 0
+ shunt = false,
+ proceed_as_main = true,
+ dst = false,
info = {}
}
end
@@ -81,7 +73,7 @@ for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red",
-- new signal API
advtrains = {
set_aspect = function(pos, node, asp)
- if asp.main.free then
+ if asp.main != 0 then
advtrains.ndb.swap_node(pos, {name = "advtrains:retrosignal_on"..rotation, param2 = node.param2}, true)
else
advtrains.ndb.swap_node(pos, {name = "advtrains:retrosignal_off"..rotation, param2 = node.param2}, true)
@@ -140,7 +132,7 @@ for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red",
-- new signal API
advtrains = {
set_aspect = function(pos, node, asp)
- if asp.main.free then
+ if asp.main != 0 then
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_on"..rotation, param2 = node.param2}, true)
else
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_off"..rotation, param2 = node.param2}, true)
@@ -208,7 +200,7 @@ for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red",
-- new signal API
advtrains = {
set_aspect = function(pos, node, asp)
- if asp.main.free then
+ if asp.main != 0 then
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_on", param2 = node.param2}, true)
else
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_off", param2 = node.param2}, true)