diff options
Diffstat (limited to 'subway')
-rw-r--r-- | subway/init_code.lua | 10 | ||||
-rw-r--r-- | subway/nodes/(-1559,-1,697).lua | 63 | ||||
-rw-r--r-- | subway/nodes/(-1606,2,595).lua | 12 | ||||
-rw-r--r-- | subway/nodes/(10,0,-10).lua | 2 | ||||
-rw-r--r-- | subway/nodes/(305,9,34).lua | 1 |
5 files changed, 83 insertions, 5 deletions
diff --git a/subway/init_code.lua b/subway/init_code.lua index ebe0781..20fd5ad 100644 --- a/subway/init_code.lua +++ b/subway/init_code.lua @@ -1,3 +1,4 @@ +-- 'subway' environment -- --F.stn_union=function(line1, prev1, prev2, this, next, doors, dps, osig, ret_sw, ret_st, nohalt, waittime) F.stationnames={ Ewb="Edenwood Beach", @@ -340,6 +341,13 @@ end end end +local function aspect_is_free(asp) + if type(asp.main) == "table" then + return asp.main.free + else + return asp.main ~= 0 + end +end -- 21.1.19, the rise of tss F.stn_ilk=function(prev, this, next, doors, dps) @@ -353,7 +361,7 @@ F.stn_ilk=function(prev, this, next, doors, dps) if not asp then atc_set_text_inside(F.stnname(this).."\nNo aspect for "..this) else - if asp.main.free then + if aspect_is_free(asp) then atc_set_text_inside("Next stop:\n"..F.stnname(next)) atc_send("OC D1 S"..(dps or "M")) depart = true 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 diff --git a/subway/nodes/(-1606,2,595).lua b/subway/nodes/(-1606,2,595).lua index e1a4cf3..7dbb72c 100644 --- a/subway/nodes/(-1606,2,595).lua +++ b/subway/nodes/(-1606,2,595).lua @@ -1,2 +1,12 @@ +if event.train then +if flip then + atc_set_text_outside("1 - Syzmon's Dam") + set_rc("Szy") +else + atc_set_text_outside("1 - Windy Mountains") + set_rc("1wind") +end +flip = not flip +end + F.stn_return("Apl1W", "Pal1R", "Apl1E", "R", "Pal1ES", "cr") -F.lineset("1", "E") diff --git a/subway/nodes/(10,0,-10).lua b/subway/nodes/(10,0,-10).lua index bc56a91..9121a78 100644 --- a/subway/nodes/(10,0,-10).lua +++ b/subway/nodes/(10,0,-10).lua @@ -73,7 +73,7 @@ end local txt = { [1] = "Windy Mtns.", - [4] = "Schwarzs...", + [4] = "Schwarzs.", } local line1, line2, line3 = "", "", "" if du_line then diff --git a/subway/nodes/(305,9,34).lua b/subway/nodes/(305,9,34).lua index 0f9d5a7..e7abef3 100644 --- a/subway/nodes/(305,9,34).lua +++ b/subway/nodes/(305,9,34).lua @@ -1,2 +1 @@ -F.stn("Adb1W", "Rru1W", "Wcs1W", "L") F.stat("Line 1")
\ No newline at end of file |