diff options
author | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 14:52:38 +0200 |
---|---|---|
committer | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 14:52:38 +0200 |
commit | cfa65d94f1bc9d9e9efe13791711a9ad044a4a67 (patch) | |
tree | bdecc9982a58cb88367e4e8b1fcd9cfa1f95573e /subway/nodes/(-1559,-1,697).lua | |
parent | f3da24b214b3337ad63ebd885da29d5b789d4738 (diff) | |
download | luaatc_envs-cfa65d94f1bc9d9e9efe13791711a9ad044a4a67.tar.gz luaatc_envs-cfa65d94f1bc9d9e9efe13791711a9ad044a4a67.tar.bz2 luaatc_envs-cfa65d94f1bc9d9e9efe13791711a9ad044a4a67.zip |
State at 2021-04-04
Diffstat (limited to 'subway/nodes/(-1559,-1,697).lua')
-rw-r--r-- | subway/nodes/(-1559,-1,697).lua | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/subway/nodes/(-1559,-1,697).lua b/subway/nodes/(-1559,-1,697).lua index fb61529..06e29da 100644 --- a/subway/nodes/(-1559,-1,697).lua +++ b/subway/nodes/(-1559,-1,697).lua @@ -1 +1,62 @@ -F.stn("App1W", "Apl1W", "Pal1R", "L")
\ No newline at end of file +--print("Apple Plains: Train",atc_id,"event",event.type,"sigstate",getstate("Apl1W")) +--F.stn("App1W", "Apl1W", "Pal1R", "L") +local this = "Apl1W" +local prev1 = "App1W" +local doors = "L" +local next = "Pal1R" + + if not atc_id then + print("Apple Plains WTF - Bug happened again. Trying laterrr...") + interrupt(20, "ready") + return + end + if not atc_arrow then + atc_send("B0") + error("Train passed in wrong direction!") + end + depart=false + if event.train then + setstate(prev1, "red") + if prev2 then setstate(prev2, "red") end + atc_send("B0O"..doors) + + if not nohalt then + interrupt(waittime or (ret_sw and 20 or 7), "ready") + atc_set_text_inside(F.stnname(this)) + end + end + if (event.int and event.message=="ready") or (event.train and nohalt) then + if getstate(this)=="green" and (not osig or getstate(osig)=="green") then + if ret_sw then + atc_send("OCD1B0WRS"..(dps or "M")) + setstate(ret_sw, ret_st) + else + atc_send("OCD1S"..(dps or "M")) + setstate(prev1, "green") + if line1 then --this call did not come from F.stn, do union stuff + setstate(prev2, "green") + if S.line[atc_id]==line1 then + if S.union_waiting[prev2] then setstate(prev1, "red") end + else + if S.union_waiting[prev1] then setstate(prev2, "red") end + end + end + end + setstate(this, "red") + atc_set_text_inside("Next stop: "..F.stnname(next)) + depart=true + nodepartc=nil + else + interrupt(F.rant(), "ready") + nodepartc=nodepartc and nodepartc+1 or 0 + if nodepartc>=10 then + atc_set_text_inside(F.stnname(this).."\nLine out of order!") + else + if (not osig or getstate(osig)=="green") then + atc_set_text_inside(F.stnname(this).."\nWaiting for preceding train...") + else + atc_set_text_inside(F.stnname(this).."\nWaiting for oncoming train...") + end + end + end + end
\ No newline at end of file |