diff options
author | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 14:58:03 +0200 |
---|---|---|
committer | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 14:58:03 +0200 |
commit | 7b3ac07f3f9b9d92582aceb74050215a36646bc5 (patch) | |
tree | 3eda9d8e0a85b9d0daa53dd2887d154d9e0ef172 | |
parent | efa99edcbd392873d8ed78eae7760f8c0b23dc45 (diff) | |
download | luaatc_envs-7b3ac07f3f9b9d92582aceb74050215a36646bc5.tar.gz luaatc_envs-7b3ac07f3f9b9d92582aceb74050215a36646bc5.tar.bz2 luaatc_envs-7b3ac07f3f9b9d92582aceb74050215a36646bc5.zip |
State at 2023-03-26
188 files changed, 2377 insertions, 130 deletions
diff --git a/Crossroads/init_code.lua b/Crossroads/init_code.lua index d1333fc..692f0c5 100644 --- a/Crossroads/init_code.lua +++ b/Crossroads/init_code.lua @@ -177,7 +177,13 @@ function F.stn2gen(stn, trk, door, ret, chout, depspeed) t[i][6] = t[i][6] and (t[i][6]+timenow-t[i][5]+30)/2 or (timenow-t[i][5]) t[i][5] = timenow atc_set_text_inside(intext) - if chout then atc_set_text_outside(outtext) end + if chout then + if type(chout) == "string" then + atc_set_text_outside(chout) + else + atc_set_text_outside(outtext) + end + end S.trains[atc_id] = { v = 2, l = (get_line() or ""), @@ -328,11 +334,13 @@ F.stnlist = { crch = "Crossroads City Hall", crchs = "City Hall South", crmtrail = "Mountain Railway Terminus", + crshelter1 = "Shelter I", + crsfterm = "South Forest St. Terminal", crsmacker = "Smacker's Station", - crwm = "CR West Mountains", - elchateau = "Erstaziland-Chateau d'Erstazi", - elgp = "Erstaziland-Greener Pastures", - elsf = "Erstaziland-Salt Factory", + crwm = "West Mountains", + elchateau = "Chateau d'Erstazi", + elgp = "Greener Pastures", + elsf = "Salt Factory", evo = "EVO", grsc = "Grassy Scarp", mushroom = "Mushroom Land", @@ -387,8 +395,8 @@ F.lines = { name = "ATL-Z", short = "ATL-Z", ring = false, interval = 480, - [1] = { {"Bts","3"}, {"evo","N/A"}, {"scs","N1"}, {"scc","N1"}, {"scn","N1"}, {"oc","N"}, {"elgp","N"}, {"elsf","E"}, {"elchateau","S"} }, - [2] = { {"elchateau","S"}, {"elsf","W"}, {"elgp","S"}, {"oc","S"}, {"scn","S1"}, {"scc", "S1"}, {"scs","S1"}, {"evo","N/A"}, {"Bts","3"}, }, + [1] = { {"Bts","3"}, {"evo","N/A"}, {"scs","N1"}, {"scc","N1"}, {"scn","N1"}, {"oc","K1"}, --[[{"elgp","N"}, {"elsf","E"}, {"elchateau","S"}]] }, + [2] = { --[[{"elchateau","S"}, {"elsf","W"}, {"elgp","S"},]] {"oc","K1"}, {"scn","S1"}, {"scc", "S1"}, {"scs","S1"}, {"evo","N/A"}, {"Bts","3"}, }, }, ["CRT1"] = { name = "1", @@ -396,6 +404,28 @@ F.lines = { [1] = { {"crsmacker", "R3"}, --[[{"crch", "U1"},]] {"crchs", "W"}, {"cras", "N"} }, [2] = { {"cras", "N"}, {"crchs", "E"}, --[[{"crch", "U2"},]] {"crsmacker", "R3"} }, }, + ["CRT4"] = { + name = "4", + ring = false, + rtt = 120, + interval = 60, + [1] = { {"crch", "11", 0}, {"crsfterm", "1N", 0}, }, + [2] = { {"crsfterm", "1N", 0}, {"crch", "11", 0}, }, + }, + ["CRT12"] = { + name = "12", + ring = false, + [1] = {{"crch", "M"}, {"crwm", "3"}}, + [2] = {{"crwm", "3"}, {"crch", "M"}}, + }, + ["CRT21"] = { + name = "21", + ring = false, + rtt = 120, + interval = 120, + [1] = { {"crch", "12", 15}, {"crshelter1", "T", 75}, }, + [2] = { {"crshelter1", "T", 75}, {"crch", "12", 15}, }, + }, ["NRG1"] = { name = "1", ring = "counterclockwise", @@ -425,12 +455,15 @@ end for k, v in pairs{["A"] = {5}, ["B"]={6}, ["C"]={7}, ["D"]={8}} do local t = {} local u = {} + local phase = ((v[1]-5)%2)*15 + t[1] = {"crsfterm", (v[1]-4).."S", phase} for i = 1, 5, 2 do t[#t+1] = {string.format("crs_%d_%d",v[1],i), "E", 0} end for i = 5, 1, -2 do u[#u+1] = {string.format("crs_%d_%d",v[1],i), "W", 0} end + u[#u+1] = {"crsfterm", (v[1]-4).."S", phase} F.lines["CRT3"..k] = { name = "3"..k, ring = false, rtt = 30, interval = 30, [1] = t, [2] = u, diff --git a/Crossroads/nodes/(1377,10,1353).lua b/Crossroads/nodes/(1377,10,1353).lua new file mode 100644 index 0000000..863d61c --- /dev/null +++ b/Crossroads/nodes/(1377,10,1353).lua @@ -0,0 +1 @@ +F.stn2gen("oc", "K1", "L", true, "ATL Zinc Line")
\ No newline at end of file diff --git a/Crossroads/nodes/(1384,26,775).lua b/Crossroads/nodes/(1384,26,775).lua new file mode 100644 index 0000000..ad10463 --- /dev/null +++ b/Crossroads/nodes/(1384,26,775).lua @@ -0,0 +1 @@ +F.stn2gen("crwm", "3", "L", true, true)
\ No newline at end of file diff --git a/Crossroads/nodes/(1703,10,781).lua b/Crossroads/nodes/(1703,10,781).lua new file mode 100644 index 0000000..1bb93e8 --- /dev/null +++ b/Crossroads/nodes/(1703,10,781).lua @@ -0,0 +1 @@ +F.stn2gen("crsfterm", "4S", "L", true, true)
\ No newline at end of file diff --git a/Crossroads/nodes/(1709,10,781).lua b/Crossroads/nodes/(1709,10,781).lua new file mode 100644 index 0000000..b7b00f7 --- /dev/null +++ b/Crossroads/nodes/(1709,10,781).lua @@ -0,0 +1 @@ +F.stn2gen("crsfterm", "3S", "R", true, true)
\ No newline at end of file diff --git a/Crossroads/nodes/(1717,10,781).lua b/Crossroads/nodes/(1717,10,781).lua new file mode 100644 index 0000000..723ad70 --- /dev/null +++ b/Crossroads/nodes/(1717,10,781).lua @@ -0,0 +1 @@ +F.stn2gen("crsfterm", "2S", "L", true, true)
\ No newline at end of file diff --git a/Crossroads/nodes/(1723,10,790).lua b/Crossroads/nodes/(1723,10,790).lua new file mode 100644 index 0000000..10cf496 --- /dev/null +++ b/Crossroads/nodes/(1723,10,790).lua @@ -0,0 +1 @@ +F.stn2gen("crsfterm", "1N", "L", true, true)
\ No newline at end of file diff --git a/Crossroads/nodes/(1747,26,1024).lua b/Crossroads/nodes/(1747,26,1024).lua new file mode 100644 index 0000000..51c35fb --- /dev/null +++ b/Crossroads/nodes/(1747,26,1024).lua @@ -0,0 +1 @@ +F.stn2gen("crch", "M", "R", false, true)
\ No newline at end of file diff --git a/Crossroads/nodes/(1768,10,598).lua b/Crossroads/nodes/(1768,10,598).lua index 197c740..0c03cf2 100644 --- a/Crossroads/nodes/(1768,10,598).lua +++ b/Crossroads/nodes/(1768,10,598).lua @@ -1 +1 @@ -F.stn2gen("crs_8_1","E","R",true,true)
\ No newline at end of file +F.stn2gen("crs_8_1","W","R")
\ No newline at end of file diff --git a/Crossroads/nodes/(1768,10,706).lua b/Crossroads/nodes/(1768,10,706).lua index 2431bec..466bda0 100644 --- a/Crossroads/nodes/(1768,10,706).lua +++ b/Crossroads/nodes/(1768,10,706).lua @@ -1 +1 @@ -F.stn2gen("crs_6_1","E","R",true,true)
\ No newline at end of file +F.stn2gen("crs_6_1","W","R")
\ No newline at end of file diff --git a/Crossroads/nodes/(1768,10,760).lua b/Crossroads/nodes/(1768,10,760).lua index 16c9e6e..19278e8 100644 --- a/Crossroads/nodes/(1768,10,760).lua +++ b/Crossroads/nodes/(1768,10,760).lua @@ -1 +1 @@ -F.stn2gen("crs_5_1","E","R",true,true)
\ No newline at end of file +F.stn2gen("crs_5_1","W","R")
\ No newline at end of file diff --git a/Crossroads/nodes/(1769,10,652).lua b/Crossroads/nodes/(1769,10,652).lua index fe1521a..4f300b4 100644 --- a/Crossroads/nodes/(1769,10,652).lua +++ b/Crossroads/nodes/(1769,10,652).lua @@ -1 +1 @@ -F.stn2gen("crs_7_1","E","R",true,true)
\ No newline at end of file +F.stn2gen("crs_7_1","W","R")
\ No newline at end of file diff --git a/Crossroads/nodes/(1791,-6,1007).lua b/Crossroads/nodes/(1791,-6,1007).lua new file mode 100644 index 0000000..6c812ee --- /dev/null +++ b/Crossroads/nodes/(1791,-6,1007).lua @@ -0,0 +1 @@ +F.stn2gen("crch", "11", "L", true, true)
\ No newline at end of file diff --git a/Crossroads/nodes/(1791,-6,1010).lua b/Crossroads/nodes/(1791,-6,1010).lua new file mode 100644 index 0000000..9be00df --- /dev/null +++ b/Crossroads/nodes/(1791,-6,1010).lua @@ -0,0 +1 @@ +F.stn2gen("crch", "12", "R", true, true)
\ No newline at end of file diff --git a/Crossroads/nodes/(2057,-108,1012).lua b/Crossroads/nodes/(2057,-108,1012).lua new file mode 100644 index 0000000..7f2263c --- /dev/null +++ b/Crossroads/nodes/(2057,-108,1012).lua @@ -0,0 +1 @@ +F.stn2gen("crshelter1", "T", "R", true, true)
\ No newline at end of file diff --git a/auto_yards/init_code.lua b/auto_yards/init_code.lua index 92b69bd..0a4312c 100644 --- a/auto_yards/init_code.lua +++ b/auto_yards/init_code.lua @@ -4,39 +4,79 @@ if event.init then S.yards = { --[[ yard info template - yard_id = { + yard_id = { + yard_name = string, active_indicator_pos = POS(), dir_indicator_pos = POS(), error_indicator_pos = POS(), headshunt_max = number, notify = empty table, notify_pos = pos, + + -- reserved vars -- + last_id = string (the id of the last train that entered the yard last) + arrival_length = number + arrival_time = string (RWT) + departure_length = number or "?" (set when train arrives, until train departs) + departure_time = string (RWT) + rts = bool (whether the entering train will exit the way it came in) }, ]]-- TY = { + yard_name = "Trisiston", active_indicator_pos = POS(-4025,14,-2659), dir_indicator_pos = POS(-4025,12,-2665), error_indicator_pos = POS(-4025,13,-2671), headshunt_max = 5, - + notify = {}, + notify_pos = POS(-4023,12,-2660), + arrival_time = rwt.now(), + departure_time = rwt.now() }, BY = { + yard_name = "Banach", active_indicator_pos = POS(-2002,3,-1099), dir_indicator_pos = POS(-2009,3,-1101), error_indicator_pos = POS(-1999,3,-1099), headshunt_max = 5, notify = {}, - notify_pos = POS(-2004,2,-1101) + notify_pos = POS(-2004,2,-1101), + arrival_time = rwt.now(), + departure_time = rwt.now() + }, + ARC = { + yard_name = "Arcadius", + active_indicator_pos = POS(-1952,16,840), + dir_indicator_pos = POS(-1950,16,840), + error_indicator_pos = POS(-1948,16,840), + headshunt_max = 5, + notify = {}, + notify_pos = POS(-1946,16,840), + arrival_time = rwt.now(), + departure_time = rwt.now() }, IP = { + yard_name = "Ipswich", active_indicator_pos = POS(1179,16,3848), dir_indicator_pos = POS(1177,16,3855), error_indicator_pos = POS(1179,16,3850), headshunt_max = 5, notify = {}, - notify_pos = POS(1178,16,3851) - + notify_pos = POS(1178,16,3851), + arrival_time = rwt.now(), + departure_time = rwt.now() }, + CAN = { + yard_name = "Cannery", + active_indicator_pos = POS(-594,26,2486), + dir_indicator_pos = POS(-594,26,2484), + error_indicator_pos = POS(-594,26,2482), + headshunt_max = 2, + --notify = {}, + --notify_pos = POS(-594,26,2485), + arrival_time = rwt.now(), + departure_time = rwt.now() + } -- HY = { -- active_indicator_pos = POS(-4025,14,-2659), -- dir_indicator_pos = POS(-4025,13,-2665), @@ -75,12 +115,12 @@ F.has_rc_match = function(query,rc_list) -- query = pattern string, single entry if not atc_id then return false end if rc_list == "" or query == nil or query=="" then return false end if not rc_list then rc_list = F.get_rc_safe() end - + local rc = {} for v in rc_list:gmatch("("..query..")") do table.insert(rc,v) end - + if rc[1] == true then return true, rc else @@ -102,11 +142,11 @@ F.remove_rc = function(rc_list,arrow_mode) -- rc_list = string eg: "rc1 rc2 rc3" -- true: with arrow direction -- false: against arrow direction -- nil: ignores arrow direction - + if not atc_id then return false end if not rc_list then return false end - - if (arrow_mode == nil) or (atc_arrow == arrow_mode) then + + if (arrow_mode == nil) or (atc_arrow == arrow_mode) then -- prep rc_list to useable format local rc_remove = {} if type(rc_list) == "string" then @@ -118,7 +158,7 @@ F.remove_rc = function(rc_list,arrow_mode) -- rc_list = string eg: "rc1 rc2 rc3" rc_remove[word] = true end end - + -- remove codes from train's rc local rc = F.get_rc_safe() local reinsert = {} @@ -146,7 +186,8 @@ end ---------------------------------------------------------------------------------------------- -- Trackside Functions -F.yard_arrival = function(yard_id,this_dir) -- arrow points towards yard +-- this_dir = points towards Origin/Junction Yard +F.yard_arrival = function(yard_id,this_dir, force_rts) -- arrow points towards yard local yard = S.yards[yard_id] --yard ref if F.has_rc(yard_id.."_NOSHUNT") then return end @@ -160,16 +201,28 @@ F.yard_arrival = function(yard_id,this_dir) -- arrow points towards yard F.indicator(yard.active_indicator_pos,true) F.add_rc({yard_id.."_ARRIVE"}) local rts = false - if F.has_rc(yard_id.."_RTS") then --save the RTS flag as it's removed during the arrival procedure + if force_rts then -- yard is designated as a terminus yard. all trains MUST rts + F.add_rc(yard_id.."_RTS") + rts = true + elseif F.has_rc(yard_id.."_RTS") then --save the RTS flag as it's removed during the arrival procedure F.add_rc({yard_id.."_HAS_RTS"}) rts = true end atc_set_ars_disable(false) atc_send("S6") - - print(rwt.to_string(rwt.now())) - print("YARD "..yard_id..": Train "..atc_id.." enters from the "..tostring(this_dir).." direction and "..((rts and "will") or "won't").." return in the same direction") - print("YARD "..yard_id..": Length "..train_length()) + + S.yards[yard_id].last_id = atc_id + S.yards[yard_id].arrival_length = train_length() + S.yards[yard_id].arrival_time = rwt.now() + S.yards[yard_id].departure_length = "?" + S.yards[yard_id].departure_time = rwt.now() + S.yards[yard_id].rts = rts + + if S.print_debug then + print(rwt.to_string(rwt.now())) + print("YARD "..yard_id..": Train "..atc_id.." enters from the "..tostring(this_dir).." direction and will exit in the "..tostring(rts).." direction") + print("YARD "..yard_id..": Length "..train_length()) + end return end @@ -182,14 +235,16 @@ F.yard_arrival = function(yard_id,this_dir) -- arrow points towards yard if event.train and atc_arrow then if F.indicator(yard.active_indicator_pos) then - print(rwt.to_string(rwt.now())) - print("YARD "..yard_id..": Train "..atc_id.." has arrived and has to wait for the yard to deactivate.") + if S.print_debug then + print(rwt.to_string(rwt.now())) + print("YARD "..yard_id..": Train "..atc_id.." has arrived from the "..tostring(this_dir).." direction and has to wait for the yard to deactivate.") + end schedule_in(";10","recheck") return else enter_yard() return true - end + end end if event.schedule then @@ -208,7 +263,7 @@ F.classification = function(yard_id, this_dir) -- arrow points towards headshunt if not F.indicator(yard.active_indicator_pos) then return end if F.has_rc(yard_id.."_NOSHUNT") then return end - + -- this_dir == true for north end, false for south end if F.indicator(yard.active_indicator_pos) then if atc_arrow then -- loco is at working end @@ -235,8 +290,8 @@ F.classification = function(yard_id, this_dir) -- arrow points towards headshunt F.indicator(yard.dir_indicator_pos,not F.indicator(yard.dir_indicator_pos)) F.remove_rc({yard_id.."_RTS"}) F.add_rc({yard_id.."_AROUND"}) -- send loco around to the other end - atc_set_ars_disable(false) end + atc_set_ars_disable(false) return -- train has departed for headshunt/around end --else train has arrived from wagon count and headshunt/around F.remove_rc({yard_id.."_ARRIVE"}) @@ -262,6 +317,7 @@ F.classification = function(yard_id, this_dir) -- arrow points towards headshunt unset_autocouple() end else -- train entering from the far end. set autocouple so it pushes all the way through to the bounce + atc_set_ars_disable(true) set_autocouple() end end @@ -302,7 +358,7 @@ F.headshunt_yard = function(yard_id,this_dir) -- arrow points toward yard return end end - + --else let train proceed forward to the exit controller without a rake end --else train has already collected rake. let it exit yard else --train has bounced @@ -314,7 +370,7 @@ F.headshunt_yard = function(yard_id,this_dir) -- arrow points toward yard return end --if at wrong end, do nothing. train will follow <yard_id>_AROUND ARS to relevant headshunt end -- if doesn't have <yard_id>_AROUND then let ARS classify the train - + atc_set_ars_disable(false) end return @@ -338,7 +394,7 @@ end F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard local yard = S.yards[yard_id] --yard ref - + __approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) @@ -348,22 +404,25 @@ F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard if not F.indicator(yard.active_indicator_pos) then return end if F.has_rc(yard_id.."_NOSHUNT") then return end - + if event.train then if atc_arrow and (F.indicator(yard.dir_indicator_pos) == this_dir) then if F.has_rc(yard_id.."_DEPART") then - print(rwt.to_string(rwt.now())) - print("YARD "..yard_id..": Train "..atc_id.." has a length of "..train_length()) - print("YARD "..yard_id..": It will depart in the "..tostring(this_dir).." direction.") + if S.print_debug then + print(rwt.to_string(rwt.now())) + print("YARD "..yard_id..": Train "..atc_id.." has a length of "..train_length()) + print("YARD "..yard_id..": It will depart in the "..tostring(this_dir).." direction.") + end + S.yards[yard_id].departure_length = train_length() unset_autocouple() F.remove_rc({yard_id.."_FINAL_COLLECT",yard_id.."_DEPART"}) F.remove_rc_match(yard_id.."_LOCOS_%d+") F.remove_rc_match(yard_id.."_WAGONS_%d+") - + if yard.notify_pos then interrupt_pos(yard.notify_pos,"notify") end - + if F.has_rc(yard_id.."_HAS_RTS") then --reinsert the RTS flag to fully return RC list to starting F.remove_rc(yard_id.."_HAS_RTS") F.add_rc({yard_id.."_RTS"}) @@ -384,8 +443,11 @@ F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard if event.msg == "deactivate_check" then if not atc_id then F.indicator(yard.active_indicator_pos,false) - print(rwt.to_string(rwt.now())) - print("YARD "..yard_id..": yard Disabled") + S.yards[yard_id].departure_time = rwt.now() + if S.print_debug then + print(rwt.to_string(rwt.now())) + print("YARD "..yard_id..": yard Disabled") + end else schedule_in(";05","deactivate_check") return @@ -399,7 +461,7 @@ F.lane_EOL = function(yard_id,this_dir) -- arrow points towards headshunt if not F.indicator(yard.active_indicator_pos) then return end if F.has_rc(yard_id.."_NOSHUNT") then return end - + if atc_arrow then if F.indicator(yard.dir_indicator_pos) == this_dir then --train has bounced and needs to leave the rake or depart with it if F.has_rc(yard_id.."_LAST_CLASS") then -- this is the last clasification move @@ -413,7 +475,7 @@ F.lane_EOL = function(yard_id,this_dir) -- arrow points towards headshunt end --if has FINAL_COLLECT then don't split off the loco. take the full rake F.add_rc({yard_id.."_HEADSHUNT"}) else --train needs to bounce - atc_send("B0WRD1S4") + atc_send("S0WRD1S4") end else if F.indicator(yard.dir_indicator_pos) == this_dir then diff --git a/auto_yards/nodes/(-1908,16,835).lua b/auto_yards/nodes/(-1908,16,835).lua new file mode 100644 index 0000000..89349e3 --- /dev/null +++ b/auto_yards/nodes/(-1908,16,835).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1910,16,837).lua b/auto_yards/nodes/(-1910,16,837).lua new file mode 100644 index 0000000..89349e3 --- /dev/null +++ b/auto_yards/nodes/(-1910,16,837).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1912,16,839).lua b/auto_yards/nodes/(-1912,16,839).lua new file mode 100644 index 0000000..89349e3 --- /dev/null +++ b/auto_yards/nodes/(-1912,16,839).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1925,16,833).lua b/auto_yards/nodes/(-1925,16,833).lua new file mode 100644 index 0000000..2d94f29 --- /dev/null +++ b/auto_yards/nodes/(-1925,16,833).lua @@ -0,0 +1 @@ +F.classification("ARC",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1928,16,834).lua b/auto_yards/nodes/(-1928,16,834).lua new file mode 100644 index 0000000..89349e3 --- /dev/null +++ b/auto_yards/nodes/(-1928,16,834).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1933,16,806).lua b/auto_yards/nodes/(-1933,16,806).lua new file mode 100644 index 0000000..4503e25 --- /dev/null +++ b/auto_yards/nodes/(-1933,16,806).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1933,16,833).lua b/auto_yards/nodes/(-1933,16,833).lua new file mode 100644 index 0000000..89349e3 --- /dev/null +++ b/auto_yards/nodes/(-1933,16,833).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1936,16,834).lua b/auto_yards/nodes/(-1936,16,834).lua new file mode 100644 index 0000000..89349e3 --- /dev/null +++ b/auto_yards/nodes/(-1936,16,834).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1946,16,801).lua b/auto_yards/nodes/(-1946,16,801).lua new file mode 100644 index 0000000..4503e25 --- /dev/null +++ b/auto_yards/nodes/(-1946,16,801).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1947,16,837).lua b/auto_yards/nodes/(-1947,16,837).lua new file mode 100644 index 0000000..f77e28c --- /dev/null +++ b/auto_yards/nodes/(-1947,16,837).lua @@ -0,0 +1,2 @@ +S.yards.ARC.notify = {['ARC_SB'] = true, ['CANNERY'] = true} +print(S.yards.ARC.notify)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1954,16,797).lua b/auto_yards/nodes/(-1954,16,797).lua new file mode 100644 index 0000000..4503e25 --- /dev/null +++ b/auto_yards/nodes/(-1954,16,797).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1957,3,-1059).lua b/auto_yards/nodes/(-1957,3,-1059).lua new file mode 100644 index 0000000..ad61223 --- /dev/null +++ b/auto_yards/nodes/(-1957,3,-1059).lua @@ -0,0 +1 @@ +F.lane_EOL("BY",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1958,16,808).lua b/auto_yards/nodes/(-1958,16,808).lua new file mode 100644 index 0000000..4503e25 --- /dev/null +++ b/auto_yards/nodes/(-1958,16,808).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1959,16,811).lua b/auto_yards/nodes/(-1959,16,811).lua new file mode 100644 index 0000000..4503e25 --- /dev/null +++ b/auto_yards/nodes/(-1959,16,811).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1965,16,793).lua b/auto_yards/nodes/(-1965,16,793).lua new file mode 100644 index 0000000..677ba3a --- /dev/null +++ b/auto_yards/nodes/(-1965,16,793).lua @@ -0,0 +1 @@ +F.classification("ARC",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1966,16,796).lua b/auto_yards/nodes/(-1966,16,796).lua new file mode 100644 index 0000000..4503e25 --- /dev/null +++ b/auto_yards/nodes/(-1966,16,796).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1976,16,782).lua b/auto_yards/nodes/(-1976,16,782).lua new file mode 100644 index 0000000..3c1b64f --- /dev/null +++ b/auto_yards/nodes/(-1976,16,782).lua @@ -0,0 +1 @@ +F.yard_arrival("ARC",false,true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1982,17,780).lua b/auto_yards/nodes/(-1982,17,780).lua new file mode 100644 index 0000000..072f902 --- /dev/null +++ b/auto_yards/nodes/(-1982,17,780).lua @@ -0,0 +1,51 @@ +local yard_id = "ARC" + + +if event.train then + if F.has_rc("ARC_LIGHT_EXIT") then return end + if F.has_rc("ARC_NOSHUNT") then return end + + if train_length() == 1 then -- eliminates near half the trains + if F.has_rc("ARC_LOCOSTORE") then -- specifies only the relevant train + if F.has_rc("ARC_DEPART") and F.has_rc("ARC_FINAL_COLLECT") and F.has_rc("ARC_HEADSHUNT") then --only activate if train is set to depart anyway + if not atc_arrow then -- train is pointing towards exit. let it pass and the reverse it + atc_set_ars_disable(true) + schedule_in(";01",atc_id) -- prepare to reverse the train + return + else --train has reversed. send it to the siding and deactivate the yard + F.remove_rc({"ARC_DEPART","ARC_FINAL_COLLECT"}) + F.add_rc("ARC_send_to_locostore") + atc_set_ars_disable(false) + F.indicator(S.yards[yard_id].active_indicator_pos, false) + S.yards[yard_id].departure_time = rwt.now() + S.yards[yard_id].departure_length = S.yards[yard_id].arrival_length + + if S.yards[yard_id].notify_pos then + interrupt_pos(S.yards[yard_id].notify_pos,"notify") + end + return + end + end + end + end +end + +if event.schedule then --this is a duplicate of the reversing schedule in the env anyway + if not atc_id then --bounce the train that just passed + atc_send_to_train(event.msg,"B0WRD1A1S3") + else + if atc_id == event.msg then --train hasn't fully passed yet, wait a bit longer + schedule_in(";01",atc_id) + else -- somehow another train crossed the controller before the first one returned. Unlikely but possible + atc_send_to_train(event.msg,"BBOL") + atc_send("BBOL") + F.indicator(yard.error_indicator_pos,true) + end + end + return +end + + + +-- if all else fails, do a normal headshunt_yard function +F.headshunt_yard("ARC",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-2004,2,-1101).lua b/auto_yards/nodes/(-2004,2,-1101).lua index b686f37..c0d57ae 100644 --- a/auto_yards/nodes/(-2004,2,-1101).lua +++ b/auto_yards/nodes/(-2004,2,-1101).lua @@ -1,13 +1,25 @@ local yard_id = "BY" + +if not S.yards[yard_id].notify then return end + local subs = { - ['S27'] = POS(-1512,8,-2613), +--[[ + A list of FC subscribers to send out notifications for. + Each entry must have a coresponding Lua Track / Operators Panel to trigger (using event.ext_int) + Used to alert a shunter locomotive or other yard that there's wagons available to collect from this yard. +]]-- + + ['ARC'] = {['pos'] = POS(-1973,16,800), ['msg'] = "notify"}, } if event.ext_int or event.punch then - for fc, pos in pairs(subs) do + local list = "Notify: " + for fc, sub in pairs(subs) do if S.yards[yard_id].notify[fc] then - interrupt_pos(pos,"notify") + interrupt_pos(sub.pos,sub.msg or "notify") + list = list .. fc .. ", " end end + digiline_send("lcd",list) S.yards[yard_id].notify = {} end diff --git a/auto_yards/nodes/(-2029,19,733).lua b/auto_yards/nodes/(-2029,19,733).lua new file mode 100644 index 0000000..2672033 --- /dev/null +++ b/auto_yards/nodes/(-2029,19,733).lua @@ -0,0 +1,10 @@ +local yard_id = "ARC" +if event.train then + if F.has_rc(yard_id.."_LIGHT_EXIT") then + F.remove_rc(yard_id.."_LIGHT_EXIT") + atc_set_ars_disable(false) + atc_send("SM") + return + end +end +F.headshunt_exit(yard_id,true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-2030,3,-1091).lua b/auto_yards/nodes/(-2030,3,-1091).lua new file mode 100644 index 0000000..cbce1da --- /dev/null +++ b/auto_yards/nodes/(-2030,3,-1091).lua @@ -0,0 +1 @@ +F.lane_EOL("BY",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-2038,20,730).lua b/auto_yards/nodes/(-2038,20,730).lua new file mode 100644 index 0000000..a790746 --- /dev/null +++ b/auto_yards/nodes/(-2038,20,730).lua @@ -0,0 +1,6 @@ +local yard_id = "ARC" +if event.digiline and event.channel=="yard_ctl" and event.msg=="disable" then + F.indicator(S.yards[yard_id].active_indicator_pos, false) + S.yards[yard_id].departure_time = rwt.now() + S.yards[yard_id].departure_length = S.yards[yard_id].arrival_length +end
\ No newline at end of file diff --git a/auto_yards/nodes/(-4023,12,-2660).lua b/auto_yards/nodes/(-4023,12,-2660).lua new file mode 100644 index 0000000..9d743b7 --- /dev/null +++ b/auto_yards/nodes/(-4023,12,-2660).lua @@ -0,0 +1,16 @@ +local yard_id = "TY" +local subs = { +-- ['MMF'] = {['pos'] = POS(1,2,3), ['msg'] = "notify"}, +} + +if event.ext_int or event.punch then + local list = "Notify: " + for fc, sub in pairs(subs) do + if S.yards[yard_id].notify[fc] then + interrupt_pos(sub.pos,sub.msg or "notify") + list = list .. fc .. ", " + end + end + digiline_send("lcd",list) + S.yards[yard_id].notify = {} +end
\ No newline at end of file diff --git a/auto_yards/nodes/(-513,26,2455).lua b/auto_yards/nodes/(-513,26,2455).lua new file mode 100644 index 0000000..14a78ea --- /dev/null +++ b/auto_yards/nodes/(-513,26,2455).lua @@ -0,0 +1,2 @@ +-- hs-exit +F.headshunt_exit("CAN",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-522,26,2469).lua b/auto_yards/nodes/(-522,26,2469).lua new file mode 100644 index 0000000..59df437 --- /dev/null +++ b/auto_yards/nodes/(-522,26,2469).lua @@ -0,0 +1,2 @@ +-- hs-yard +F.headshunt_yard("CAN",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-528,26,2475).lua b/auto_yards/nodes/(-528,26,2475).lua new file mode 100644 index 0000000..bb8ce55 --- /dev/null +++ b/auto_yards/nodes/(-528,26,2475).lua @@ -0,0 +1,2 @@ +-- arrival +F.yard_arrival("CAN",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-574,26,2469).lua b/auto_yards/nodes/(-574,26,2469).lua new file mode 100644 index 0000000..74a7624 --- /dev/null +++ b/auto_yards/nodes/(-574,26,2469).lua @@ -0,0 +1,2 @@ +-- EOL +F.lane_EOL("CAN",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-575,26,2465).lua b/auto_yards/nodes/(-575,26,2465).lua new file mode 100644 index 0000000..74a7624 --- /dev/null +++ b/auto_yards/nodes/(-575,26,2465).lua @@ -0,0 +1,2 @@ +-- EOL +F.lane_EOL("CAN",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-594,26,2485).lua b/auto_yards/nodes/(-594,26,2485).lua new file mode 100644 index 0000000..270750f --- /dev/null +++ b/auto_yards/nodes/(-594,26,2485).lua @@ -0,0 +1,28 @@ +local yard_id = "CAN" + +if not S.yards[yard_id].notify then return end + +local subs = { +--[[ + A list of FC subscribers to send out notifications for. + Each entry must have a coresponding Lua Track / Operators Panel to trigger (using event.ext_int) + Used to alert a shunter locomotive or other yard that there's wagons available to collect from this yard. +]]-- + + ['ARC'] = {['pos'] = POS(-630,26,2454), ['msg'] = "notify"}, --send the CAN loco to collect from ARC, then return and deliver here for ARC + ['CORN'] = {['pos'] = POS(-630,26,2454), ['msg'] = "shuffle"} -- consolidate wagons to the departure track + ['BOTTLES'] = {['pos'] = POS(-630,26,2454), ['msg'] = "shuffle"} -- consolidate wagons to the departure track + ['ETHANOL'] = {['pos'] = POS(-630,26,2454), ['msg'] = "shuffle"} -- consolidate wagons to the departure track +} + +if event.ext_int or event.punch then + local list = "Notify: " + for fc, sub in pairs(subs) do + if S.yards[yard_id].notify[fc] then + interrupt_pos(sub.pos,sub.msg or "notify") + list = list .. fc .. ", " + end + end + digiline_send("lcd",list) + S.yards[yard_id].notify = {} +end
\ No newline at end of file diff --git a/auto_yards/nodes/(-604,26,2469).lua b/auto_yards/nodes/(-604,26,2469).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/auto_yards/nodes/(-604,26,2469).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/auto_yards/nodes/(-614,26,2469).lua b/auto_yards/nodes/(-614,26,2469).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/auto_yards/nodes/(-614,26,2469).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/auto_yards/nodes/(-623,26,2469).lua b/auto_yards/nodes/(-623,26,2469).lua new file mode 100644 index 0000000..46e3050 --- /dev/null +++ b/auto_yards/nodes/(-623,26,2469).lua @@ -0,0 +1,2 @@ +-- EOL +F.lane_EOL("CAN",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-623,26,2472).lua b/auto_yards/nodes/(-623,26,2472).lua new file mode 100644 index 0000000..46e3050 --- /dev/null +++ b/auto_yards/nodes/(-623,26,2472).lua @@ -0,0 +1,2 @@ +-- EOL +F.lane_EOL("CAN",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-623,26,2475).lua b/auto_yards/nodes/(-623,26,2475).lua new file mode 100644 index 0000000..f919bc0 --- /dev/null +++ b/auto_yards/nodes/(-623,26,2475).lua @@ -0,0 +1,2 @@ +-- class +F.classification("CAN",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-630,26,2454).lua b/auto_yards/nodes/(-630,26,2454).lua new file mode 100644 index 0000000..e01fb60 --- /dev/null +++ b/auto_yards/nodes/(-630,26,2454).lua @@ -0,0 +1,73 @@ +local notification_id = "CAN" +local ind = POS(-594,26,2488) +local shuffle_ind = POS(-594,26,2487) +local print_notification = true +local function send_train() + set_rc("FREIGHT CAN_LOCOSTORE CAN_LIGHT_EXIT EWL-W EWL S23 ARCAUTO ARC_RTS ARC_COLLECT_CANNERY ARC_AUTO_S23N CANNERY CAN_RTS CAN_COLLECT_ARC") + atc_send("S0WRD2A1S4") + F.indicator(ind,false) +end + +local function shuffle_wagons() + F.indicator(S.yards[notification_id].active_indicator_pos, true) --stop other trains entering the yard + F.indicator(S.yards[notification_id].dir_indicator_pos,true) + F.indicator(shuffle_ind,false) + F.indicator(ind,true) + S.yards[notification_id].shuffle_stage = 1 -- set a shuffle stage counter + set_rc("CAN_LOCOSTORE CAN_SHUFFLE") + atc_send("S0WRD2A1S4") --send train to headshunt + return +end + +if event.ext_int then + if event.message == "notify" then + if print_notification then print(rwt.to_string(rwt.now()).. " "..notification_id.." RX Notification") end + if F.indicator(ind) then return end + if atc_id then + send_train() + return + else + F.indicator(ind,true) + return + end + elseif event.message == "shuffle" then + if atc_id then + if not F.indicator(S.yards[notification_id].active_indicator_pos) then + shuffle_wagons() + return + end + schedule_in(":05","shuffle") + return + else + F.indicator(shuffle_ind,true) + return + end + end + return +end + +if event.schedule then + if event.message=="shuffle" then + if not F.idicator(S.yards[notification_id].active_indicator_pos) then + shuffle_wagons() + return + end + schedule_in(":05","shuffle") + return + end + return +end + +if event.train then + unset_autocouple() + if F.indicator(shuffle_ind) then + shuffle_wagons() + return + end + if F.indicator(ind) then + send_train() + return + end + atc_send("B0") + return +end
\ No newline at end of file diff --git a/auto_yards/nodes/(-633,26,2456).lua b/auto_yards/nodes/(-633,26,2456).lua new file mode 100644 index 0000000..8dc117b --- /dev/null +++ b/auto_yards/nodes/(-633,26,2456).lua @@ -0,0 +1,4 @@ +if event.punch then + F.indicator(S.yards.CAN.active_indicator_pos,false) + interrupt_pos(POS(-630,26,2454),"shuffle") +end
\ No newline at end of file diff --git a/auto_yards/nodes/(-643,26,2475).lua b/auto_yards/nodes/(-643,26,2475).lua new file mode 100644 index 0000000..1523fcd --- /dev/null +++ b/auto_yards/nodes/(-643,26,2475).lua @@ -0,0 +1,83 @@ +local yard_id = "CAN" + + +if event.train then + if F.has_rc(yard_id.."_LIGHT_EXIT") then return end + if F.has_rc(yard_id.."_NOSHUNT") then return end + + if F.has_rc("CAN_SHUFFLE") then -- train is consolidating wagons for export to ARC + if not atc_arrow then + schedule_in(";01",atc_id) -- prepare to reverse the train + return + end + print(F.get_rc_safe()) + F.remove_rc_match("CAN_CLASS_%S+") + F.remove_rc_match("CAN_COLLECT_%S+") + F.remove_rc("CAN_PICKUP CAN_HEADSHUNT CAN_FINAL_COLLECT") + local stage_list = { + "CAN_CLASS_ETHANOL CAN_COLLECT_ETHANOL CAN_FINAL_COLLECT", + "CAN_CLASS_ARC", + "CAN_CLASS_CORN CAN_COLLECT_CORN CAN_FINAL_COLLECT", + "CAN_CLASS_ARC", + "CAN_send_to_locostore" + } + F.add_rc(stage_list[S.yards[yard_id].shuffle_stage]) + print(F.get_rc_safe()) + print(S.yards[yard_id].shuffle_stage) + set_autocouple() + atc_set_ars_disable(false) + + if S.yards[yard_id].shuffle_stage == #stage_list then -- loco is returning to storage. release the yard + F.indicator(S.yards[yard_id].active_indicator_pos,false) + S.yards[yard_id].notify.ARC = true + interrupt_pos(S.yards[yard_id].notify_pos) + else + S.yards[yard_id].shuffle_stage = S.yards[yard_id].shuffle_stage + 1 + end + return + end + + if train_length() == 1 then -- eliminates near half the trains + if F.has_rc(yard_id.."_LOCOSTORE") then -- specifies only the relevant train + if F.has_rc(yard_id.."_DEPART") and F.has_rc(yard_id.."_FINAL_COLLECT") and F.has_rc(yard_id.."_HEADSHUNT") then --only activate if train is set to depart anyway + if not atc_arrow then -- train is pointing towards exit. let it pass and the reverse it + atc_set_ars_disable(true) + schedule_in(";01",atc_id) -- prepare to reverse the train + return + else --train has reversed. send it to the siding and deactivate the yard + F.remove_rc({yard_id.."_DEPART",yard_id.."_FINAL_COLLECT"}) + F.add_rc(yard_id.."_send_to_locostore") + atc_set_ars_disable(false) + F.indicator(S.yards[yard_id].active_indicator_pos, false) + S.yards[yard_id].departure_time = rwt.now() + S.yards[yard_id].departure_length = S.yards[yard_id].arrival_length + + if S.yards[yard_id].notify_pos then + interrupt_pos(S.yards[yard_id].notify_pos,"notify") + end + return + end + end + end + end +end + +if event.schedule then --this is a duplicate of the reversing schedule in the env anyway + if not atc_id then --bounce the train that just passed + atc_send_to_train(event.msg,"B0WRD1A1S3") + else + if atc_id == event.msg then --train hasn't fully passed yet, wait a bit longer + schedule_in(";01",atc_id) + else -- somehow another train crossed the controller before the first one returned. Unlikely but possible + atc_send_to_train(event.msg,"BBOL") + atc_send("BBOL") + F.indicator(yard.error_indicator_pos,true) + end + end + return +end + + + +-- if all else fails, do a normal headshunt_yard function +F.headshunt_yard(yard_id,true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-668,20,2478).lua b/auto_yards/nodes/(-668,20,2478).lua new file mode 100644 index 0000000..7c582c0 --- /dev/null +++ b/auto_yards/nodes/(-668,20,2478).lua @@ -0,0 +1,3 @@ +-- arrival +if not F.has_rc("CANNERY") then return end +F.yard_arrival("CAN",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(1178,16,3851).lua b/auto_yards/nodes/(1178,16,3851).lua index 35047d5..6d126c4 100644 --- a/auto_yards/nodes/(1178,16,3851).lua +++ b/auto_yards/nodes/(1178,16,3851).lua @@ -1,13 +1,16 @@ local yard_id = "IP" local subs = { - ['WOA_mine_empty'] = POS(1949,7,9112), + ['WOA_mine_empty'] = {['pos'] = POS(1949,7,9112), ['msg'] = "notify"}, } if event.ext_int or event.punch then - for fc, pos in pairs(subs) do + local list = "Notify: " + for fc, sub in pairs(subs) do if S.yards[yard_id].notify[fc] then - interrupt_pos(pos,"notify") + interrupt_pos(sub.pos,sub.msg or "notify") + list = list .. fc .. ", " end end + digiline_send("lcd",list) S.yards[yard_id].notify = {} -end +end
\ No newline at end of file diff --git a/auto_yards/nodes/(417,17,4).lua b/auto_yards/nodes/(417,17,4).lua new file mode 100644 index 0000000..b634cde --- /dev/null +++ b/auto_yards/nodes/(417,17,4).lua @@ -0,0 +1,62 @@ +if event.channel=="clock" then + local yard_id = event.msg + local info = S.yards[yard_id] + digiline_send("rwt_clock","Rwt Now:\n"..rwt.to_string(rwt.now())) + + if not S.yards[yard_id] then + digiline_send(yard_id.."_1",yard_id.." -- Not In Service") + digiline_send(yard_id.."_2"," ") + digiline_send(yard_id.."_NOTIFY"," ") + return + end + + local function getN(t) + local count = 0 + for _ in pairs(t) do + count = count+1 + end + return count + end + + + local txt = {} + local txt2 = {} + txt[#txt+1] = yard_id.." --"..info.yard_name.." Yard--" + txt[#txt+1] = "Active: " .. tostring(F.indicator(info.active_indicator_pos)) + + txt[#txt+1] = "Direction: " .. tostring(F.indicator(info.dir_indicator_pos)) + txt[#txt+1] = "Last Train: " .. tostring(info.last_id).." ("..tostring(info.arrival_length).."-"..tostring(info.departure_length)..")" + txt2[#txt2+1] = "Time: "..tostring(rwt.to_string(info.arrival_time)).."+"..tostring(rwt.to_string(rwt.diff(info.arrival_time,info.departure_time))) + digiline_send(yard_id.."_1",table.concat(txt,"\n")) + + + + + txt2[#txt2+1] = "RTS: "..tostring(info.rts) + txt2[#txt2+1] = "Error: ".. tostring(F.indicator(info.error_indicator_pos)) + txt2[#txt2+1] = "" + digiline_send(yard_id.."_2",table.concat(txt2,"\n")) + + local notifications = "" + if info.notify then + local nt = "" + if getN(info.notify) > 0 then + nt = "Notify: " + for k in pairs(info.notify) do + nt = nt..k..", " + end + else + nt = "Notify: No Notifications" + end + + local st_len = 26 + if nt:len() > st_len then + nt = nt:sub(1,st_len).."\n"..nt:sub(st_len+1) + end + notifications = nt + else + notifications = "Notify: Not Enabled" + end + digiline_send(yard_id.."_NOTIFY",notifications) + return +end
\ No newline at end of file diff --git a/auto_yards/nodes/(417,18,4).lua b/auto_yards/nodes/(417,18,4).lua new file mode 100644 index 0000000..48ef9b8 --- /dev/null +++ b/auto_yards/nodes/(417,18,4).lua @@ -0,0 +1,3 @@ +if event.channel ~= "debug_switch" then return end +S.print_debug = event.msg +print("Print Debug: "..tostring(S.print_debug))
\ No newline at end of file diff --git a/durt/nodes/(-1373,10,-2507).lua b/durt/nodes/(-1373,10,-2507).lua index 7489acc..450ca4a 100644 --- a/durt/nodes/(-1373,10,-2507).lua +++ b/durt/nodes/(-1373,10,-2507).lua @@ -1 +1,5 @@ ---
\ No newline at end of file +if atc_arrow and F.has_rc("S27_EXP_EXIT") then + F.remove_rc("S27_EXP_EXIT") + atc_send("D10SM") + return +end
\ No newline at end of file diff --git a/durt/nodes/(-1433,11,-2563).lua b/durt/nodes/(-1433,11,-2563).lua new file mode 100644 index 0000000..7ac821e --- /dev/null +++ b/durt/nodes/(-1433,11,-2563).lua @@ -0,0 +1,25 @@ +__approach_callback_mode = 1 + +if event.approach and not event.has_entered then + atc_set_ars_disable(true) + atc_set_lzb_tsr(1) + return +end + +if event.train and atc_arrow then + if not F.has_rc("S27_EXP_WAIT") then + atc_set_ars_disable(false) + return + end + atc_send("S0") + return +end + +if event.ext_int and atc_id then + F.remove_rc("S27_REV_West S27_EXP_WAIT") + F.add_rc("S27_REV_East S27_EXP_DEPART") + atc_send("S3") + atc_set_ars_disable(false) + set_autocouple() + return +end
\ No newline at end of file diff --git a/durt/nodes/(-1442,11,-2568).lua b/durt/nodes/(-1442,11,-2568).lua new file mode 100644 index 0000000..6888f6b --- /dev/null +++ b/durt/nodes/(-1442,11,-2568).lua @@ -0,0 +1,17 @@ +local ind = POS(-1444,10,-2546) +if event.train and atc_arrow then + if not F.has_rc("S27_SHUNTER") then + step_fc() + split_off_locomotive("BBA0") + F.add_rc("S27_REV_West S27_EXP_WAIT S27_EXP_COLLECT") + F.indicator(ind,true) + return + end + unset_autocouple() + atc_send("A0BB") + if train_length() > 2 then -- if length > 2 it would try to discouple the nose + split_at_index(train_length()-1,"BBWRD2S3A1") + return + end + atc_send("BBWRD2S3A1") +end
\ No newline at end of file diff --git a/durt/nodes/(-1444,11,-2546).lua b/durt/nodes/(-1444,11,-2546).lua new file mode 100644 index 0000000..235e7d3 --- /dev/null +++ b/durt/nodes/(-1444,11,-2546).lua @@ -0,0 +1,24 @@ +local ind = POS(-1444,10,-2546) +local function send_train() + set_rc("S27_SHUNTER S27_REV_East S27") + atc_send("S0WRD2A1S4") + F.indicator(ind,false) +end +if event.ext_int then + if F.indicator(ind) then return end + if atc_id then + send_train() + return + else + F.indicator(ind,true) + return + end +end +if event.train then + if F.indicator(ind) then + send_train() + return + end + atc_send("B0") + return +end
\ No newline at end of file diff --git a/durt/nodes/(-1446,11,-2568).lua b/durt/nodes/(-1446,11,-2568).lua new file mode 100644 index 0000000..bca38cc --- /dev/null +++ b/durt/nodes/(-1446,11,-2568).lua @@ -0,0 +1,7 @@ +if event.train and atc_arrow then + if not F.has_rc("S27_SHUNTER") then return end + atc_reset() + atc_set_ars_disable(true) + atc_send("BB") + split_at_index(train_length(),"S0WRD1S3A1") +end
\ No newline at end of file diff --git a/durt/nodes/(-1457,11,-2573).lua b/durt/nodes/(-1457,11,-2573).lua index 7489acc..8f984b2 100644 --- a/durt/nodes/(-1457,11,-2573).lua +++ b/durt/nodes/(-1457,11,-2573).lua @@ -1 +1,34 @@ ---
\ No newline at end of file +local rev_rc = "S27_REV_West" +local rm_rc = false + + +__approach_callback_mode = 1 + +if event.approach and not event.has_entered then + atc_set_lzb_tsr(1) + atc_set_ars_disable(true) + return +end + +if event.train and atc_arrow then + if not F.has_rc(rev_rc) then + atc_set_ars_disable(false) + return + end + if rm_rc then F.remove_rc({rev_rc}) end + schedule_in(";01",atc_id) + return +end + +if event.schedule then + if not atc_id then --bounce the train that just passed + atc_send_to_train(event.msg,"B0WRD1A1S3") + else + if atc_id == event.msg then --train hasn't fully passed yet, wait a bit longer + schedule_in(";01",atc_id) + else -- somehow another train crossed the controller before the first one returned. Unlikely but possible + atc_send_to_train(event.msg,"BBOL") + atc_send("BBOL") + end + end +end
\ No newline at end of file diff --git a/durt/nodes/(-1468,11,-2561).lua b/durt/nodes/(-1468,11,-2561).lua new file mode 100644 index 0000000..df410b9 --- /dev/null +++ b/durt/nodes/(-1468,11,-2561).lua @@ -0,0 +1,5 @@ +if event.train and atc_arrow then + F.remove_rc({"S27_slag_shed"}) + F.add_rc({"S27_main_yard"}) + atc_send("A0S0WRD50S3A1") +end diff --git a/durt/nodes/(-1515,7,-2621).lua b/durt/nodes/(-1515,7,-2621).lua new file mode 100644 index 0000000..0abb68d --- /dev/null +++ b/durt/nodes/(-1515,7,-2621).lua @@ -0,0 +1,5 @@ +if event.train and atc_arrow then + F.remove_rc({"S27_main_yard"}) + F.add_rc({"S27_slag_shed"}) + atc_send("A0S0WRD100S3A1") +end diff --git a/durt/nodes/(-1515,7,-2625).lua b/durt/nodes/(-1515,7,-2625).lua index c12db21..2fd2155 100644 --- a/durt/nodes/(-1515,7,-2625).lua +++ b/durt/nodes/(-1515,7,-2625).lua @@ -1,17 +1,29 @@ +local notification_id = "S27" local ind = POS(-1513,8,-2613) +local print_notification = true local function send_train() - set_rc("FREIGHT S23 TanhX_NBS23toE3 BYARD BY_COLLECT_S27 MGGRatHYARD S27 S27_UNLOAD S27_Overburden BY_RTS S27_EXIT") + set_rc("FREIGHT S23 ARCAUTO ARC_RTS ARC_COLLECT_S27 ARC_AUTO_S23S TanhX_SBS23toE3 MGGRatHYARD S27 S27_UNLOAD S27_Overburden S27_EXIT") atc_send("S0WRD2A1S4") - set_route(POS(-1504,8,-2622),"Through to Lead") F.indicator(ind,false) end -if event.ext_int and atc_id then - send_train() +if event.ext_int then + if event.message == "notify" then + if print_notification then print(rwt.to_string(rwt.now()) .. " "..notification_id.." RX Notification") end + if F.indicator(ind) then return end + if atc_id then + send_train() + return + else + F.indicator(ind,true) + return + end + end end - if event.train then if F.indicator(ind) then send_train() + return end + atc_send("B0") return end
\ No newline at end of file diff --git a/durt/nodes/(-2120,21,869).lua b/durt/nodes/(-2120,21,869).lua new file mode 100644 index 0000000..b9831ee --- /dev/null +++ b/durt/nodes/(-2120,21,869).lua @@ -0,0 +1,5 @@ +-- +if event.train and atc_arrow and get_line() == "S20" then + local current_text = atc_get_text_outside() or "" + atc_set_text_outside("Service Ends At Arcadius\n No Access to Trap City\n \n"..current_text) +end
\ No newline at end of file diff --git a/durt/nodes/(-2141,21,865).lua b/durt/nodes/(-2141,21,865).lua new file mode 100644 index 0000000..2750c52 --- /dev/null +++ b/durt/nodes/(-2141,21,865).lua @@ -0,0 +1,3 @@ +if event.train and atc_arrow and get_line() == "S20" then + atc_set_text_outside("S20 - Euler Street <-> Trap City") +end
\ No newline at end of file diff --git a/durt/nodes/(-4129,13,-5726).lua b/durt/nodes/(-4129,13,-5726).lua index d5aa4b1..2f179db 100644 --- a/durt/nodes/(-4129,13,-5726).lua +++ b/durt/nodes/(-4129,13,-5726).lua @@ -13,7 +13,6 @@ if event.train then atc_send("CplD1S2") return end - atc_send("B4") end end diff --git a/durt/nodes/(-4224,18,-5973).lua b/durt/nodes/(-4224,18,-5973).lua new file mode 100644 index 0000000..8f6490a --- /dev/null +++ b/durt/nodes/(-4224,18,-5973).lua @@ -0,0 +1,11 @@ +if not F.has_rc("CORN_SHUNT") then return end +if not F.has_rc("CORN_rejoin") then + F.add_rc("CORN_rejoin") + split_off_locomotive("S0A0") + F.add_rc("CORN_HS_S CORN_AROUND CORN_HS_N") + return +else + F.remove_rc("CORN_rejoin") + F.add_rc("CORN_HS_S") + unset_autocouple() +end
\ No newline at end of file diff --git a/durt/nodes/(-4224,18,-5985).lua b/durt/nodes/(-4224,18,-5985).lua new file mode 100644 index 0000000..aacd93f --- /dev/null +++ b/durt/nodes/(-4224,18,-5985).lua @@ -0,0 +1,41 @@ +local rev_rc = "CORN_HS_S" +local rm_rc = true + + +__approach_callback_mode = 1 + +if event.approach and not event.has_entered then + atc_set_lzb_tsr(3) + atc_set_ars_disable(true) + return +end + +if event.train then + if atc_arrow then + if not F.has_rc(rev_rc) then + atc_set_ars_disable(false) + return + end + if rm_rc then F.remove_rc(rev_rc) end + schedule_in(";01",atc_id) + return + else + if not F.has_rc("CORN_rejoin") then + F.add_rc("CORN_EXIT") + end + return + end +end + +if event.schedule then + if not atc_id then --bounce the train that just passed + atc_send_to_train(event.msg,"B0WRD1A1S3") + else + if atc_id == event.msg then --train hasn't fully passed yet, wait a bit longer + schedule_in(";01",atc_id) + else -- somehow another train crossed the controller before the first one returned. Unlikely but possible + atc_send_to_train(event.msg,"BBOL") + atc_send("BBOL") + end + end +end
\ No newline at end of file diff --git a/durt/nodes/(-4227,18,-5926).lua b/durt/nodes/(-4227,18,-5926).lua new file mode 100644 index 0000000..b640ec9 --- /dev/null +++ b/durt/nodes/(-4227,18,-5926).lua @@ -0,0 +1,41 @@ +local rev_rc = "CORN_HS_N" +local rm_rc = true + + +__approach_callback_mode = 1 + +if event.approach and not event.has_entered then + atc_set_lzb_tsr(3) + atc_set_ars_disable(true) + return +end + +if event.train then + if atc_arrow then + if not F.has_rc(rev_rc) then + atc_set_ars_disable(false) + return + end + if rm_rc then F.remove_rc(rev_rc) end + schedule_in(";01",atc_id) + return + else + if F.has_rc("CORN_rejoin") then + set_autocouple() + end + return + end +end + +if event.schedule then + if not atc_id then --bounce the train that just passed + atc_send_to_train(event.msg,"B0WRD1A1S3") + else + if atc_id == event.msg then --train hasn't fully passed yet, wait a bit longer + schedule_in(";01",atc_id) + else -- somehow another train crossed the controller before the first one returned. Unlikely but possible + atc_send_to_train(event.msg,"BBOL") + atc_send("BBOL") + end + end +end
\ No newline at end of file diff --git a/durt/nodes/(-4227,18,-5936).lua b/durt/nodes/(-4227,18,-5936).lua new file mode 100644 index 0000000..b11f8a1 --- /dev/null +++ b/durt/nodes/(-4227,18,-5936).lua @@ -0,0 +1,7 @@ +if not F.has_rc("CORN_SHUNT") then return end +if not atc_arrow then return end +if F.has_rc("CORN_EXIT") then + F.remove_rc("CORN_EXIT CORN_AROUND") + atc_send("D10SM") + return +end
\ No newline at end of file diff --git a/durt/nodes/(1906,7,9136).lua b/durt/nodes/(1906,7,9136).lua index 03ae1a0..f83e4fc 100644 --- a/durt/nodes/(1906,7,9136).lua +++ b/durt/nodes/(1906,7,9136).lua @@ -16,7 +16,7 @@ if event.approach and not event.has_entered then end if event.train and atc_arrow then - digiline_send("mine_counter_lcd",S.yards.WOA.mine_counter) + digiline_send("mine_counter_lcd",S.yards.WOA.mine_count) if F.has_rc("WOA_mine_around") then if F.has_rc("WOA_around_active") then F.remove_rc(around_rc_list) diff --git a/durt/nodes/(1907,0,9142).lua b/durt/nodes/(1907,0,9142).lua new file mode 100644 index 0000000..0a2edad --- /dev/null +++ b/durt/nodes/(1907,0,9142).lua @@ -0,0 +1,5 @@ +if event.channel=="auth" then + S.yards.WOA.mine_count = 0 + print("WOA Mine: reset counter") + digiline_send("train_ctl","send") +end
\ No newline at end of file diff --git a/durt/nodes/(1907,8,9129).lua b/durt/nodes/(1907,8,9129).lua new file mode 100644 index 0000000..b18ad84 --- /dev/null +++ b/durt/nodes/(1907,8,9129).lua @@ -0,0 +1,3 @@ +if event.punch then + digiline_send("mine_counter_lcd",tostring(S.yards.WOA.mine_count)) +end
\ No newline at end of file diff --git a/durt/nodes/(1949,7,9112).lua b/durt/nodes/(1949,7,9112).lua index 8fd61c9..164a253 100644 --- a/durt/nodes/(1949,7,9112).lua +++ b/durt/nodes/(1949,7,9112).lua @@ -14,7 +14,7 @@ if event.train and atc_arrow then end if (event.ext_int and event.message == "notify") or (event.schedule and event.message == "send") or (event.channel=="train_ctl" and event.msg=="send") then - print("WOA RX Notification") + print(rwt.to_string(rwt.now()) .. " WOA RX Notification") if not atc_id then F.indicator(ind,true) return diff --git a/ers/init_code.lua b/ers/init_code.lua index 4fe8b87..18cdbc9 100644 --- a/ers/init_code.lua +++ b/ers/init_code.lua @@ -1,91 +1,623 @@ -- environment_ers.lua -F.debug = true +if S.trains == nil then S.trains = {} end +if S.train_duration == nil then S.train_duration = {} end +if S.yards == nil then S.yards = {} end -F.isempty = function (s) - return s == nil or s == '' +F.known_rcs = { + ["LILSHUNTER"] = "LILSHUNTER", + ["CRYSTAL"] = "CRYSTAL", + ["DEPOTUNLOADING"] = "DEPOTUNLOADING", + ["ERSBALLASTLOAD"] = "ERSBALLASTLOAD", + ["CORNUNLOAD"] = "CORNUNLOAD", + ["MEGACORNLOAD"] = "MEGACORNLOAD", + ["XERXES"] = "XERXES", + ["BLOCK"] = "BLOCK", + ["FERTILIZER"] = "FERTILIZER", + ["FERTRUNNER"] = "FERTRUNNER", + ["MULCH"] = "MULCH", + ["ERSTAZIDEPOTUNLOAD"] = "ERSTAZIDEPOTUNLOAD", + ["ERSTAZIDEPOT"] = "ERSTAZIDEPOT", + ["ERSSINENSISDEPOT"] = "ERSSINENSISDEPOT", + ["ERSTAZITST"] = "ERSTAZITST", + ["FACTORY"] = "FACTORY", + ["OILEXTRACT"] = "OILEXTRACT", + ["SHUNT04A"] = "SHUNT04A", + ["ERSTAZISHOP"] = "ERSTAZISHOP", + ["TYARD"] = "TYARD", + ["TY_COLLECT_SINESIS"] = "TY_COLLECT_SINESIS", + ["TY_RTS"] = "TY_RTS", +} + +F.print = function (str) if F.debug then print("".. (str or "nil") ) end end +F.isempty = function (s) return s == nil or s == "" end +F.get_rc_safe = function() return get_rc() or "" end +F.get_line_safe = function() return get_line() or "" end +F.get_train_length_safe = function() return train_length() or 0 end +F.avg = function(t) + local sum = 0 + local count = 0 + for k,v in pairs(t) do + if type(v) == "number" then + sum = sum + v + count = count + 1 + end + end + return (sum / count) +end + +if event.init then + F.debug = true + F.max_displays = 52 + F.print("Initialized") +end + +F.clear_main_depot_displays = function() for i = 1, F.max_displays, 1 do digiline_send("train_display" .. i, " ") end end + +--[[ + EXAMPLE: F.has_rc("LILSHUNTER", F.get_rc_safe() ) + Merged F.has_rc and F.does_train_have_rc + F.does_train_have_rc is deprecated +]] +F.has_rc = function(query,rc_list) -- query = string, single entry + for word in rc_list:gmatch("[^%s]+") do + if word == query then return true end + end + return false +end + +F.send_route = function(passive_name, route, show_print) + local message = "" + local return_value = false + if can_set_route(passive_name, route) then + set_route(passive_name, route) + message = passive_name .. " has been set to " .. route + return_value = true + else + message = route .. " cannot be set for " .. passive_name .. ". Try another." + return_value = false + end + if show_print == true then F.print(message) end + return return_value +end + +F.save_train = function() + if not atc_id then return end + if S.trains then + S.trains[atc_id] = { ["id"] = atc_id, ["rc"] = F.get_rc_safe(), ["ln"] = F.get_line_safe(), ["cars_count"] = F.get_train_length_safe() } + end +end + +F.get_real_split_count = function(train_length_count, split_count) + if split_count then + if split_count == "all" then + return 2 + else + F.print("train_length_count (" .. train_length_count .. ") - split_count (" .. split_count .. ")") + train_length_count = train_length_count + 1 + split_count = train_length_count - split_count + return split_count + end + else + return nil + end +end + +F.yard_siding_basic = function(yard, name, place) + if event.train then + if not atc_id then return end + F.save_train() + if place == "start" then + if atc_arrow then + atc_send("S5") + else + atc_send("B5S5") + end + elseif place == "end_alt" then + do_something = false + elseif place == "end" then + if atc_arrow then + atc_send("B0 W R") + end + else + F.print("Place for " .. name .. " has not been defined") + end + end +end + +F.yard_set_route = function(yard, train_id, atc_command) + if atc_command == nil then atc_command = "A1 S5" end + if S.yards[yard] and S.yards[yard]["state"] and S.yards[yard]["actions"] then + status = S.yards[yard]["state"]["status"] + current_sequence = S.yards[yard]["state"]["current"] + current_operation = S.yards[yard]["actions"][current_sequence]["operation"] + table_count = table.maxn(S.yards[yard]["actions"]) + next_sequence = current_sequence + 1 + -- F.print(next_sequence .. "/" .. table_count) + if next_sequence <= table_count and S.yards[yard]["actions"][next_sequence] and S.yards[yard]["actions"][next_sequence]["route"] then + next_route = S.yards[yard]["actions"][next_sequence]["route"] + next_operation = S.yards[yard]["actions"][next_sequence]["operation"] + use_this_signal = S.yards[yard]["actions"][next_sequence]["signal"] + atc_send_status = atc_send_to_train(train_id, atc_command) + if atc_send_status then + if use_this_signal == nil then + F.print(train_id .. " is waiting at: nil") + --[[ + Maybe change it so it shows which signal it is + waiting at when completed with this message: + F.print(train_id .. " has finished the sequences and is waiting.") + ]] + else + can_set_route_response = can_set_route(use_this_signal, next_route) + if can_set_route_response then + -- set_train_length_count = S.yards[yard]["state"]["train_length_count"] + -- S.yards[yard]["state"] = { status = "moving", current = next_sequence, train_length_count = set_train_length_count } + set_route(use_this_signal, next_route) + F.print("DIRECT COMMAND current_operation: " .. current_operation .. " next_operation: " .. next_operation) + F.print(train_id .. " is heading to " .. next_route .. " through " .. use_this_signal) + else + F.print(train_id .. " cannot go to " .. next_route .. " at " .. use_this_signal) + end + end + else + F.print(atc_command .. " command failed") + end + else + F.print("End of Operations for " .. train_id) + end + end +end + +F.yard_siding_next_operation = function(yard, train_id, current_sequence) + if S.yards[yard]["state"] then + if current_sequence == nil then current_sequence = S.yards[yard]["state"]['current'] end + local next_sequence = current_sequence + 1 + local set_train_length_count = S.yards[yard]["state"]["train_length_count"] + local table_count = table.maxn(S.yards[yard]["actions"]) + F.print(next_sequence .. "/" .. table_count) + S.yards[yard]["state"]["current"] = next_sequence + end +end + +F.yard_siding_operations_start = function(yard, train_id, place, current_operation, next_operation, current_split_count) + -- F.print("THIS IS " .. place) + if atc_arrow then + if current_operation == "split_at_engine" then + unset_autocouple() + -- split_off_locomotive("A0B0") + split_at_index(current_split_count, "S0") + F.yard_set_route(yard, train_id, atc_command) + F.yard_siding_next_operation(yard, train_id) + -- elseif current_operation == "reverse" then + -- unset_autocouple() + -- atc_send("B0 W R S5") + elseif next_operation == "split_at_engine" then + F.print("MAYBE SPLIT HERE AT " .. place .. " current: " .. current_operation .. " next: " .. next_operation) + F.yard_set_route(yard, train_id, atc_command) + F.yard_siding_next_operation(yard, train_id) + else + F.yard_set_route(yard, train_id, atc_command) + F.yard_siding_next_operation(yard, train_id) + end + else + if current_split_count == nil then + F.print("YARD SIDING " .. place .. " current_operation: " .. current_operation .. " next_operation: " .. next_operation) + end + if current_operation == "autocouple" then + set_autocouple() + elseif current_operation == "split_at_engine" then + set_autocouple() + else + unset_autocouple() + end + + if next_operation == "forward" then + F.print("at start and the next operation says forward") + F.yard_set_route(yard, train_id, atc_command) + F.yard_siding_next_operation(yard, train_id) + end + end +end + +F.yard_siding_operations_end = function(yard, train_id, place, current_operation, next_operation, current_split_count) + -- F.print("THIS IS " .. place) + if atc_arrow then + F.print("YARD SIDING " .. place .. " current_operation: " .. current_operation .. " next_operation: " .. next_operation) + if current_operation == "split_at_engine" then + -- split_at_index(2, "S0") + -- F.yard_set_route(yard, train_id, nil) + -- F.yard_siding_next_operation(yard, train_id) + unset_autocouple() + atc_send("B0 W R S5") + -- split_at_index(2, "S0") + elseif next_operation == "autocouple" then + unset_autocouple() + atc_send("B0 W R S5") + elseif next_operation == "reverse" then + unset_autocouple() + atc_send("B0 W R S5") + elseif next_operation == "forward" then + unset_autocouple() + F.yard_set_route(yard, train_id, nil) + F.yard_siding_next_operation(yard, train_id) + else + unset_autocouple() + atc_send("B0 W R S5") + end + else + if next_operation == "autocouple" then + set_autocouple() + end + if current_operation == "autocouple" then + set_autocouple() + end + -- if next_operation == "split_at_engine" then + -- F.yard_siding_next_operation(yard, train_id) + -- end + end end -F.print = function (str) - if F.debug then - print("PrntMsg: ".. (str or "nil") ) +F.yard_siding_operations_end_alt = function(yard, train_id, place, current_operation, next_operation, current_split_count) + -- F.print("THIS IS " .. place) + if atc_arrow then + if next_operation == "forward" or next_operation == "split_at_engine" then + unset_autocouple() + F.yard_set_route(yard, train_id, nil) + F.yard_siding_next_operation(yard, train_id) + elseif next_operation == "autocouple" then + set_autocouple() + F.yard_set_route(yard, train_id, nil) + F.yard_siding_next_operation(yard, train_id) + elseif next_operation == "reverse" then + unset_autocouple() + atc_send("B0 W R S5") + else + unset_autocouple() + -- atc_send("B0 W R S5") + F.print("At " .. place .. " and stopped because the command isn't programmed yet") + end + end +end + +F.yard_siding_operations = function(yard, train_id, place, current_operation, next_operation, current_split_count) + if place == "start" then + F.yard_siding_operations_start(yard, train_id, place, current_operation, next_operation, current_split_count) + elseif place == "end" then + F.yard_siding_operations_end(yard, train_id, place, current_operation, next_operation, current_split_count) + elseif place == "end_alt" then + F.yard_siding_operations_end_alt(yard, train_id, place, current_operation, next_operation, current_split_count) + else + F.print("Place for " .. name .. " has not been defined") + end +end + +F.yard_siding = function(yard, name, place) + if event.train then + if not atc_id then return end + if F.has_rc("LILSHUNTER", F.get_rc_safe() ) then + if S.yards[yard] and S.yards[yard]["state"] and S.yards[yard]["actions"] then + train_id = atc_id + S.yards[yard]["state"]["train_length_count"] = F.get_train_length_safe() + train_length_count = S.yards[yard]["state"]["train_length_count"] + status = S.yards[yard]["state"]["status"] + current_sequence = S.yards[yard]["state"]["current"] + current_operation = S.yards[yard]["actions"][current_sequence]["operation"] + current_split_count = S.yards[yard]["actions"][current_sequence]["split_count"] + current_split_count = F.get_real_split_count(train_length_count, current_split_count) + table_count = table.maxn(S.yards[yard]["actions"]) + next_sequence = current_sequence + 1 + if next_sequence <= table_count and S.yards[yard]["actions"][next_sequence] then + next_route = S.yards[yard]["actions"][next_sequence]["route"] + use_this_signal = S.yards[yard]["actions"][next_sequence]["signal"] + next_operation = S.yards[yard]["actions"][next_sequence]["operation"] + next_split_count = S.yards[yard]["actions"][next_sequence]["split_count"] + next_split_count = F.get_real_split_count(train_length_count, next_split_count) + F.yard_siding_operations(yard, train_id, place, current_operation, next_operation, current_split_count) + else + F.print("Went over the table count in F.yard_siding") + end + else + F.yard_siding_basic(yard, name, place) + end + else + F.yard_siding_basic(yard, name, place) + end + end + return +end + +F.yard_run = function(yard, section_id) -- section_id example: "723167" + if S.yards[yard] and type(S.yards[yard]) == "table" then + section_occuppied_by_table = section_occupancy(section_id) + section_occuppied_count = table.maxn(section_occuppied_by_table) + if section_occuppied_count == 1 then + train_id = section_occuppied_by_table[1] + F.print("train_id: " .. train_id) + F.yard_set_route(yard, train_id) + F.yard_siding_next_operation(yard, train_id) + else + F.print("HALT! More than one train is in the SHUNT01 section") + end + else + F.print("ERROR: S.yards[yard] needs to be a table") + end + return +end + +F.reset_trial_setup = function() + local yard = "ers_main" + if S.yards[yard] then + S.yards[yard] = {} + F.print(yard .. " has been reset!") + end +end + +F.trial_setup = function(type) + -- LILSHUNTER + local yard = "ers_main" + local section_id = "723167" + if type == nil then + F.print("Please, declare a type") + elseif type == "autocouple_1_4" then + S.yards[yard] = { + ["state"] = { status = "ready", current = 1, train_length_count = 1 }, + ["actions"] = { + [1] = {route = "SHUNT01", signal = nil, operation = "start"}, + [2] = {route = "SIDING01", signal = "SHUNT01_SIGNAL", operation = "autocouple"}, + [3] = {route = "HEADSHUNT01", signal = "SIDING01_SIGNAL", operation = "reverse"}, + [4] = {route = "SIDING02", signal = "HEADSHUNT01_SIGNAL", operation = "autocouple"}, + [5] = {route = "HEADSHUNT01", signal = "SIDING02_SIGNAL", operation = "reverse"}, + [6] = {route = "SIDING03", signal = "HEADSHUNT01_SIGNAL", operation = "autocouple"}, + [7] = {route = "HEADSHUNT01", signal = "SIDING03_SIGNAL", operation = "reverse"}, + [8] = {route = "SIDING04", signal = "HEADSHUNT01_SIGNAL", operation = "autocouple"}, + [9] = {route = "HEADSHUNT01", signal = "SIDING04_SIGNAL", operation = "reverse"}, + [10] = {route = "SIDING05", signal = "HEADSHUNT01_SIGNAL", operation = "split_at_engine", split_count = "all"}, + [11] = {route = "SHUNT01", signal = "SIDING05_SIGNAL", operation = "forward"}, + [12] = {route = "SHUNT01", signal = nil, operation = "end"} + } + } + elseif type == "split_train_1_4" then + S.yards[yard] = { + ["state"] = { status = "ready", current = 1, train_length_count = 1 }, + ["actions"] = { + [1] = {route = "SHUNT01", signal = nil, operation = "start"}, + [2] = {route = "SIDING05", signal = "SHUNT01_SIGNAL", operation = "autocouple"}, + [3] = {route = "HEADSHUNT01", signal = "SIDING05_SIGNAL", operation = "reverse"}, + [4] = {route = "SIDING04", signal = "HEADSHUNT01_SIGNAL", operation = "split_at_engine", split_count = 1}, + [5] = {route = "HEADSHUNT01", signal = "SIDING04_SIGNAL", operation = "reverse"}, + [6] = {route = "SIDING03", signal = "HEADSHUNT01_SIGNAL", operation = "split_at_engine", split_count = 1}, + [7] = {route = "HEADSHUNT01", signal = "SIDING03_SIGNAL", operation = "reverse"}, + [8] = {route = "SIDING02", signal = "HEADSHUNT01_SIGNAL", operation = "split_at_engine", split_count = 1}, + [9] = {route = "HEADSHUNT01", signal = "SIDING02_SIGNAL", operation = "reverse"}, + [10] = {route = "SIDING01", signal = "HEADSHUNT01_SIGNAL", operation = "split_at_engine", split_count = 1}, + [11] = {route = "SHUNT01", signal = "SIDING01_SIGNAL", operation = "reverse"}, + [12] = {route = "SHUNT01", signal = nil, operation = "end"} + } + } + elseif type == "loop_test" then + S.yards[yard] = { + ["state"] = { status = "ready", current = 1, train_length_count = 1 }, + ["actions"] = { + [1] = {route = "SHUNT01", signal = nil, operation = "start"}, + [2] = {route = "SIDING05", signal = "SHUNT01_SIGNAL", operation = "autocouple"}, + [3] = {route = "ALTSIDING01", signal = "SIDING05_SIGNAL", operation = "reverse"}, + [4] = {route = "SIDING05", signal = "ALTSIDING01_BACK", operation = "forward"}, + [5] = {route = "SHUNT01", signal = "SIDING05_SIGNAL", operation = "split_at_engine", split_count = 4}, + [6] = {route = "SHUNT01", signal = nil, operation = "end"} + } + } + elseif type == "loop_test1" then + S.yards[yard] = { + ["state"] = { status = "ready", current = 1, train_length_count = 1 }, + ["actions"] = { + [1] = {route = "SHUNT01", signal = nil, operation = "start"}, + [2] = {route = "SIDING05", signal = "SHUNT01_SIGNAL", operation = "autocouple"}, + [3] = {route = "ALTSIDING01", signal = "SIDING05_SIGNAL", operation = "reverse"}, + [4] = {route = "SIDING05", signal = "ALTSIDING01_BACK", operation = "forward"}, + [5] = {route = "SHUNT01", signal = "SIDING05_SIGNAL", operation = "split_at_engine", split_count = 4}, + [6] = {route = nil, signal = nil, operation = "forward"}, + [7] = {route = nil, signal = nil, operation = "end"} + } + } + elseif type == "loop_autocouple_1_4" then + S.yards[yard] = { + ["state"] = { status = "ready", current = 1, train_length_count = 1 }, + ["actions"] = { + [1] = {route = "SHUNT01", signal = nil, operation = "start"}, + [2] = {route = "ALTSIDING01", signal = "SHUNT01_SIGNAL", operation = "forward"}, + [3] = {route = "SIDING01", signal = "ALTSIDING01_BACK", operation = "autocouple"}, + [4] = {route = "ALTSIDING01", signal = "SIDING01_SIGNAL", operation = "forward"}, + [5] = {route = "SIDING02", signal = "ALTSIDING01_BACK", operation = "autocouple"}, + [6] = {route = "ALTSIDING01", signal = "SIDING02_SIGNAL", operation = "forward"}, + [7] = {route = "SIDING03", signal = "ALTSIDING01_BACK", operation = "autocouple"}, + [8] = {route = "ALTSIDING01", signal = "SIDING03_SIGNAL", operation = "forward"}, + [9] = {route = "SIDING04", signal = "ALTSIDING01_BACK", operation = "autocouple"}, + [10] = {route = nil, signal = nil, operation = "forward"}, + [11] = {route = "HEADSHUNT01", signal = "SIDING04_SIGNAL", operation = "reverse"}, + [12] = {route = "SIDING05", signal = "HEADSHUNT01_SIGNAL", operation = "forward"}, + [13] = {route = "SHUNT01", signal = "SIDING05_SIGNAL", operation = "split_at_engine", split_count = 4}, + [14] = {route = nil, signal = nil, operation = "forward"}, + [15] = {route = nil, signal = nil, operation = "end"} + } + } + elseif type == "loop_test_old" then + S.yards[yard] = { + ["state"] = { status = "ready", current = 1, train_length_count = 1 }, + ["actions"] = { + [1] = {route = "SHUNT01", signal = nil, operation = "start"}, + [2] = {route = "ALTSIDING01", signal = "SHUNT01_SIGNAL", operation = "forward"}, + [3] = {route = "SIDING01", signal = "ALTSIDING01_BACK", operation = "forward"}, + [4] = {route = "ALTSIDING01", signal = "SIDING01_SIGNAL", operation = "forward"}, + [5] = {route = "SIDING02", signal = "ALTSIDING01_BACK", operation = "forward"}, + [6] = {route = "SHUNT01", signal = "SIDING02_SIGNAL", operation = "forward"}, + [7] = {route = "SHUNT01", signal = nil, operation = "end"} + } + } + elseif type == "test" then + S.yards[yard] = { + ["state"] = { status = "ready", current = 1, train_length_count = 1 }, + ["actions"] = { + [1] = {route = "SHUNT01", signal = nil, operation = "start"}, + [2] = {route = "SIDING05", signal = "SHUNT01_SIGNAL", operation = "autocouple"}, + [3] = {route = "ALTSIDING01", signal = "SHUNT01_SIGNAL", operation = "forward"}, + [4] = {route = "SIDING01", signal = "ALTSIDING01_BACK", operation = "forward"}, + [5] = {route = "ALTSIDING01", signal = "SIDING01_SIGNAL", operation = "split_at_engine", split_count = 1}, + [6] = {route = "SIDING02", signal = "ALTSIDING01_BACK", operation = "forward"}, + [7] = {route = "SHUNT01", signal = "SIDING02_SIGNAL", operation = "forward"}, + [8] = {route = "SHUNT01", signal = nil, operation = "end"} + } + } + else + F.print("This type (" .. type .. ") is not defined") + end + F.yard_run(yard, section_id) +end + +F.delete_train_info = function(train_id) + if S.trains[train_id] then + S.trains[train_id] = nil + F.print("Deleted train id: " .. train_id) + end +end + +F.list_trains = function(number_of_displays) + if S.trains then + if number_of_displays == nil then number_of_displays = F.max_displays end + F.clear_main_depot_displays() + number_of_displays = number_of_displays + 1 + count_keys = 0 + trains_table = {} + for k in pairs(S.trains) do + table.insert(trains_table, k) + count_keys = count_keys + 1 + end + table.sort(trains_table) + x = number_of_displays - count_keys + for _, k in ipairs(trains_table) do + if S.trains[k] then + v = S.trains[k] + if F.has_rc("LILSHUNTER", v["rc"]) or F.has_rc("LIL", v["rc"]) then + F.delete_train_info(v["id"]) + else + if v["ln"] == nil or v["ln"] == "" then + line_number = "" + else + line_number = "| LN: [" .. v["ln"] .. "]" + end + if v["rc"] == nil or v["rc"] == "" then + rc_display = "" + else + rc_list = v["rc"] + rc_list_cleansed = "" + rc_list_unknown = "" + rc_list_table = {} + if F.has_rc("ERSTAZI", rc_list) and F.has_rc("FREIGHT", rc_list) then + rc_list_cleansed = "ERSTAZI FREIGHT |" + else + rc_list_cleansed = "NO E,F |" + end + for rc in rc_list:gmatch("[^%s]+") do + if rc == "ERSTAZI" or rc == "FREIGHT" then + -- leaving for future use + do_nothing = true + else + if F.known_rcs[rc] ~= nil then + rc_list_cleansed = rc_list_cleansed .. " " .. rc + else + rc_list_unknown = rc_list_unknown .. " " .. rc + end + end + end + rc_display = "| RC: " .. rc_list_cleansed + if not F.isempty(rc_list_unknown) then + rc_display = rc_display .. "| *URC*:" .. rc_list_unknown + end + end + if v["cars_count"] == nil or v["cars_count"] == "" then + cars_count_display = " Len: 0" + else + cars_count = tonumber(v["cars_count"]) + cars_count_display = " Len: " .. cars_count + end + message = " ID: " .. v["id"] .. cars_count_display .. rc_display .. line_number + if x > 0 then digiline_send("train_display" .. x, message) end + F.print(x .. ": " .. message) + x = x + 1 + end + end + end + else + F.print("no trains saved in S.trains") + end +end + +F.slow_train_down = function(id) + result = atc_send_to_train(id, "B1") + if result == false then + F.print("Train ID " .. id .. " does not exist") + else + F.print("Train ID " .. id .. " is slowed down to B1") end end -S.train_duration = {} F.train_duration = function(type) if not atc_id then return end local now = os.date("%H:%M:%S") - if F.isempty(type) then - type = "start" - end + if F.isempty(type) then type = "start" end if not S.train_duration[atc_id] then - S.train_duration[atc_id] = { ["train_id"] = atc_id, ["start"] = "", ["end"] = "" } + S.train_duration[atc_id] = { ["train_id"] = atc_id, ["start"] = "", ["end"] = "", ["start_sec"] = "", ["end_sec"] = "", ["diff"] = {} } end if type == "start" then - S.train_duration[atc_id]["end"] = "Nil" + S.train_duration[atc_id]["end"] = nil + S.train_duration[atc_id]["end_sec"] = nil end S.train_duration[atc_id][type] = now + S.train_duration[atc_id][type .. "_sec"] = os.time() + if + S.train_duration[atc_id]["start_sec"] ~= nil + and S.train_duration[atc_id]["start_sec"] ~= "" + and S.train_duration[atc_id]["end_sec"] ~= nil + and S.train_duration[atc_id]["end_sec"] ~= "" + then + if S.train_duration[atc_id]["diff"] == nil then S.train_duration[atc_id]["diff"] = {} end + -- Returns the difference, in seconds, from time t1 to time t2 (where the times are values returned by os.time) + difference_in_time = os.difftime(S.train_duration[atc_id]["end_sec"], S.train_duration[atc_id]["start_sec"]) + table.insert(S.train_duration[atc_id]["diff"], difference_in_time) + end end F.train_info = function (passive_name, show_print) local timestart = "" local timeend = "" local time_message = "" + local average_duration_message = "" if F.isempty(passive_name) or passive_name == "RESETALL" then - msg_atc_id = "No Train" + train_id_message = "No Train" if passive_name == "RESETALL" then S.train_duration = {} + -- Holding off on resetting the whole table of S.trains + -- S.trains = {} end else timestart = S.train_duration[atc_id]["start"] timeend = S.train_duration[atc_id]["end"] - msg_atc_id = atc_id + train_id_message = "Last Train: " .. atc_id end - local lcd_message = "" .. - msg_atc_id .. - "" - - if not F.isempty(timestart) and not F.isempty(timeend) then - time_message = "Time: | " .. timestart .. " to " .. timeend - elseif not F.isempty(timestart) and F.isempty(timeend) then - time_message = "Start Time: | " .. timestart + if timestart == nil and timeend == nil then + time_message = "Current Time: |" .. os.date("%H:%M:%S") + elseif timestart ~= nil and timeend == nil then + time_message = "Start: |" .. timestart else - time_message = "RegTime: | " .. os.date("%H:%M:%S") + time_message = "Time: |" .. timestart .. " to " .. timeend end - + average_duration_message = "|AVG: " .. math.ceil(F.avg(S.train_duration[atc_id]["diff"])) .. "s" + local lcd_message = "" .. + train_id_message .. "|" .. + time_message .. + average_duration_message .. + "" digiline_send("lcd", lcd_message) - digiline_send("time", time_message) local message = lcd_message .. " | " .. time_message - if show_print == true then F.print(message) end end - -F.does_train_have_rc = function(wanted_rc) - local rc = get_rc() or "" - if rc:match(wanted_rc) then - return true - else - return false - end -end - -F.send_route = function(passive_name, route, show_print) - if can_set_route(passive_name, route) then - set_route(passive_name, route) - if show_print == true then - F.print(passive_name .. " has been set to " .. route) - end - return true - else - if show_print == true then - F.print(route .. " cannot be set for " .. passive_name .. ". Try another") - end - return false - end -end - -if event.type == "init" then - F.print("Initialized") -end
\ No newline at end of file diff --git a/ers/nodes/(-3693,11,-3604).lua b/ers/nodes/(-3693,11,-3604).lua new file mode 100644 index 0000000..4aefac3 --- /dev/null +++ b/ers/nodes/(-3693,11,-3604).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(-3693,11,-3604) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W S1") + else + step_fc() + atc_send("SM") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(-3693,11,-3608).lua b/ers/nodes/(-3693,11,-3608).lua new file mode 100644 index 0000000..8f05fc4 --- /dev/null +++ b/ers/nodes/(-3693,11,-3608).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(-3693,11,-3608) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W S1") + else + step_fc() + atc_send("SM") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1595,-14,1496).lua b/ers/nodes/(1595,-14,1496).lua new file mode 100644 index 0000000..185f4ab --- /dev/null +++ b/ers/nodes/(1595,-14,1496).lua @@ -0,0 +1,13 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1595,-14,1496) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("S5") + else + atc_send("B5") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1605,14,1414).lua b/ers/nodes/(1605,14,1414).lua new file mode 100644 index 0000000..74a7f4b --- /dev/null +++ b/ers/nodes/(1605,14,1414).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1605,14,1414) + +local show_print = false +if event.train then + if atc_arrow then + F.save_train() + else + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1608,14,1414).lua b/ers/nodes/(1608,14,1414).lua new file mode 100644 index 0000000..a45cd5f --- /dev/null +++ b/ers/nodes/(1608,14,1414).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1608,14,1414) + +local show_print = false +if event.train then + if atc_arrow then + F.save_train() + else + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1636,4,1331).lua b/ers/nodes/(1636,4,1331).lua new file mode 100644 index 0000000..0f54c10 --- /dev/null +++ b/ers/nodes/(1636,4,1331).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1636,4,1331) + +local show_print = false +if event.train then + if atc_arrow then + F.save_train() + else + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1271).lua b/ers/nodes/(1656,2,1271).lua new file mode 100644 index 0000000..73a2466 --- /dev/null +++ b/ers/nodes/(1656,2,1271).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1271) + +F.yard_siding("ers_main", "ALTSIDING01", "end_alt")
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1279).lua b/ers/nodes/(1656,2,1279).lua new file mode 100644 index 0000000..9b25287 --- /dev/null +++ b/ers/nodes/(1656,2,1279).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1279) + +F.yard_siding("ers_main", "HEADSHUNT02", "end")
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1282).lua b/ers/nodes/(1656,2,1282).lua new file mode 100644 index 0000000..ac46839 --- /dev/null +++ b/ers/nodes/(1656,2,1282).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1282) + +F.yard_siding("ers_main", "SIDING06", "end")
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1285).lua b/ers/nodes/(1656,2,1285).lua new file mode 100644 index 0000000..a81ba9f --- /dev/null +++ b/ers/nodes/(1656,2,1285).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1285) + +F.yard_siding("ers_main", "SIDING05", "end")
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1294).lua b/ers/nodes/(1656,2,1294).lua new file mode 100644 index 0000000..4a37559 --- /dev/null +++ b/ers/nodes/(1656,2,1294).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1294) + +F.yard_siding("ers_main", "SIDING02", "end")
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1297).lua b/ers/nodes/(1656,2,1297).lua new file mode 100644 index 0000000..0bdb8aa --- /dev/null +++ b/ers/nodes/(1656,2,1297).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1297) + +F.yard_siding("ers_main", "SIDING01", "end")
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1300).lua b/ers/nodes/(1656,2,1300).lua new file mode 100644 index 0000000..132e944 --- /dev/null +++ b/ers/nodes/(1656,2,1300).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1300) + +F.yard_siding("ers_main", "ALTSIDING02", "end")
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1308).lua b/ers/nodes/(1656,2,1308).lua new file mode 100644 index 0000000..dd97581 --- /dev/null +++ b/ers/nodes/(1656,2,1308).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1656,2,1308) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1657,6,1237).lua b/ers/nodes/(1657,6,1237).lua index 0cb6ef7..747e816 100644 --- a/ers/nodes/(1657,6,1237).lua +++ b/ers/nodes/(1657,6,1237).lua @@ -1,6 +1,6 @@ -- luaoperatingpanel_depot_01.lua local show_print = false if event.type == "punch" then - F.train_info("RESETALL", show_print) +-- F.train_info("RESETALL", show_print) return end
\ No newline at end of file diff --git a/ers/nodes/(1658,1,1238).lua b/ers/nodes/(1658,1,1238).lua new file mode 100644 index 0000000..c9e2edb --- /dev/null +++ b/ers/nodes/(1658,1,1238).lua @@ -0,0 +1,40 @@ +-- luaatctrack_main_depot_01.lua +local show_print = false +if event.train then + if atc_arrow then + local passive_name = "ErsDepotTurnaround" + local track_route = "01 EXTRA" + local can_do_route1 = false + local can_do_route2 = false + local rc_list = F.get_rc_safe() + F.save_train() + F.train_duration("start") + F.train_info(passive_name, show_print) + if F.has_rc("ERSTAZIDEPOTUNLOAD", rc_list) + or F.has_rc("DEPOTUNLOADING", rc_list) + or F.has_rc("FERTRUNNER", rc_list) + then + track_route = "03 UNLOADING TRACK" + elseif F.has_rc("DEPOTLOADING", rc_list) + or F.has_rc("ERSTAZITST", rc_list) + then + track_route = "02 LOADING TRACK" + end + + can_do_route1 = F.send_route(passive_name, track_route, show_print) + if can_do_route1 == false then + track_route = "01 EXTRA" + can_do_route2 = F.send_route(passive_name, track_route, show_print) + if can_do_route2 == false then + track_route = "04 EXTRA" + F.send_route(passive_name, track_route, show_print) + end + end + else + F.save_train() + local passive_name = "ErsDepotTurnaround" + F.train_duration("end") + F.train_info(passive_name, show_print) + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1658,2,1304).lua b/ers/nodes/(1658,2,1304).lua new file mode 100644 index 0000000..f2096ca --- /dev/null +++ b/ers/nodes/(1658,2,1304).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1658,2,1304) + +F.yard_siding("ers_main", "LOAD/UNLOAD TURNAROUND", "end")
\ No newline at end of file diff --git a/ers/nodes/(1658,6,1237).lua b/ers/nodes/(1658,6,1237).lua new file mode 100644 index 0000000..9017b1b --- /dev/null +++ b/ers/nodes/(1658,6,1237).lua @@ -0,0 +1,13 @@ +-- luaoperatingpanel_depot_02.lua +local show_print = false +if event.type == "punch" then + +-- F.delete_train_info("337564") +-- F.delete_train_info("450511") + +-- F.list_trains(12) +-- F.list_trains(32) + F.list_trains(36) +-- F.list_trains(52) + return +end
\ No newline at end of file diff --git a/ers/nodes/(1661,2,1273).lua b/ers/nodes/(1661,2,1273).lua new file mode 100644 index 0000000..3b255c0 --- /dev/null +++ b/ers/nodes/(1661,2,1273).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1661,2,1273) + +F.yard_siding("ers_main", "SHUNT02", "end")
\ No newline at end of file diff --git a/ers/nodes/(1670,-3,1499).lua b/ers/nodes/(1670,-3,1499).lua new file mode 100644 index 0000000..485bce3 --- /dev/null +++ b/ers/nodes/(1670,-3,1499).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1670,-3,1499) + +local show_print = false +if event.train then + if atc_arrow then + F.save_train() + else + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1670,2,1244).lua b/ers/nodes/(1670,2,1244).lua new file mode 100644 index 0000000..6c6e030 --- /dev/null +++ b/ers/nodes/(1670,2,1244).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1670,2,1244) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W R") + -- atc_send("S5") + -- else + -- atc_send("B3 S3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1670,2,1247).lua b/ers/nodes/(1670,2,1247).lua new file mode 100644 index 0000000..71325a7 --- /dev/null +++ b/ers/nodes/(1670,2,1247).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1670,2,1247) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W R") + -- atc_send("S5") + -- else + -- atc_send("B3 S3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1670,2,1250).lua b/ers/nodes/(1670,2,1250).lua new file mode 100644 index 0000000..600d6d5 --- /dev/null +++ b/ers/nodes/(1670,2,1250).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1670,2,1250) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W R") + -- atc_send("S5") + -- else + -- atc_send("B3 S3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1670,2,1253).lua b/ers/nodes/(1670,2,1253).lua new file mode 100644 index 0000000..5d0b7e0 --- /dev/null +++ b/ers/nodes/(1670,2,1253).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1670,2,1253) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W R") + -- atc_send("S5") + -- else + -- atc_send("B3 S3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1670,2,1256).lua b/ers/nodes/(1670,2,1256).lua new file mode 100644 index 0000000..e1a2576 --- /dev/null +++ b/ers/nodes/(1670,2,1256).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1670,2,1256) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W R") + -- atc_send("S5") + -- else + -- atc_send("B3 S3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1670,2,1262).lua b/ers/nodes/(1670,2,1262).lua new file mode 100644 index 0000000..8d45c19 --- /dev/null +++ b/ers/nodes/(1670,2,1262).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1670,2,1262) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W R") + -- atc_send("S5") + -- else + -- atc_send("B3 S3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1682,-14,1402).lua b/ers/nodes/(1682,-14,1402).lua new file mode 100644 index 0000000..d911294 --- /dev/null +++ b/ers/nodes/(1682,-14,1402).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1682,-14,1402) + +local show_print = false +if event.train then + if atc_arrow then + F.save_train() + else + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1693,2,1270).lua b/ers/nodes/(1693,2,1270).lua new file mode 100644 index 0000000..25583e8 --- /dev/null +++ b/ers/nodes/(1693,2,1270).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1693,2,1270) + +F.yard_siding("ers_main", "SHUNT01", "start")
\ No newline at end of file diff --git a/ers/nodes/(1694,2,1300).lua b/ers/nodes/(1694,2,1300).lua new file mode 100644 index 0000000..5fb4e1d --- /dev/null +++ b/ers/nodes/(1694,2,1300).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1694,2,1300) + +F.yard_siding("ers_main", "ALTSIDING02", "start")
\ No newline at end of file diff --git a/ers/nodes/(1695,2,1273).lua b/ers/nodes/(1695,2,1273).lua new file mode 100644 index 0000000..1c9ec2c --- /dev/null +++ b/ers/nodes/(1695,2,1273).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1695,2,1273) + +F.yard_siding("ers_main", "SHUNT02", "start")
\ No newline at end of file diff --git a/ers/nodes/(1695,2,1297).lua b/ers/nodes/(1695,2,1297).lua new file mode 100644 index 0000000..dcf7700 --- /dev/null +++ b/ers/nodes/(1695,2,1297).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1695,2,1297) + +F.yard_siding("ers_main", "SIDING01", "start")
\ No newline at end of file diff --git a/ers/nodes/(1699,2,1262).lua b/ers/nodes/(1699,2,1262).lua new file mode 100644 index 0000000..51211ee --- /dev/null +++ b/ers/nodes/(1699,2,1262).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1699,2,1262) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1699,2,1276).lua b/ers/nodes/(1699,2,1276).lua new file mode 100644 index 0000000..63aab36 --- /dev/null +++ b/ers/nodes/(1699,2,1276).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1699,2,1276) + +F.yard_siding("ers_main", "HEADSHUNT01", "start")
\ No newline at end of file diff --git a/ers/nodes/(1699,2,1279).lua b/ers/nodes/(1699,2,1279).lua new file mode 100644 index 0000000..a63d6fe --- /dev/null +++ b/ers/nodes/(1699,2,1279).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1699,2,1279) + +F.yard_siding("ers_main", "HEADSHUNT02", "start")
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1244).lua b/ers/nodes/(1700,2,1244).lua new file mode 100644 index 0000000..ff6154a --- /dev/null +++ b/ers/nodes/(1700,2,1244).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1700,2,1244) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1247).lua b/ers/nodes/(1700,2,1247).lua new file mode 100644 index 0000000..f52056b --- /dev/null +++ b/ers/nodes/(1700,2,1247).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1700,2,1247) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1250).lua b/ers/nodes/(1700,2,1250).lua new file mode 100644 index 0000000..5daad5a --- /dev/null +++ b/ers/nodes/(1700,2,1250).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1700,2,1250) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1253).lua b/ers/nodes/(1700,2,1253).lua new file mode 100644 index 0000000..75b1559 --- /dev/null +++ b/ers/nodes/(1700,2,1253).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1700,2,1253) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1259).lua b/ers/nodes/(1700,2,1259).lua new file mode 100644 index 0000000..e989e66 --- /dev/null +++ b/ers/nodes/(1700,2,1259).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1700,2,1259) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1282).lua b/ers/nodes/(1700,2,1282).lua new file mode 100644 index 0000000..be4cd88 --- /dev/null +++ b/ers/nodes/(1700,2,1282).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1700,2,1282) + +F.yard_siding("ers_main", "SIDING06", "start")
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1285).lua b/ers/nodes/(1700,2,1285).lua new file mode 100644 index 0000000..8e60f0b --- /dev/null +++ b/ers/nodes/(1700,2,1285).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1700,2,1285) + +F.yard_siding("ers_main", "SIDING05", "start")
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1288).lua b/ers/nodes/(1700,2,1288).lua new file mode 100644 index 0000000..30a6a77 --- /dev/null +++ b/ers/nodes/(1700,2,1288).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1700,2,1288) + +F.yard_siding("ers_main", "SIDING04", "start")
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1291).lua b/ers/nodes/(1700,2,1291).lua new file mode 100644 index 0000000..b1aa450 --- /dev/null +++ b/ers/nodes/(1700,2,1291).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1700,2,1291) + +F.yard_siding("ers_main", "SIDING03", "start")
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1304).lua b/ers/nodes/(1700,2,1304).lua new file mode 100644 index 0000000..ab8bcf3 --- /dev/null +++ b/ers/nodes/(1700,2,1304).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1700,2,1304) + +F.yard_siding("ers_main", "LOAD/UNLOAD TURNAROUND", "start")
\ No newline at end of file diff --git a/ers/nodes/(1701,2,1256).lua b/ers/nodes/(1701,2,1256).lua new file mode 100644 index 0000000..1fa8fb0 --- /dev/null +++ b/ers/nodes/(1701,2,1256).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1701,2,1256) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1702,2,1269).lua b/ers/nodes/(1702,2,1269).lua new file mode 100644 index 0000000..851d36f --- /dev/null +++ b/ers/nodes/(1702,2,1269).lua @@ -0,0 +1,8 @@ +-- luaatctrack_run_sequence_01.lua +local show_print = false +if event.type == "punch" then + F.trial_setup("split_train_1_4") +-- F.trial_setup("loop_test1") +-- F.trial_setup("loop_autocouple_1_4") + return +end
\ No newline at end of file diff --git a/ers/nodes/(1702,2,1270).lua b/ers/nodes/(1702,2,1270).lua new file mode 100644 index 0000000..823ad84 --- /dev/null +++ b/ers/nodes/(1702,2,1270).lua @@ -0,0 +1,6 @@ +-- luaatctrack_run_sequence_01.lua +local show_print = false +if event.type == "punch" then + F.trial_setup("autocouple_1_4") + return +end
\ No newline at end of file diff --git a/ers/nodes/(1704,2,1269).lua b/ers/nodes/(1704,2,1269).lua new file mode 100644 index 0000000..05766c3 --- /dev/null +++ b/ers/nodes/(1704,2,1269).lua @@ -0,0 +1,6 @@ +-- luaatctrack_run_sequence_01.lua + +if event.type == "punch" then + F.reset_trial_setup() + return +end
\ No newline at end of file diff --git a/ers/nodes/(1747,-14,1440).lua b/ers/nodes/(1747,-14,1440).lua new file mode 100644 index 0000000..cdc0a34 --- /dev/null +++ b/ers/nodes/(1747,-14,1440).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1747,-14,1440) + +local show_print = false +if event.train then + if atc_arrow then + F.save_train() + else + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1750,-14,1449).lua b/ers/nodes/(1750,-14,1449).lua new file mode 100644 index 0000000..a909162 --- /dev/null +++ b/ers/nodes/(1750,-14,1449).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1750,-14,1449) + +local show_print = false +if event.train then + if atc_arrow then + F.save_train() + else + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1929,3,7928).lua b/ers/nodes/(1929,3,7928).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/ers/nodes/(1929,3,7928).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/ers/nodes/(1932,3,7927).lua b/ers/nodes/(1932,3,7927).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/ers/nodes/(1932,3,7927).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/ers/nodes/(1935,3,7924).lua b/ers/nodes/(1935,3,7924).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/ers/nodes/(1935,3,7924).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/ers/nodes/(1938,3,7921).lua b/ers/nodes/(1938,3,7921).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/ers/nodes/(1938,3,7921).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/ers/nodes/(1944,3,7915).lua b/ers/nodes/(1944,3,7915).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/ers/nodes/(1944,3,7915).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/ers/nodes/(1947,3,7912).lua b/ers/nodes/(1947,3,7912).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/ers/nodes/(1947,3,7912).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/ers/nodes/(1950,3,7909).lua b/ers/nodes/(1950,3,7909).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/ers/nodes/(1950,3,7909).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/ers/nodes/(1986,2,1743).lua b/ers/nodes/(1986,2,1743).lua new file mode 100644 index 0000000..8e797a9 --- /dev/null +++ b/ers/nodes/(1986,2,1743).lua @@ -0,0 +1,14 @@ +-- luaatctrack_docking_ferry_01.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + if atc_arrow then + -- atc_send("B0 W R OL A1") + atc_send("B0 W R OR A1") + else + do_something = false + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1986,2,1759).lua b/ers/nodes/(1986,2,1759).lua new file mode 100644 index 0000000..af6446c --- /dev/null +++ b/ers/nodes/(1986,2,1759).lua @@ -0,0 +1,13 @@ +-- luaatctrack_docking_ferry_leaving_dock.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + if atc_arrow then + atc_send("OC A1 S5") + else + atc_send("OC A0 B3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1991,2,1794).lua b/ers/nodes/(1991,2,1794).lua new file mode 100644 index 0000000..b81d9e1 --- /dev/null +++ b/ers/nodes/(1991,2,1794).lua @@ -0,0 +1,28 @@ +-- luaatctrack_docking_ferry_01.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + local passive_name = "DOCKSIGNAL" + if atc_arrow then + local can_do_route = false + atc_send("B0 W R OC D1 S5") + can_do_route = F.send_route(passive_name, "DOCK 5", show_print) + if can_do_route == false then + can_do_route = F.send_route(passive_name, "DOCK 4", show_print) + if can_do_route == false then + can_do_route = F.send_route(passive_name, "DOCK 3", show_print) + if can_do_route == false then + can_do_route = F.send_route(passive_name, "DOCK 2", show_print) + if can_do_route == false then + can_do_route = F.send_route(passive_name, "DOCK 1", show_print) + end + end + end + end + else + do_something = false + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1993,2,1743).lua b/ers/nodes/(1993,2,1743).lua new file mode 100644 index 0000000..ca383df --- /dev/null +++ b/ers/nodes/(1993,2,1743).lua @@ -0,0 +1,14 @@ +-- luaatctrack_docking_ferry_01.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + if atc_arrow then + atc_send("B0 W R OL A1") + -- atc_send("B0 W R OR A1") + else + do_something = false + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1993,2,1759).lua b/ers/nodes/(1993,2,1759).lua new file mode 100644 index 0000000..af6446c --- /dev/null +++ b/ers/nodes/(1993,2,1759).lua @@ -0,0 +1,13 @@ +-- luaatctrack_docking_ferry_leaving_dock.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + if atc_arrow then + atc_send("OC A1 S5") + else + atc_send("OC A0 B3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(2001,2,1759).lua b/ers/nodes/(2001,2,1759).lua new file mode 100644 index 0000000..af6446c --- /dev/null +++ b/ers/nodes/(2001,2,1759).lua @@ -0,0 +1,13 @@ +-- luaatctrack_docking_ferry_leaving_dock.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + if atc_arrow then + atc_send("OC A1 S5") + else + atc_send("OC A0 B3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(2016,2,1743).lua b/ers/nodes/(2016,2,1743).lua new file mode 100644 index 0000000..8e797a9 --- /dev/null +++ b/ers/nodes/(2016,2,1743).lua @@ -0,0 +1,14 @@ +-- luaatctrack_docking_ferry_01.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + if atc_arrow then + -- atc_send("B0 W R OL A1") + atc_send("B0 W R OR A1") + else + do_something = false + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(2016,2,1759).lua b/ers/nodes/(2016,2,1759).lua new file mode 100644 index 0000000..af6446c --- /dev/null +++ b/ers/nodes/(2016,2,1759).lua @@ -0,0 +1,13 @@ +-- luaatctrack_docking_ferry_leaving_dock.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + if atc_arrow then + atc_send("OC A1 S5") + else + atc_send("OC A0 B3") + end + return +end
\ No newline at end of file diff --git a/ers_mtn/init_code.lua b/ers_mtn/init_code.lua new file mode 100644 index 0000000..6e52905 --- /dev/null +++ b/ers_mtn/init_code.lua @@ -0,0 +1,39 @@ + + +-- Gleis A +-- 1787,3,1264 + +-- Gleis B +-- 1793,3,1264 + +-- erste Brücke +-- 1820,15,1223 + + +local gleisliste = { +{ "gleisa", "Gleis A",{1787,3,1264} }, +{ "gleisb", "Gleis B", {1793,3,1264} }, +{ "erstebruecke", "erste Bruecke", {1820,15,1223 } }, +{ "kniebeuge", "Kniebeugebahnhof", { 1896, 137, 1246 } }, +} + + + + + +S.atctracks = {} + + +for _,e in ipairs(gleisliste) do + S.atctracks[e[1]] = e[2] +end + + +S.daten = {} + +S.section = {} + + +F.update = function() +return +end
\ No newline at end of file diff --git a/ers_mtn/nodes/(1779,10,1235).lua b/ers_mtn/nodes/(1779,10,1235).lua new file mode 100644 index 0000000..3de7f76 --- /dev/null +++ b/ers_mtn/nodes/(1779,10,1235).lua @@ -0,0 +1,91 @@ +-- +-- +-- 1779,10,1235 + + + +local einblendung = { +{ " Bergbahn Zugpositionen", "", "", "" }, +{ "", "", "", "" }, +{ "", "", "", "" }, +{ "", "Tal:", "Gleis A/B: %-6s %-6s", "Gleis A Gleis B" }, +} + +-- ------------------------------ + + + +local function disp_update() + + for t=1,4 do + local tl = "" + for z=1,4 do + if z>1 then tl = tl.."\n" end + local h = einblendung[t][z] + if #h < 1 then h = " " end + tl = tl .. h + end + digiline_send("txt"..t,tl) + end + return +end + +-- ------------------------------ + + +if event.type == "punch" then + local text = " AUA!!!" + for i=1,4 do + digiline_send("txt"..i," "..i.."\n"..text) + end + + interrupt(10,"clear") + return +end + + +if event.type == "int" then + if event.message == "clear" then + disp_update() +-- for i=1,4 do +-- digiline_send("txt"..i,i) +-- end + end + return +end + + + + +local zeilen = {"gleisa","gleisb","tal" } + + +if event.type == "ext_int" then + local nachricht = event.message + if nachricht == nil then return end + if type(nachricht) == "string" then + if nachricht == "update" then + local t + local z + local e=1 + for t = 1,4 do + local ausgabe = "" + for z = 1,4 do + if z>1 then ausgabe = ausgabe.."\n" end + ausgabe = ausgabe .. S.daten[e] + e = e+1 + end + digiline_send("txt"..t,ausgabe) + end + return + end + return + end + if type(nachricht) == "table" then + if not nachricht.von_pos then return end + + return + end + return +end + diff --git a/ers_mtn/nodes/(1787,3,1264).lua b/ers_mtn/nodes/(1787,3,1264).lua new file mode 100644 index 0000000..aa971c6 --- /dev/null +++ b/ers_mtn/nodes/(1787,3,1264).lua @@ -0,0 +1,16 @@ +-- +-- +-- 1787,3,1264 + + +if event.type == "train" then + if atc_arrow then + S.section.gleis_a = nil + S.section.tal = event.id + else + S.section.gleis_a = event.id + S.section.tal = nil + end + F.update() + return +end
\ No newline at end of file diff --git a/ers_mtn/nodes/(1793,3,1264).lua b/ers_mtn/nodes/(1793,3,1264).lua new file mode 100644 index 0000000..084819f --- /dev/null +++ b/ers_mtn/nodes/(1793,3,1264).lua @@ -0,0 +1,16 @@ +-- erstazi mountain +-- +-- 1793,3,1264 + + +if event.type == "train" then + if atc_arrow then + S.section.gleis_b = nil + S.section.tal = event.id + else + S.section.gleis_b = event.id + S.section.tal = nil + end + F.update() + return +end
\ No newline at end of file diff --git a/ers_mtn/nodes/(1793,3,1280).lua b/ers_mtn/nodes/(1793,3,1280).lua new file mode 100644 index 0000000..dd48338 --- /dev/null +++ b/ers_mtn/nodes/(1793,3,1280).lua @@ -0,0 +1,8 @@ +-- +-- +-- +-- stop for trains which should not run +-- +-- 1793,3,1280 +-- +-- diff --git a/ers_mtn/nodes/(1820,15,1223).lua b/ers_mtn/nodes/(1820,15,1223).lua new file mode 100644 index 0000000..6e759ad --- /dev/null +++ b/ers_mtn/nodes/(1820,15,1223).lua @@ -0,0 +1,3 @@ +-- +-- +-- 1820,15,1223
\ No newline at end of file diff --git a/ers_mtn/nodes/(1878,119,1237).lua b/ers_mtn/nodes/(1878,119,1237).lua new file mode 100644 index 0000000..812195b --- /dev/null +++ b/ers_mtn/nodes/(1878,119,1237).lua @@ -0,0 +1,4 @@ +-- +-- +-- 1878,119,1237 +-- diff --git a/ers_mtn/nodes/(1896,137,1246).lua b/ers_mtn/nodes/(1896,137,1246).lua new file mode 100644 index 0000000..d0cf0ba --- /dev/null +++ b/ers_mtn/nodes/(1896,137,1246).lua @@ -0,0 +1,6 @@ +-- +-- +-- 1896, 137, 1246 +-- + +-- "kniebeuge", { 1896, 137, 1246 }
\ No newline at end of file diff --git a/il_timetable/init_code.lua b/il_timetable/init_code.lua index 4a61c7f..bac2c9e 100644 --- a/il_timetable/init_code.lua +++ b/il_timetable/init_code.lua @@ -183,11 +183,21 @@ F.ttp={ inside_line_desc = "E1 to Melinka", stn_display = "E1 Melinka ", }, + E1_N = { + outside_text = "[E1] Personhood\nvia Mom Junction, Spawn Main, Ehlodex, The Cube", + inside_line_desc = "E1 to Personhood", + stn_display = "E1 Personhood ", + }, S12_S = { - outside_text = "[S12] Ehlodex\nvia Gardon St., Schwarzschild St., Anju Crossing, Lesnoi", + outside_text = "[S12] Spawn Main\nvia Ehlodex, Schwarzschild St., Anju Crossing, Lesnoi", inside_line_desc = "S12 to Spawn Main", stn_display = "S12 Spawn Main ", }, + S12_N = { + outside_text = "[S12] Silver Coast\nvia Lesnoi, Anju Crossing, Schwarzschild St., Ehlodex", + inside_line_desc = "S12 to Silver Coast", + stn_display = "S12 Silver Coast", + }, } --[[ diff --git a/il_timetable/nodes/(-109,17,680).lua b/il_timetable/nodes/(-109,17,680).lua new file mode 100644 index 0000000..3e25243 --- /dev/null +++ b/il_timetable/nodes/(-109,17,680).lua @@ -0,0 +1,5 @@ +F.ttp_stop({ + stn = "Schwarzschild Passing Track", + doorside = "R", + only_lines={S12=true}, +})
\ No newline at end of file diff --git a/il_timetable/nodes/(-1109,5,-2096).lua b/il_timetable/nodes/(-1109,5,-2096).lua new file mode 100644 index 0000000..dc26cd0 --- /dev/null +++ b/il_timetable/nodes/(-1109,5,-2096).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Mom Junction", + doorside = "R", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(-1112,5,-2124).lua b/il_timetable/nodes/(-1112,5,-2124).lua new file mode 100644 index 0000000..dc26cd0 --- /dev/null +++ b/il_timetable/nodes/(-1112,5,-2124).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Mom Junction", + doorside = "R", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(-1112,5,-3275).lua b/il_timetable/nodes/(-1112,5,-3275).lua new file mode 100644 index 0000000..98df9b1 --- /dev/null +++ b/il_timetable/nodes/(-1112,5,-3275).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Padrana Peninsula", + doorside = "R", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(-1210,9,-3870).lua b/il_timetable/nodes/(-1210,9,-3870).lua new file mode 100644 index 0000000..2e977d6 --- /dev/null +++ b/il_timetable/nodes/(-1210,9,-3870).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Aksums Folly", + doorside = "R", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(-1229,9,-3874).lua b/il_timetable/nodes/(-1229,9,-3874).lua new file mode 100644 index 0000000..2e977d6 --- /dev/null +++ b/il_timetable/nodes/(-1229,9,-3874).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Aksums Folly", + doorside = "R", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(-1731,7,-4402).lua b/il_timetable/nodes/(-1731,7,-4402).lua new file mode 100644 index 0000000..4f7d9b5 --- /dev/null +++ b/il_timetable/nodes/(-1731,7,-4402).lua @@ -0,0 +1,10 @@ +if event.train then + if get_line() == "E1" then + if flip then + set_rc("E1_Mel_Left") + else + set_rc("E1_Mel_Right") + end + flip = not flip + end +end
\ No newline at end of file diff --git a/il_timetable/nodes/(-1929,15,-4581).lua b/il_timetable/nodes/(-1929,15,-4581).lua new file mode 100644 index 0000000..ac7edc1 --- /dev/null +++ b/il_timetable/nodes/(-1929,15,-4581).lua @@ -0,0 +1,13 @@ +local now = rwt.now() +local rwt_left = rwt.next_rpt(now, "05;00", "02;30") +local rwt_right = rwt.next_rpt(now, "05;00", "00;00") +local stringl = "Track 5 | E1 Personhood | "..rwt.to_string(rwt_left, true) +local stringr = "Track 4 | E1 Personhood | "..rwt.to_string(rwt_right, true) + +if rwt.diff(rwt_left, rwt_right) > 0 then + digiline_send("left", stringl.." | <Board") + digiline_send("right", stringr) +else + digiline_send("left", stringl) + digiline_send("right", stringr.." | Board>") +end
\ No newline at end of file diff --git a/il_timetable/nodes/(-1934,13,-4577).lua b/il_timetable/nodes/(-1934,13,-4577).lua new file mode 100644 index 0000000..6f18244 --- /dev/null +++ b/il_timetable/nodes/(-1934,13,-4577).lua @@ -0,0 +1,16 @@ +F.ttp_begin({ + stn = "Melinka", -- station name + tt = "E1_N", -- timetable ID +-- depint = "02;30", --departure slot interval +-- depoff = "00;45", --departure slot offset + depint = "05;00", + depoff = "00;00", + doorside = "L", + reverse = true, + only_lines = { E1 = true }, + force_tt_reset = false, +}) + +if event.train then + set_rc("") +end
\ No newline at end of file diff --git a/il_timetable/nodes/(-1937,21,-4581).lua b/il_timetable/nodes/(-1937,21,-4581).lua new file mode 100644 index 0000000..007736b --- /dev/null +++ b/il_timetable/nodes/(-1937,21,-4581).lua @@ -0,0 +1,12 @@ +-- this will be triggered by the digiline messages of the other luacontroller +if event.on then +F.ttp_station_display({ + lines = {"E1_S", "E1_N"}, + departure = {}, + station = "Melinka", + title = "Melinka", +-- interval = 15, + display1 = "d1", +-- display2 = "d2", +}) +end
\ No newline at end of file diff --git a/il_timetable/nodes/(-435,23,377).lua b/il_timetable/nodes/(-435,23,377).lua new file mode 100644 index 0000000..79457dd --- /dev/null +++ b/il_timetable/nodes/(-435,23,377).lua @@ -0,0 +1,5 @@ +F.ttp_stop({ + stn = "Anju Crossing Central", + doorside = "R", + only_lines={E1=true}, +})
\ No newline at end of file diff --git a/il_timetable/nodes/(-441,23,384).lua b/il_timetable/nodes/(-441,23,384).lua new file mode 100644 index 0000000..ed6368b --- /dev/null +++ b/il_timetable/nodes/(-441,23,384).lua @@ -0,0 +1,5 @@ +F.ttp_stop({ + stn = "Anju Crossing Central", + doorside = "R", + only_lines={S12=true}, +})
\ No newline at end of file diff --git a/il_timetable/nodes/(-524,23,-215).lua b/il_timetable/nodes/(-524,23,-215).lua new file mode 100644 index 0000000..e1df782 --- /dev/null +++ b/il_timetable/nodes/(-524,23,-215).lua @@ -0,0 +1,5 @@ +F.ttp_stop({ + stn = "Community of Laza", + doorside = "R", + only_lines={S12=true}, +})
\ No newline at end of file diff --git a/il_timetable/nodes/(-524,23,-58).lua b/il_timetable/nodes/(-524,23,-58).lua new file mode 100644 index 0000000..3a20545 --- /dev/null +++ b/il_timetable/nodes/(-524,23,-58).lua @@ -0,0 +1,5 @@ +F.ttp_stop({ + stn = "Lesnoi Sued", + doorside = "R", + only_lines={S12=true}, +})
\ No newline at end of file diff --git a/il_timetable/nodes/(-524,23,82).lua b/il_timetable/nodes/(-524,23,82).lua new file mode 100644 index 0000000..dbcb99e --- /dev/null +++ b/il_timetable/nodes/(-524,23,82).lua @@ -0,0 +1,5 @@ +F.ttp_stop({ + stn = "Lesnoi Nord", + doorside = "R", + only_lines={S12=true}, +})
\ No newline at end of file diff --git a/il_timetable/nodes/(-527,23,-228).lua b/il_timetable/nodes/(-527,23,-228).lua index 13eaead..e1df782 100644 --- a/il_timetable/nodes/(-527,23,-228).lua +++ b/il_timetable/nodes/(-527,23,-228).lua @@ -2,5 +2,4 @@ F.ttp_stop({ stn = "Community of Laza", doorside = "R", only_lines={S12=true}, - end_of_tt={S12_S=true}, })
\ No newline at end of file diff --git a/il_timetable/nodes/(-617,14,-411).lua b/il_timetable/nodes/(-617,14,-411).lua index f20b2a4..121c3f4 100644 --- a/il_timetable/nodes/(-617,14,-411).lua +++ b/il_timetable/nodes/(-617,14,-411).lua @@ -1,4 +1,11 @@ --- d_int: Departure every n seconds (epoch modulo) --- d_off: Departure time offset --- function F.stop_sd(st_name, doors, departcommand, minstoptime, d_int, d_off) ---F.stop_sd_sched("Main Station", "R", "RSM", 30, 240, 35)
\ No newline at end of file +F.ttp_begin({ + stn = "Spawn Main", -- station name + tt = "S12_N", -- timetable ID + depint = "02;30", --departure slot interval + depoff = "00;45", --departure slot offset + doorside = "R", + reverse = true, + only_lines = { S12 = true }, + force_tt_reset =false, +}) + diff --git a/il_timetable/nodes/(-643,15,-424).lua b/il_timetable/nodes/(-643,15,-424).lua index 2ab3bd0..f5190dc 100644 --- a/il_timetable/nodes/(-643,15,-424).lua +++ b/il_timetable/nodes/(-643,15,-424).lua @@ -1,8 +1,8 @@ F.ttp_station_display({ - lines = {"E1_S"}, + lines = {"E1_S", "E1_N"}, departure = {}, station = "Spawn Main", - title = "Spawn Main (T.6)", + title = "Spawn Main T5/6", interval = 15, display1 = "display1", })
\ No newline at end of file diff --git a/il_timetable/nodes/(-966,5,-756).lua b/il_timetable/nodes/(-966,5,-756).lua new file mode 100644 index 0000000..8bae7d7 --- /dev/null +++ b/il_timetable/nodes/(-966,5,-756).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Mountain South", + doorside = "R", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(-993,5,-753).lua b/il_timetable/nodes/(-993,5,-753).lua new file mode 100644 index 0000000..8bae7d7 --- /dev/null +++ b/il_timetable/nodes/(-993,5,-753).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Mountain South", + doorside = "R", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(1017,8,1011).lua b/il_timetable/nodes/(1017,8,1011).lua new file mode 100644 index 0000000..7793f30 --- /dev/null +++ b/il_timetable/nodes/(1017,8,1011).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Ehlodex", + doorside = "L", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(1020,11,1021).lua b/il_timetable/nodes/(1020,11,1021).lua index dc3083a..705eed3 100644 --- a/il_timetable/nodes/(1020,11,1021).lua +++ b/il_timetable/nodes/(1020,11,1021).lua @@ -1,5 +1,5 @@ F.ttp_station_display({ - lines = {"S12_S"}, + lines = {"S12_S", "S12_N"}, departure = {}, station = "Ehlodex", title = "Ehlodex", diff --git a/il_timetable/nodes/(1222,3,1011).lua b/il_timetable/nodes/(1222,3,1011).lua new file mode 100644 index 0000000..d3e713e --- /dev/null +++ b/il_timetable/nodes/(1222,3,1011).lua @@ -0,0 +1,5 @@ +F.ttp_stop({ + stn = "Silver Coast Central", + doorside = "L", + end_of_tt = {S12_N = true}, +})
\ No newline at end of file diff --git a/il_timetable/nodes/(144,11,892).lua b/il_timetable/nodes/(144,11,892).lua new file mode 100644 index 0000000..7943557 --- /dev/null +++ b/il_timetable/nodes/(144,11,892).lua @@ -0,0 +1,5 @@ +F.ttp_stop({ + stn = "Schwarzschild Street", + doorside = "R", + only_lines={S12=true}, +})
\ No newline at end of file diff --git a/il_timetable/nodes/(152,11,892).lua b/il_timetable/nodes/(152,11,892).lua new file mode 100644 index 0000000..a00ccff --- /dev/null +++ b/il_timetable/nodes/(152,11,892).lua @@ -0,0 +1,5 @@ +F.ttp_stop({ + stn = "Schwarzschild Street", + doorside = "L", + only_lines={E1=true}, +})
\ No newline at end of file diff --git a/il_timetable/nodes/(1543,21,2653).lua b/il_timetable/nodes/(1543,21,2653).lua new file mode 100644 index 0000000..9b7580d --- /dev/null +++ b/il_timetable/nodes/(1543,21,2653).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Personhood South", + doorside = "R", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(1722,30,2937).lua b/il_timetable/nodes/(1722,30,2937).lua new file mode 100644 index 0000000..d28bc16 --- /dev/null +++ b/il_timetable/nodes/(1722,30,2937).lua @@ -0,0 +1,9 @@ +F.ttp_station_display({ + lines = {"E1_N", "E1_S"}, + departure = {}, + station = "Personhood Main", + title = "Personhood Main", + interval = 15, + display1 = "d1", +-- display2 = "d2", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(1734,26,2922).lua b/il_timetable/nodes/(1734,26,2922).lua index 9d37365..2980622 100644 --- a/il_timetable/nodes/(1734,26,2922).lua +++ b/il_timetable/nodes/(1734,26,2922).lua @@ -8,5 +8,3 @@ F.ttp_begin({ only_lines = { E1 = true }, force_tt_reset = false, }) - -atc_set_text_outside("[E1] Melinka Town via Spawn")
\ No newline at end of file diff --git a/il_timetable/nodes/(197,14,1011).lua b/il_timetable/nodes/(197,14,1011).lua new file mode 100644 index 0000000..357e32c --- /dev/null +++ b/il_timetable/nodes/(197,14,1011).lua @@ -0,0 +1,5 @@ +F.ttp_stop({ + stn = "Minkovsky Street", + doorside = "R", + only_lines={S12=true}, +})
\ No newline at end of file diff --git a/il_timetable/nodes/(670,14,1011).lua b/il_timetable/nodes/(670,14,1011).lua new file mode 100644 index 0000000..0ed504e --- /dev/null +++ b/il_timetable/nodes/(670,14,1011).lua @@ -0,0 +1,5 @@ +F.ttp_stop({ + stn = "Gardon Street", + doorside = "R", + only_lines={S12=true}, +})
\ No newline at end of file diff --git a/il_timetable/nodes/(960,14,1063).lua b/il_timetable/nodes/(960,14,1063).lua new file mode 100644 index 0000000..5e0be27 --- /dev/null +++ b/il_timetable/nodes/(960,14,1063).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Ehlodex", + doorside = "R", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(964,16,1067).lua b/il_timetable/nodes/(964,16,1067).lua new file mode 100644 index 0000000..18d98f2 --- /dev/null +++ b/il_timetable/nodes/(964,16,1067).lua @@ -0,0 +1,8 @@ +F.ttp_station_display({ + lines = {"E1_N"}, + departure = {}, + station = "Ehlodex", + title = "Ehlodex", + interval = 30, + display1 = "d1", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(981,15,1041).lua b/il_timetable/nodes/(981,15,1041).lua index 3301300..fc2d491 100644 --- a/il_timetable/nodes/(981,15,1041).lua +++ b/il_timetable/nodes/(981,15,1041).lua @@ -1,5 +1,5 @@ F.ttp_station_display({ - lines = {"S12_S", "E1_S", "CFE_S", "NX_S"}, + lines = {"S12_S", "S12_N", "E1_S", "E1_N", "CFE_S", "NX_S"}, departure = {}, station = "Ehlodex", title = "Ehlodex", diff --git a/il_timetable/nodes/(983,21,1053).lua b/il_timetable/nodes/(983,21,1053).lua new file mode 100644 index 0000000..4c89cef --- /dev/null +++ b/il_timetable/nodes/(983,21,1053).lua @@ -0,0 +1,5 @@ +lines = F.ttp_info_times("E1_N", "00;00") +linestr = F.ttp_info_trains("E1_N", "00;00") +li = lines +for i=1,#linestr do li[#li+1] = linestr[i] end +print(" E1\n"..table.concat(li, "\n"))
\ No newline at end of file diff --git a/subway/nodes/(123,13,-12).lua b/subway/nodes/(123,13,-12).lua new file mode 100644 index 0000000..27f4a4c --- /dev/null +++ b/subway/nodes/(123,13,-12).lua @@ -0,0 +1,4 @@ +if event.type == "ext_int" then + digiline_send("orhb","toggle") + return +end
\ No newline at end of file diff --git a/subway/nodes/(2644,15,4349).lua b/subway/nodes/(2644,15,4349).lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/subway/nodes/(2644,15,4349).lua |