aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2018-10-09 11:36:34 +0200
committerorwell96 <orwell@bleipb.de>2018-10-09 12:07:23 +0200
commit8f8f009425a4d3341d3d00e6a537b5af320b5639 (patch)
treecc2abc9df9581003abf602acbf1d9cbeb10837ea /advtrains
parent8df7bcf6b6ea6333b3df925af528e23574974d69 (diff)
downloadadvtrains-8f8f009425a4d3341d3d00e6a537b5af320b5639.tar.gz
advtrains-8f8f009425a4d3341d3d00e6a537b5af320b5639.tar.bz2
advtrains-8f8f009425a4d3341d3d00e6a537b5af320b5639.zip
Make signal influence point (~halt point) specifiable
Also extend signal api necessarily
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/signals.lua26
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