summaryrefslogtreecommitdiff
path: root/Crossroads/init_code.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Crossroads/init_code.lua')
-rw-r--r--Crossroads/init_code.lua28
1 files changed, 24 insertions, 4 deletions
diff --git a/Crossroads/init_code.lua b/Crossroads/init_code.lua
index 067c474..286e897 100644
--- a/Crossroads/init_code.lua
+++ b/Crossroads/init_code.lua
@@ -31,6 +31,9 @@ local crossing_light_count = {
NRG_3 = 3,
NRG_4 = 2,
NRG_5 = 4,
+ NRG_6 = 4,
+ NRG_7 = 2,
+ NRG_8 = 4,
}
local function update_light(loc, k, v)
@@ -52,14 +55,31 @@ local function update_light(loc, k, v)
end
end
-function F.x_on(t)
- if event.type ~= "train" then return end
- if not atc_arrow then return end
+function F.crossing_on(t)
for loc, k in pairs(t) do
update_light(loc, k, true)
end
end
+function F.x_on(t)
+ if event.type == "train" and atc_arrow then
+ return F.crossing_on(t)
+ end
+end
+
+function F.ax_on(t)
+ __approach_callback_mode = 1
+ if (event.type == "approach" or event.type == "train") and atc_arrow then
+ return F.crossing_on(t)
+ end
+end
+
+function F.sx_on(t)
+ if event.type == "schedule" and (event.msg or {}).depart then
+ return F.crossing_on(t)
+ end
+end
+
function F.x_off(t)
if event.type ~= "train" then return end
if not atc_arrow then return end
@@ -250,7 +270,7 @@ function F.stn2gen(stn, trk, door, ret, chout, depspeed)
ts = os.time(),
mode = "ARR",
}
- schedule_in(interval, {intext = nxtdisp})
+ schedule_in(interval, {intext = nxtdisp, depart = true})
break
end
end