diff options
author | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 15:02:44 +0200 |
---|---|---|
committer | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 15:02:44 +0200 |
commit | 3806b44bd2583efd02b7d0439b6e4f9b094362bd (patch) | |
tree | 62efb80b1ef53fad89dd2ed868f0895890ea5e5b /Crossroads/init_code.lua | |
parent | 910c979daa1cbfe0d6296ad4a6621a101e25cd65 (diff) | |
download | luaatc_envs-3806b44bd2583efd02b7d0439b6e4f9b094362bd.tar.gz luaatc_envs-3806b44bd2583efd02b7d0439b6e4f9b094362bd.tar.bz2 luaatc_envs-3806b44bd2583efd02b7d0439b6e4f9b094362bd.zip |
State at 2023-10-31
Diffstat (limited to 'Crossroads/init_code.lua')
-rw-r--r-- | Crossroads/init_code.lua | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/Crossroads/init_code.lua b/Crossroads/init_code.lua index c385036..38a55e1 100644 --- a/Crossroads/init_code.lua +++ b/Crossroads/init_code.lua @@ -138,10 +138,21 @@ function F.stn2gen(stn, trk, door, ret, chout, depspeed) atc_send (ret and "BBWRSM" or "SM") return end - if event.type == "approach" then + if event.type == "approach" and not event.has_entered then for i = 1, #t, 1 do if t[i][1]==l then + atc_set_ars_disable(true) atc_set_lzb_tsr(2) + local intext = ("Arriving at: %s (Track: %s)"):format(F.stnlist[stn] or stn, trk) + atc_set_text_inside(intext) + S.trains[atc_id] = { + v = 2, + l = get_line() or "", + s = stn, + t = trk or "N/A", + ts = os.time(), + mode = "APP", + } return end end @@ -161,7 +172,8 @@ function F.stn2gen(stn, trk, door, ret, chout, depspeed) else interval = 15 end - atc_send(string.format("A0B0WO%sD%dOCD1%sA1S%s", door, interval, (ret and "R" or ""), tostring(depspeed or "M"))) + --atc_send(string.format("A0B0WO%sD%dOCD1%sA1S%s", door, interval, (ret and "R" or ""), tostring(depspeed or "M"))) + atc_send(("B0WO%s"):format(door)) local nxt = t[i][2] local intext_nxt = "" local nxtdisp = "" @@ -189,13 +201,15 @@ function F.stn2gen(stn, trk, door, ret, chout, depspeed) l = (get_line() or ""), s = stn, t = (trk or "N/A"), + ts = os.time(), + mode = "ARR", } schedule_in(interval, {intext = nxtdisp}) break end end if (not stop) then - atc_send((ret and "BBWR" or "").."S"..(depspeed or "M")) + atc_send((ret and "BBWR" or "").."A1S"..(depspeed or "M")) end elseif event.type == "schedule" then if atc_id then @@ -203,7 +217,15 @@ function F.stn2gen(stn, trk, door, ret, chout, depspeed) if msg.intext then atc_set_text_inside(msg.intext) end - --atc_send("OCD1"..((ret and atc_arrow) and "B0WR" or "").."A1S"..(depspeed or "M")) + atc_send("OCD1"..((ret and atc_arrow) and "B0WR" or "").."A1S"..(depspeed or "M")) + S.trains[atc_id] = { + v = 2, + l = get_line() or "", + s = stn, + t = trk or "N/A", + ts = os.time(), + mode = "DEP", + } end end end |