diff options
author | autocommitter <autocommitter@linux-forks.de> | 2024-10-15 22:37:32 +0200 |
---|---|---|
committer | autocommitter <autocommitter@linux-forks.de> | 2024-10-15 22:37:32 +0200 |
commit | 5c7f77725394d47ce0b907aabf885ea207a507bd (patch) | |
tree | a1ff9c67ef8f225a259e4c6f4c163a45c58bb870 | |
parent | b435d1b1b26db6f7c4f3eb589ecf1ed3bb79b57e (diff) | |
download | luaatc_envs-5c7f77725394d47ce0b907aabf885ea207a507bd.tar.gz luaatc_envs-5c7f77725394d47ce0b907aabf885ea207a507bd.tar.bz2 luaatc_envs-5c7f77725394d47ce0b907aabf885ea207a507bd.zip |
State at 2024-10-15
188 files changed, 2375 insertions, 224 deletions
diff --git a/Crossroads/nodes/(1122,16,2769).lua b/Crossroads/nodes/(1122,16,2769).lua new file mode 100644 index 0000000..27a6f78 --- /dev/null +++ b/Crossroads/nodes/(1122,16,2769).lua @@ -0,0 +1 @@ +F.stn2gen("grsc", "4", "R")
\ No newline at end of file diff --git a/Crossroads/nodes/(1545,6,7947).lua b/Crossroads/nodes/(1545,6,7947).lua new file mode 100644 index 0000000..8d006a8 --- /dev/null +++ b/Crossroads/nodes/(1545,6,7947).lua @@ -0,0 +1 @@ +F.x_on {NRG_1 = 1}
\ No newline at end of file diff --git a/Crossroads/nodes/(1623,6,7920).lua b/Crossroads/nodes/(1623,6,7920).lua new file mode 100644 index 0000000..fdab00b --- /dev/null +++ b/Crossroads/nodes/(1623,6,7920).lua @@ -0,0 +1,2 @@ +F.tram2gen("NRG-bplatz","S",false) +F.x_off{NRG_3 = 1}
\ No newline at end of file diff --git a/Crossroads/nodes/(1625,6,7988).lua b/Crossroads/nodes/(1625,6,7988).lua index 8072a09..bd10f3a 100644 --- a/Crossroads/nodes/(1625,6,7988).lua +++ b/Crossroads/nodes/(1625,6,7988).lua @@ -1 +1,3 @@ -F.tram2gen("NRG-south","N",false)
\ No newline at end of file +F.tram2gen("NRG-south","N",false) +F.x_off{NRG_5 = 1} +F.sx_on{NRG_6 = 1, NRG_7 = 1}
\ No newline at end of file diff --git a/Crossroads/nodes/(1671,18,8231).lua b/Crossroads/nodes/(1671,18,8231).lua new file mode 100644 index 0000000..e361a24 --- /dev/null +++ b/Crossroads/nodes/(1671,18,8231).lua @@ -0,0 +1 @@ +F.stn2gen("NRG-pek", "1", "L", true)
\ No newline at end of file diff --git a/Crossroads/nodes/(1722,27,929).lua b/Crossroads/nodes/(1722,27,929).lua new file mode 100644 index 0000000..02fd367 --- /dev/null +++ b/Crossroads/nodes/(1722,27,929).lua @@ -0,0 +1,88 @@ +local head = { "V TRAIN LINE TIME", "ST TRK STATION ", " " } +local length = 18 +local height = 4 +local sformat = string.format + +if event.type=="digiline" or event.type=="punch" then + if event.channel=="upd_main" or event.type=="punch" then + local ts = os.time() + local table = table + local start_t = os.clock() + if not S.lagrec then S.lagrec = {} end + local ids = {} + for i in pairs(S.trains) do ids[#ids+1] = i end + table.sort(ids, function(a, b) + local ta, tb = S.trains[a], S.trains[b] + if ta.l == tb.l then + return a < b + else + return ta.l < tb.l + end + end) + --do return end + local disp = {{}, {}, {}} + local percol = height*4-1 + for id = 1, #ids, 1 do + local st = (S.trains[ids[id] or 0] or {}) + local i = math.floor((id-1)/percol) + local j = math.floor(((id-1)%percol+1)/4)+1 + local stn = sformat("%-3s %-3s %s", st.mode or "", st.t or "N/A", F.stnlist[st.s] or st.s) + stn = stn:gsub("ä","ae"):gsub("ö","oe"):gsub("ü","ue"):gsub("ß","ss") + local dt = ts - (st.ts or -1) + local td = "" + if dt < 60 then + td = sformat("%5ds", dt) + elseif dt < 3600 then + td = sformat("%2dm%02ds", math.floor(dt/60), dt%60) + elseif dt < 86400 then + td = sformat("%2dh%02dm", math.floor(dt/3600), math.floor(dt/60)%60) + elseif dt < 8640000 then + td = sformat("%2dd%02dh", math.floor(dt/86400), math.floor(dt/3600)%24) + elseif st.ts then + td = sformat("%5dd", math.floor(dt/86400)) + end + local line = { + sformat("%02d %06d %-7s %s", st.v, ids[id], st.l, td), + stn, + stn:len() > 27 and stn:sub(28) or " ", + } + for df, fstr in pairs(line) do + local ft = disp[df] + local ct = ft[i] + if not ct then + ct = {{head[df]}} + ft[i] = ct + end + local rt = ct[j] + if not rt then + rt = {} + ct[j] = rt + end + table.insert(rt, fstr) + end + end + for fi, ft in pairs(disp) do + for fc, ct in pairs(ft) do + for fr, rt in pairs(ct) do + digiline_send(tostring((fi+fc*3)*10+fr), table.concat(rt or {}, "\n")) + end + end + end + local end_t = os.clock() + local t = end_t - start_t + local lagrec = S.lagrec + if t > (lagrec.max or 0) then + lagrec.max = t + end + if t < (lagrec.min or math.huge) then + lagrec.min = t + end + avg = t + if lagrec.avg then + avg = (lagrec.avg+t)/2 + end + lagrec.avg = avg + digiline_send("lag1", sformat("DEBUG\nTRAINS: %d\nTS: %d", #ids, ts)) + digiline_send("lag2", sformat("CUR %f\nMIN %f\nMAX %f\nAVG %f", t, lagrec.min, lagrec.max, avg)) + end +end
\ No newline at end of file diff --git a/Crossroads/nodes/(1922,19,8223).lua b/Crossroads/nodes/(1922,19,8223).lua index a50daaa..80be033 100644 --- a/Crossroads/nodes/(1922,19,8223).lua +++ b/Crossroads/nodes/(1922,19,8223).lua @@ -1 +1 @@ -F.stn2gen("krasnograd", "W", "L", true, true)
\ No newline at end of file +F.stn2gen("krasnograd", "2", "R")
\ No newline at end of file diff --git a/Crossroads/nodes/(2010,3,5938).lua b/Crossroads/nodes/(2010,3,5938).lua index 4716a64..750be29 100644 --- a/Crossroads/nodes/(2010,3,5938).lua +++ b/Crossroads/nodes/(2010,3,5938).lua @@ -1,4 +1,4 @@ -do return end +--do return end if event.type == "punch" then for i = 1, 4, 1 do cancel_route("mary4-testsignal-"..tostring(i)) diff --git a/Crossroads/nodes/(2610,12,8155).lua b/Crossroads/nodes/(2610,12,8155).lua new file mode 100644 index 0000000..afc35a3 --- /dev/null +++ b/Crossroads/nodes/(2610,12,8155).lua @@ -0,0 +1 @@ +F.ax_on{SWALD_2 = "W"}
\ No newline at end of file diff --git a/auto_yards/nodes/(-1901,16,844).lua b/auto_yards/nodes/(-1901,16,844).lua new file mode 100644 index 0000000..89349e3 --- /dev/null +++ b/auto_yards/nodes/(-1901,16,844).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1901,16,850).lua b/auto_yards/nodes/(-1901,16,850).lua new file mode 100644 index 0000000..89349e3 --- /dev/null +++ b/auto_yards/nodes/(-1901,16,850).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1901,16,856).lua b/auto_yards/nodes/(-1901,16,856).lua new file mode 100644 index 0000000..89349e3 --- /dev/null +++ b/auto_yards/nodes/(-1901,16,856).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1901,16,862).lua b/auto_yards/nodes/(-1901,16,862).lua new file mode 100644 index 0000000..89349e3 --- /dev/null +++ b/auto_yards/nodes/(-1901,16,862).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1913,16,857).lua b/auto_yards/nodes/(-1913,16,857).lua new file mode 100644 index 0000000..89349e3 --- /dev/null +++ b/auto_yards/nodes/(-1913,16,857).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1918,16,840).lua b/auto_yards/nodes/(-1918,16,840).lua new file mode 100644 index 0000000..2d94f29 --- /dev/null +++ b/auto_yards/nodes/(-1918,16,840).lua @@ -0,0 +1 @@ +F.classification("ARC",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1922,16,840).lua b/auto_yards/nodes/(-1922,16,840).lua new file mode 100644 index 0000000..89349e3 --- /dev/null +++ b/auto_yards/nodes/(-1922,16,840).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1938,16,805).lua b/auto_yards/nodes/(-1938,16,805).lua new file mode 100644 index 0000000..4503e25 --- /dev/null +++ b/auto_yards/nodes/(-1938,16,805).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1946,16,840).lua b/auto_yards/nodes/(-1946,16,840).lua index def9136..4dd7c28 100644 --- a/auto_yards/nodes/(-1946,16,840).lua +++ b/auto_yards/nodes/(-1946,16,840).lua @@ -11,6 +11,7 @@ local subs = { ['S27'] = {['pos'] = POS(-1515,7,-2625), ['msg'] = "notify"}, ['ARC_SB'] = {['pos'] = POS(-1973,16,800), ['msg'] = "notify"}, + ['ARC_LOAD_DOCK'] = {['pos'] = POS(-1973,16,800), ['msg'] = "notify_local"}, ['CANNERY'] = {['pos'] = POS(-630,26,2454), ['msg'] = "notify"}, } diff --git a/auto_yards/nodes/(-1947,16,837).lua b/auto_yards/nodes/(-1947,16,837).lua index f77e28c..7ddaaf6 100644 --- a/auto_yards/nodes/(-1947,16,837).lua +++ b/auto_yards/nodes/(-1947,16,837).lua @@ -1,2 +1,2 @@ -S.yards.ARC.notify = {['ARC_SB'] = true, ['CANNERY'] = true} +S.yards.ARC.notify = {['ARC_LOAD'] = true} print(S.yards.ARC.notify)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1961,16,809).lua b/auto_yards/nodes/(-1961,16,809).lua new file mode 100644 index 0000000..4503e25 --- /dev/null +++ b/auto_yards/nodes/(-1961,16,809).lua @@ -0,0 +1 @@ +F.lane_EOL("ARC",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-2004,3,-1099).lua b/auto_yards/nodes/(-2004,3,-1099).lua index 8f4b247..101a393 100644 --- a/auto_yards/nodes/(-2004,3,-1099).lua +++ b/auto_yards/nodes/(-2004,3,-1099).lua @@ -4,4 +4,4 @@ for k in pairs(S.yards.BY.notify) do s = s ..k..", " end s = s.."--" -digiline_send("notification_screen",s)
\ No newline at end of file +digiline_send("lcd",s)
\ No newline at end of file diff --git a/auto_yards/nodes/(-2029,19,733).lua b/auto_yards/nodes/(-2029,19,733).lua index 2672033..f88c9f0 100644 --- a/auto_yards/nodes/(-2029,19,733).lua +++ b/auto_yards/nodes/(-2029,19,733).lua @@ -1,5 +1,14 @@ local yard_id = "ARC" if event.train then + if F.has_rc("ARC_YARD_REENTRY") then + -- loco will use S23-S approach track as headshunt and re-enter yard + -- RC will be removed by the headshunt controller (req to trigger it) + -- manually set the route here before ARS has a chance + set_route(POS(-2033,21,731),"Yard Reentry (LENGTH LIMIT)") + -- defer re-enabling ARS to ensure the route has been accepted, if not set + atc_send("S4D1A1") + return + end if F.has_rc(yard_id.."_LIGHT_EXIT") then F.remove_rc(yard_id.."_LIGHT_EXIT") atc_set_ars_disable(false) diff --git a/auto_yards/nodes/(-2038,20,730).lua b/auto_yards/nodes/(-2038,20,730).lua index a790746..cf774a3 100644 --- a/auto_yards/nodes/(-2038,20,730).lua +++ b/auto_yards/nodes/(-2038,20,730).lua @@ -3,4 +3,5 @@ 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 + print("ARC YARD Manually Disabled") 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 index 9d743b7..df83930 100644 --- a/auto_yards/nodes/(-4023,12,-2660).lua +++ b/auto_yards/nodes/(-4023,12,-2660).lua @@ -1,6 +1,7 @@ local yard_id = "TY" local subs = { -- ['MMF'] = {['pos'] = POS(1,2,3), ['msg'] = "notify"}, + ['DLG'] = {['pos'] = POS(-4152,13,-5840), ['msg'] = "notify"}, } if event.ext_int or event.punch then diff --git a/auto_yards/nodes/(-4148,13,-5844).lua b/auto_yards/nodes/(-4148,13,-5844).lua new file mode 100644 index 0000000..06ab20e --- /dev/null +++ b/auto_yards/nodes/(-4148,13,-5844).lua @@ -0,0 +1,45 @@ +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +local rev_rc = "DLG_HS_S" +local rm_rc = true +local autocouple = "DLG_HS_S_AC" +local rm_cpl_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 not atc_arrow then --train has bounced + if F.has_rc(autocouple) then + atc_send("CplS0WD2S1") + if rm_cpl_rc then F.remove_rc({autocouple}) end + end + return + end + + if not F.has_rc(rev_rc) then --not our train. disregard + 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/auto_yards/nodes/(-524,26,2481).lua b/auto_yards/nodes/(-524,26,2481).lua new file mode 100644 index 0000000..74a7624 --- /dev/null +++ b/auto_yards/nodes/(-524,26,2481).lua @@ -0,0 +1,2 @@ +-- EOL +F.lane_EOL("CAN",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-563,26,2472).lua b/auto_yards/nodes/(-563,26,2472).lua new file mode 100644 index 0000000..74a7624 --- /dev/null +++ b/auto_yards/nodes/(-563,26,2472).lua @@ -0,0 +1,2 @@ +-- EOL +F.lane_EOL("CAN",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-584,26,2481).lua b/auto_yards/nodes/(-584,26,2481).lua new file mode 100644 index 0000000..46e3050 --- /dev/null +++ b/auto_yards/nodes/(-584,26,2481).lua @@ -0,0 +1,2 @@ +-- EOL +F.lane_EOL("CAN",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-588,26,2504).lua b/auto_yards/nodes/(-588,26,2504).lua new file mode 100644 index 0000000..46e3050 --- /dev/null +++ b/auto_yards/nodes/(-588,26,2504).lua @@ -0,0 +1,2 @@ +-- EOL +F.lane_EOL("CAN",true)
\ No newline at end of file diff --git a/auto_yards/nodes/(-588,26,2534).lua b/auto_yards/nodes/(-588,26,2534).lua new file mode 100644 index 0000000..74a7624 --- /dev/null +++ b/auto_yards/nodes/(-588,26,2534).lua @@ -0,0 +1,2 @@ +-- EOL +F.lane_EOL("CAN",false)
\ No newline at end of file diff --git a/auto_yards/nodes/(-630,26,2454).lua b/auto_yards/nodes/(-630,26,2454).lua index e01fb60..5715c34 100644 --- a/auto_yards/nodes/(-630,26,2454).lua +++ b/auto_yards/nodes/(-630,26,2454).lua @@ -3,7 +3,7 @@ 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") + set_rc("FREIGHT CAN_LOCOSTORE CAN_LIGHT_EXIT EWL-W EWL S23 ARC_AUTO ARC_RTS ARC_COLLECT_CANNERY ARC_AUTO_S23N CANNERY CAN_RTS CAN_COLLECT_ARC") atc_send("S0WRD2A1S4") F.indicator(ind,false) end diff --git a/auto_yards/nodes/(-643,26,2475).lua b/auto_yards/nodes/(-643,26,2475).lua index 1523fcd..086074b 100644 --- a/auto_yards/nodes/(-643,26,2475).lua +++ b/auto_yards/nodes/(-643,26,2475).lua @@ -1,68 +1,37 @@ -local yard_id = "CAN" +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +local rev_rc = "CAN_HS_N" +local rm_rc = true +local autocouple = "CAN_HS_N_AC" +local rm_cpl_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 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 + if not atc_arrow then --train has bounced + if F.has_rc(autocouple) then + atc_send("CplS0WD2S1") + if rm_cpl_rc then F.remove_rc({autocouple}) end 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 + if not F.has_rc(rev_rc) then --not our train. disregard + 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 --this is a duplicate of the reversing schedule in the env anyway +if event.schedule then if not atc_id then --bounce the train that just passed atc_send_to_train(event.msg,"B0WRD1A1S3") else @@ -71,13 +40,6 @@ if event.schedule then --this is a duplicate of the reversing schedule in the en 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 +end
\ No newline at end of file diff --git a/auto_yards/nodes/(-719,20,2475).lua b/auto_yards/nodes/(-719,20,2475).lua new file mode 100644 index 0000000..acfc06a --- /dev/null +++ b/auto_yards/nodes/(-719,20,2475).lua @@ -0,0 +1,10 @@ +local yard_id = "CAN" +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/(1178,16,3851).lua b/auto_yards/nodes/(1178,16,3851).lua index 6d126c4..bc78e81 100644 --- a/auto_yards/nodes/(1178,16,3851).lua +++ b/auto_yards/nodes/(1178,16,3851).lua @@ -1,6 +1,7 @@ local yard_id = "IP" local subs = { ['WOA_mine_empty'] = {['pos'] = POS(1949,7,9112), ['msg'] = "notify"}, + ['OAF_Logging'] = {['pos'] = POS(1843, 17, 4278), ['msg'] = "notify"}, } if event.ext_int or event.punch then diff --git a/durt/nodes/(-1459,11,-2588).lua b/durt/nodes/(-1459,11,-2588).lua index 3b1b94b..6ee3c74 100644 --- a/durt/nodes/(-1459,11,-2588).lua +++ b/durt/nodes/(-1459,11,-2588).lua @@ -4,5 +4,6 @@ if event.train and atc_arrow then F.add_rc({"S27_HS_E","S27_DOCK3"}) return end + step_fc() F.add_rc("S27_EXIT") end
\ No newline at end of file diff --git a/durt/nodes/(-1476,11,-2588).lua b/durt/nodes/(-1476,11,-2588).lua new file mode 100644 index 0000000..2701812 --- /dev/null +++ b/durt/nodes/(-1476,11,-2588).lua @@ -0,0 +1,14 @@ +__approach_callback_mode = 1 + +if event.approach and not event.has_entered then + atc_set_ars_disable(true) + atc_set_lzb_tsr(1) +end + +if event.train then + if atc_arrow then + atc_send("B1") + else + digiline_send("unloader","start") + end +end
\ No newline at end of file diff --git a/durt/nodes/(-1501,11,-2588).lua b/durt/nodes/(-1501,11,-2588).lua new file mode 100644 index 0000000..2701812 --- /dev/null +++ b/durt/nodes/(-1501,11,-2588).lua @@ -0,0 +1,14 @@ +__approach_callback_mode = 1 + +if event.approach and not event.has_entered then + atc_set_ars_disable(true) + atc_set_lzb_tsr(1) +end + +if event.train then + if atc_arrow then + atc_send("B1") + else + digiline_send("unloader","start") + end +end
\ No newline at end of file diff --git a/durt/nodes/(-1514,11,-2588).lua b/durt/nodes/(-1514,11,-2588).lua index be0bf95..ada2667 100644 --- a/durt/nodes/(-1514,11,-2588).lua +++ b/durt/nodes/(-1514,11,-2588).lua @@ -10,8 +10,8 @@ if event.train then atc_set_ars_disable(false) atc_send("S3") F.add_rc("S27_EXIT_BRIDGE") + step_fc() return end atc_send("S1") - step_fc() end
\ No newline at end of file diff --git a/durt/nodes/(-1515,7,-2625).lua b/durt/nodes/(-1515,7,-2625).lua index 2fd2155..9ae53c0 100644 --- a/durt/nodes/(-1515,7,-2625).lua +++ b/durt/nodes/(-1515,7,-2625).lua @@ -2,7 +2,7 @@ local notification_id = "S27" local ind = POS(-1513,8,-2613) local print_notification = true local function send_train() - set_rc("FREIGHT S23 ARCAUTO ARC_RTS ARC_COLLECT_S27 ARC_AUTO_S23S TanhX_SBS23toE3 MGGRatHYARD S27 S27_UNLOAD S27_Overburden S27_EXIT") + set_rc("FREIGHT S23 ARC_AUTO ARC_RTS ARC_COLLECT_S27 ARC_AUTO_S23S TanhX_SBS23toE3 MGGRatHYARD S27 S27_UNLOAD S27_Overburden S27_EXIT") atc_send("S0WRD2A1S4") F.indicator(ind,false) end diff --git a/durt/nodes/(-1910,16,855).lua b/durt/nodes/(-1910,16,855).lua new file mode 100644 index 0000000..9fde58a --- /dev/null +++ b/durt/nodes/(-1910,16,855).lua @@ -0,0 +1,27 @@ +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +-- cut down to ensure all trains bounce +__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 and atc_arrow then + 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/(-1950,16,865).lua b/durt/nodes/(-1950,16,865).lua new file mode 100644 index 0000000..9fde58a --- /dev/null +++ b/durt/nodes/(-1950,16,865).lua @@ -0,0 +1,27 @@ +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +-- cut down to ensure all trains bounce +__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 and atc_arrow then + 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/(-1973,16,800).lua b/durt/nodes/(-1973,16,800).lua new file mode 100644 index 0000000..e6166e8 --- /dev/null +++ b/durt/nodes/(-1973,16,800).lua @@ -0,0 +1,71 @@ +local notification_id = "ARC" +local ind = POS(-1954,16,840) +local print_notification = true +local sections ={ + store_4 = "032832" -- Destined for Arcadius Basement Loading Dock +} +local function send_train() + atc_send("S0WRD2A1S4") + local cmd = { -- collect wagons from BYARD, and park loco in loco siding if no departures at ARC + "FREIGHT", + "ARC_LOCOSTORE", + "ARC_AUTO", + "ARC_RTS", + "ARC_COLLECT_ARC_SB", + "ARC_AUTO_S23S", + "S23E3N", + "BYARD", + "BY_RTS", + "BY_COLLECT_ARC", + "E3S23N", + "ARC_LIGHT_EXIT" + } + if #section_occupancy(sections.store_4) ~= 0 then + if print_notification then print(rwt.to_string(rwt.now()).. " "..notification_id.." send_train() has local job from STORE_4") end + -- perform local job to Arcadius Basement Loading Dock before taking wagons to BYARD + cmd = { + "FREIGHT", --because it's freight + "ARC_LOCOSTORE", --technically the loco identifier until we have wagon ID. will be ignored by yard_headshunt because no "ARC_DEPART" etc + "ARC_YARD_REENTRY", --redirect back into the yard from yard_exit controller. will be checked by yard_exit before ARS triggers + "ARC_RTS", --basic yard call + "ARC_COLLECT_ARC_LOAD_DOCK", -- collect req wagons. can be left in place, if train_length == 1 then will return to siding anyway + "ARC_AUTO_LOCAL_LOADING", --direct to ARC Basement Loading Dock + "ARC_LOAD", --trigger the loading track + } + end + set_rc(table.concat(cmd," ")) + atc_send("S0WRD2A1S4") + F.indicator(ind,false) -- will be reenabled by returning the wagons from the local job +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 + end + if event.message == "notify_local" then + if print_notification then print(rwt.to_string(rwt.now()).. " "..notification_id.." RX Notification - Local Job") 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/(-2039,19,719).lua b/durt/nodes/(-2039,19,719).lua new file mode 100644 index 0000000..107d03f --- /dev/null +++ b/durt/nodes/(-2039,19,719).lua @@ -0,0 +1,47 @@ +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +-- Modified to change the turnout for Arc Auto Yard reentry +local rev_rc = "ARC_YARD_REENTRY" +local rm_rc = true +local autocouple = nil --no need to worry about autocoupling +local rm_cpl_rc = false --no need to worry about autocoupling + +__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 not atc_arrow then --train has bounced + if F.has_rc(autocouple) then + atc_send("CplS0WD2S1") + if rm_cpl_rc then F.remove_rc({autocouple}) end + end + return + end + + if not F.has_rc(rev_rc) then --not our train. disregard + 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") + setstate(POS(-2038,19,720),"st") + F.remove_rc("ARC_AUTO_YARD_REENTRY") + 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/(-2077,19,707).lua b/durt/nodes/(-2077,19,707).lua new file mode 100644 index 0000000..e5cef53 --- /dev/null +++ b/durt/nodes/(-2077,19,707).lua @@ -0,0 +1,7 @@ +-- clean up loose RCs +-- step the FC forward in preparation for the auto yard +if event.train and atc_arrow then + if F.has_rc("ARC_AUTO") then + step_fc() + end +end
\ No newline at end of file diff --git a/durt/nodes/(-2077,3,788).lua b/durt/nodes/(-2077,3,788).lua index 669248a..ad1d7d2 100644 --- a/durt/nodes/(-2077,3,788).lua +++ b/durt/nodes/(-2077,3,788).lua @@ -1,25 +1,28 @@ -local dir_indicator = POS(-2079,7,803) -local this_dir = false +local signal = POS(-2077,4,784) +__approach_callback_mode = 1 -__approach_callback_mode = 2 if event.approach and not event.has_entered then - atc_set_lzb_tsr(2) + atc_set_lzb_tsr(1) atc_set_ars_disable(true) return end if event.train then - if not atc_arrow then - if F.dir(dir_indicator) == this_dir then - atc_send("B1") - end -- no else, should never happen - else - if F.has_rc("ARC_LOAD_load") and (F.dir(dir_indicator) == not this_dir) then - F.remove_rc({"ARC_LOAD_load"}) - F.add_rc("ARC_LOAD_rejoin") - atc_send("B0WRD1S2") - else - atc_send("A1S2") - end + if F.has_rc("ARC_LOAD_AROUND") then --should be light-engine + set_route(signal,"Headshunt") + atc_set_ars_disable(false) + return end + if F.has_rc("ARC_LOAD_LOADING") then -- train is ready to depart with consist + F.remove_rc({ --cleanup some loose RCs + "ARC_LOAD_LOADING", + "ARC_LOAD_RUNAROUND", + "ARC_AUTO_LOCAL_LOADING" + }) + set_route(signal,"Arcadius Auto Yard") + atc_set_ars_disable(false) + atc_send("S1D15SM") + return + end + atc_set_ars_disable(false) end
\ No newline at end of file diff --git a/durt/nodes/(-2080,3,778).lua b/durt/nodes/(-2080,3,778).lua new file mode 100644 index 0000000..a5f7127 --- /dev/null +++ b/durt/nodes/(-2080,3,778).lua @@ -0,0 +1,44 @@ +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +local rev_rc = "ARC_LOAD_HS_S" +local rm_rc = true +local autocouple = "ARC_LOAD_HS_S_AC" +local rm_cpl_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 not atc_arrow then --train has bounced + if F.has_rc(autocouple) then + atc_send("CplS0WD2S1") + if rm_cpl_rc then F.remove_rc({autocouple}) end + end + return + end + + if not F.has_rc(rev_rc) then --not our train. disregard + 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/(-2080,3,822).lua b/durt/nodes/(-2080,3,822).lua index b068713..c9d875f 100644 --- a/durt/nodes/(-2080,3,822).lua +++ b/durt/nodes/(-2080,3,822).lua @@ -1,36 +1,23 @@ -local dir_indicator = POS(-2079,7,803) -local this_dir = true +if not event.train then return end --not sure why we'd need anythign else, but just in case +if not atc_arrow then return end --not used in this case +if not F.has_rc("ARC_LOAD") then return end --not the train for this runaround -__approach_callback_mode = 2 -if event.approach and not event.has_entered then - atc_set_lzb_tsr(2) - atc_set_ars_disable(true) - return +if not F.has_rc("ARC_LOAD_RUNAROUND") then --train has arrived from yard. split and runaround + split_off_locomotive("A0B0",1) + F.add_rc({ + "ARC_LOAD_RUNAROUND", --runaround flag + "ARC_LOAD_HS_N", + "ARC_LOAD_AROUND", -- actual RC to send through runaround + "ARC_LOAD_HS_S", + "ARC_LOAD_HS_S_AC" + }) +else --loco has rejoined from runaround. push through to headshunt, run over loading tracks and prepare for departure + F.remove_rc("ARC_LOAD_AROUND") + F.add_rc({ + "ARC_LOAD_HS_N", + "ARC_LOAD_LOADING", + "ARC_AUTO" + }) end - -if event.train then - if not F.has_rc("ARC_LOAD") then - atc_set_ars_disable(false) - return - end - if F.has_rc("ARC_LOAD_exit") then - atc_set_ars_disable(false) - return - end - if not atc_arrow then - atc_send("S2") - return - end - - if not F.has_rc("ARC_LOAD_rejoin") then - split_at_fc("B0") - F.add_rc("ARC_LOAD_reverse ARC_LOAD_load") - atc_send("A1S2") - F.dir(dir_indicator,this_dir) - else - unset_autocouple() - F.remove_rc({"ARC_LOAD_reverse","ARC_LOAD_rejoin"}) - F.add_rc("ARC_LOAD_exit") - atc_send("B0WRD1S6A1") - end -end
\ No newline at end of file +set_route(POS(-2081,4,825),"Headshunt") +atc_send("A1S2")
\ No newline at end of file diff --git a/durt/nodes/(-2080,3,832).lua b/durt/nodes/(-2080,3,832).lua index 9a71d83..4d71348 100644 --- a/durt/nodes/(-2080,3,832).lua +++ b/durt/nodes/(-2080,3,832).lua @@ -1,32 +1,44 @@ -local dir_indicator = POS(-2079,7,803) -local this_dir = true +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +local rev_rc = "ARC_LOAD_HS_N" +local rm_rc = true +local autocouple = "ARC_LOAD_HS_N_AC" +local rm_cpl_rc = true -if event.schedule then - if not atc_id then - atc_send_to_train(event.msg,"B0WRD1S1") - return - end - if event.msg == atc_id then - schedule_in(";01",atc_id) - return - else - atc_send("BB") - atc_send_to_train("BB") - return - end +__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 and atc_arrow then - if F.has_rc("ARC_LOAD_reverse") and F.dir(dir_indicator) == this_dir then - set_autocouple() - schedule_in(";01",atc_id) +if event.train then + if not atc_arrow then --train has bounced + if F.has_rc(autocouple) then + atc_send("CplS0WD2S1") + if rm_cpl_rc then F.remove_rc({autocouple}) end + end return end - if F.has_rc("ARC_LOAD_exit") then - F.remove_rc({"ARC_LOAD_exit"}) - atc_send("D5SM") + + if not F.has_rc(rev_rc) then --not our train. disregard + 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,"B0WRD1A1S1") + 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/(-2135,21,920).lua b/durt/nodes/(-2135,21,920).lua new file mode 100644 index 0000000..74dac88 --- /dev/null +++ b/durt/nodes/(-2135,21,920).lua @@ -0,0 +1,25 @@ +local ch = { + output = "ars_manual_input", + get = "ars_set_query", + input = "ars_set", + indicator = "ars_indicator", + lcd = "lcd", + debug = "debug" +} + +if event.train then + digiline_send(ch.get, "GET") + return +end + +if event.digiline then + if event.channel==ch.input then + if not atc_id then + digiline_send(ch.indicator, true) + return + end + set_rc(tostring(event.msg)) + digiline_send(ch.indicator, false) + return + end +end
\ No newline at end of file diff --git a/durt/nodes/(-2213,8,898).lua b/durt/nodes/(-2213,8,898).lua index 3d93bd0..0be631f 100644 --- a/durt/nodes/(-2213,8,898).lua +++ b/durt/nodes/(-2213,8,898).lua @@ -1 +1,13 @@ -if event.type=="digiline" then
if event.channel ~= "trainctl" then return end
if event.msg == "send" then
if atc_id and atc_arrow then
atc_send("S0WRS4")
elseif atc_id and atc_arrow == false then
atc_send("S4")
end
end
end
\ No newline at end of file +if event.type=="digiline" then + if event.channel ~= "trainctl" then return end + if not atc_id then return end + local cmd = "I+S0WR;S4" + if event.msg == "send" then + atc_send(cmd) + return + end + if event.msg == "send_cpl" then + atc_send(cmd.."CplWS0WRS4") + return + end +end
\ No newline at end of file diff --git a/durt/nodes/(-4107,21,-5792).lua b/durt/nodes/(-4107,21,-5792).lua new file mode 100644 index 0000000..dd8c298 --- /dev/null +++ b/durt/nodes/(-4107,21,-5792).lua @@ -0,0 +1 @@ +interrupt_pos(POS(-4152,13,-5840),"manual")
\ No newline at end of file diff --git a/durt/nodes/(-4117,13,-5765).lua b/durt/nodes/(-4117,13,-5765).lua new file mode 100644 index 0000000..599792f --- /dev/null +++ b/durt/nodes/(-4117,13,-5765).lua @@ -0,0 +1,36 @@ +--[[Departures North End]]-- +local arrivals_indicator = POS(-4107, 20, -5793) +local departures_indicator = POS(-4107, 20, -5791) +local road_loco_storage = POS(-4152,13,-5840) +if not atc_arrow then --clean up RC from directing RC's + F.remove_rc_match("DLG_DIR_%S+_N") + return +end +if F.has_rc("DLG_COLLECT_DEPARTURES") then --road loco has coupled, ready to depart + F.indicator(departures_indicator, false) + F.remove_rc("DLG_COLLECT_DEPARTURES") + step_fc() -- move FC's up to prepare for Tyard classification + atc_send("SM") + return +end +-- --we'll deal with the yard shunter later +if F.has_rc("DLG_SHUNTER") then + F.indicator(departures_indicator, true) + interrupt_pos(road_loco_storage,"departures") + split_off_locomotive("B0S0A0",1) +-- if not F.indicator(arrivals_indicator) then --send shunter to its storage siding +-- F.add_rc({ +-- "DLG_HS_N", +-- "DLG_SHUNTER_Storage" +-- }) +-- return +-- end + +-- --else send shunter to arrivals to continue classification +-- F.add_rc({ +-- "DLG_HS_N", +-- "DLG_HS_N_AC", +-- "DLG_DIR_Arrivals_SHUNT_N" +-- }) +-- return +end
\ No newline at end of file diff --git a/durt/nodes/(-4117,13,-5818).lua b/durt/nodes/(-4117,13,-5818).lua new file mode 100644 index 0000000..c5d288f --- /dev/null +++ b/durt/nodes/(-4117,13,-5818).lua @@ -0,0 +1,27 @@ +-- [[BASED ON:]] Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +local rev_rc = "DLG_Departures_REV_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 not atc_arrow then --not our train. disregard + atc_set_ars_disable(false) + return + end + + if not F.has_rc(rev_rc) then --not our train. disregard + atc_set_ars_disable(false) + return + end + + if rm_rc then F.remove_rc({rev_rc}) end + atc_send("B0WRD1A1S3") + return +end
\ No newline at end of file diff --git a/durt/nodes/(-4118,13,-5758).lua b/durt/nodes/(-4118,13,-5758).lua new file mode 100644 index 0000000..0cec6c1 --- /dev/null +++ b/durt/nodes/(-4118,13,-5758).lua @@ -0,0 +1,5 @@ +local ind = POS(-4107, 20, -5795) --Departure track working indicator, true if occupied + +if event.train then + F.indicator(ind, atc_arrow and true or false) +end
\ No newline at end of file diff --git a/durt/nodes/(-4120,13,-5762).lua b/durt/nodes/(-4120,13,-5762).lua new file mode 100644 index 0000000..17b5acb --- /dev/null +++ b/durt/nodes/(-4120,13,-5762).lua @@ -0,0 +1,24 @@ +--[[Arrivals North End]]-- +local arrivals_indicator = POS(-4107, 20, -5793) + +if not event.train then return end +if atc_arrow then + if not F.has_rc("DLG_SHUNTER") then return end + local pre_split_length = train_length() + local split_fc = split_at_fc("A0B0S0", 7) + local post_split_length = train_length() + + + local add_rc = { + "DLG_HS_N", + "DLG_HS_N_AC", + split_fc ~= "" and "DLG_CLASS_"..split_fc or ""} + + if pre_split_length == post_split_length then --last collection, haven't had to split anything off + F.indicator(arrivals_indicator, false) + table.insert(add_rc, "DLG_FINAL_ARRIVAL") + end + F.add_rc(add_rc) + return +end +F.remove_rc_match("DLG_DIR_%S+_N")
\ No newline at end of file diff --git a/durt/nodes/(-4120,13,-5818).lua b/durt/nodes/(-4120,13,-5818).lua new file mode 100644 index 0000000..ae273e3 --- /dev/null +++ b/durt/nodes/(-4120,13,-5818).lua @@ -0,0 +1,35 @@ +--[[ARRIVALS SOUTH END]]-- +local departures_section = "242871" +local arrival_indicator = POS(-4107, 20, -5793) +if F.has_rc("DLG_NOSHUNT") then return end +__approach_callback_mode = 1 + +if event.approach and not event.has_entered then + atc_set_ars_disable(true) + atc_set_lzb_tsr(2) + return +end + +if event.train then + if not F.has_rc("DLG_FREIGHT") then --not road loco + if not F.has_rc("DLG_SHUNTER") then --not yard shunter, do everything else here + atc_set_ars_disable(false) + return + end + --do yard shunter stuff here + atc_send("B0WRD1A1S3") --bounce to north end for classification + return + end + + --road loco arriving from TYARD. Send to storage for servicing/redeployment + split_off_locomotive("B0S0", 3) + local cmd = { + "DLG_HS_S", + "DLG_HS_KICKBACK", + "DLG_Loco_Storage" + } + F.add_rc(cmd) --send the road loco to collect departures or storage + atc_set_ars_disable(false) + F.indicator(arrival_indicator, true) --send the signal to then yard shunter + return +end
\ No newline at end of file diff --git a/durt/nodes/(-4120,13,-5824).lua b/durt/nodes/(-4120,13,-5824).lua new file mode 100644 index 0000000..0cec6c1 --- /dev/null +++ b/durt/nodes/(-4120,13,-5824).lua @@ -0,0 +1,5 @@ +local ind = POS(-4107, 20, -5795) --Departure track working indicator, true if occupied + +if event.train then + F.indicator(ind, atc_arrow and true or false) +end
\ No newline at end of file diff --git a/durt/nodes/(-4125,13,-5731).lua b/durt/nodes/(-4125,13,-5731).lua new file mode 100644 index 0000000..c3fcc71 --- /dev/null +++ b/durt/nodes/(-4125,13,-5731).lua @@ -0,0 +1,49 @@ +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +local rev_rc = "DLG_HS_N" +local rm_rc = true +local autocouple = "DLG_HS_N_AC" +local rm_cpl_rc = true + +local departures_busy_indicator = POS(-4107,20,-5795) + +__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 not atc_arrow then --train has bounced + if F.has_rc(autocouple) then + atc_send("CplS0WD2S1") + if rm_cpl_rc then F.remove_rc({autocouple}) end + if F.has_rc("DLG_CLASS_DLG_NB") then + F.indicator(departures_busy_indicator,true) + end + end + return + end + + if not F.has_rc(rev_rc) then --not our train. disregard + 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/(-4141,13,-5796).lua b/durt/nodes/(-4141,13,-5796).lua new file mode 100644 index 0000000..3e15931 --- /dev/null +++ b/durt/nodes/(-4141,13,-5796).lua @@ -0,0 +1,45 @@ +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +local rev_rc = "DLG_HS_KICKBACK" +local rm_rc = true +local autocouple = "DLG_HS_KICKBACK_AC" +local rm_cpl_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 not atc_arrow then --train has bounced + if F.has_rc(autocouple) then + atc_send("CplS0WD2S1") + if rm_cpl_rc then F.remove_rc({autocouple}) end + end + return + end + + if not F.has_rc(rev_rc) then --not our train. disregard + 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/(-4152,13,-5840).lua b/durt/nodes/(-4152,13,-5840).lua new file mode 100644 index 0000000..2611c48 --- /dev/null +++ b/durt/nodes/(-4152,13,-5840).lua @@ -0,0 +1,84 @@ +--[[Road Loco Storage]]-- +local departures_indicator = POS(-4107, 20, -5791) +local departures_busy_indicator = POS(-4107, 20, -5795) +local TYARD_notify_indicator = POS(-4107, 20, -5789) + +local notification_id = "DLG" +local print_notification = true + +local function send_train() + local cmd = { -- base RC to collect from TYARD + "FREIGHT", + "DLG_FREIGHT", + "M27", + "TYARD", + "TY_RTS", + "TY_COLLECT_DLG", + } + + if F.indicator(departures_indicator) then + --departures available, if not busy then collect departures + if F.indicator(departures_busy_indicator) then + -- shunter still on departures track. wait a bit and check again + schedule_in("1;0","check_again") + return false + end + --actually send train via departures track + --departures track will disable departures_indicator + cmd[#cmd+1] = "DLG_HS_N" + cmd[#cmd+1] = "DLG_HS_N_AC" + cmd[#cmd+1] = "DLG_COLLECT_DEPARTURES" + cmd[#cmd+1] = "DLG_Departures_REV_S" + set_rc(table.concat(cmd," ")) + atc_send("S0WRD2A1S4") + return true + end + --no departures to collect, go straight to TYARD + set_rc(table.concat(cmd," ")) + atc_send("S0WRD2A1S4") + F.indicator(TYARD_notify_indicator,false) + return true +end + +if event.schedule then + if event.message == "check_again" then + if not send_train() then --will either send train or continue clock + schedule_in("1;0","check_again") + return + end + end +end + +if event.ext_int then + if event.message == "departures" or event.message == "manual" then + if print_notification then print(rwt.to_string(rwt.now()).. " "..notification_id.." RX Notification - "..event.message) end + if atc_id then + send_train() + else + F.indicator(departures_indicator,true) + end + return + end + + if event.message == "notify" then + if print_notification then print(rwt.to_string(rwt.now()).. " "..notification_id.." RX Notification - notify") end + if F.indicator(TYARD_notify_indicator) then return end + if atc_id then + send_train() + else + F.indicator(TYARD_notify_indicator,true) + end + return + end +end + +if event.train then + if F.indicator(TYARD_notify_indicator) or F.indicator(departures_indicator) then + print("DLG loco returned. Servicing loco before next departure") + atc_send("B0") + schedule_in("2;0","start_checking") + return + end + atc_send("B0") + return +end
\ No newline at end of file diff --git a/durt/nodes/(1835,17,4169).lua b/durt/nodes/(1835,17,4169).lua new file mode 100644 index 0000000..15ce0f0 --- /dev/null +++ b/durt/nodes/(1835,17,4169).lua @@ -0,0 +1,2 @@ +if F.has_rc("OAF_BRANCH_REVERSE_DONE") then F.remove_rc("OAF_BRANCH_REVERSE_DONE") end +if F.has_rc("OAF_DEPART_LIGHT") then F.remove_rc("OAF_DEPART_LIGHT") end
\ No newline at end of file diff --git a/durt/nodes/(1840,18,4276).lua b/durt/nodes/(1840,18,4276).lua new file mode 100644 index 0000000..66313fd --- /dev/null +++ b/durt/nodes/(1840,18,4276).lua @@ -0,0 +1 @@ +if event.punch then interrupt_pos(POS(1843,17,4278), "notify") end
\ No newline at end of file diff --git a/durt/nodes/(1843,17,4278).lua b/durt/nodes/(1843,17,4278).lua new file mode 100644 index 0000000..dcfa6d4 --- /dev/null +++ b/durt/nodes/(1843,17,4278).lua @@ -0,0 +1,54 @@ +local notification_id = "OAF Logging" +local ind = POS(1845, 17, 4275) +local print_notification = true +local function send_train() + local cmd = { + "FREIGHT", + "OAF_SHUNTER", + "IYARD", + "IP_RTS", + "IP_COLLECT_OAF_Logging", + "IYARD_TO_OAF" + } + if section_occupancy("186232")[1] then --wagons to collect from local siding before departure + cmd[#cmd+1] = "OAF_HS_S" + cmd[#cmd+1] = "OAF_HS_S_AC" + cmd[#cmd+1] = "OAF_COLLECT_OUTBOUND" + else + cmd[#cmd+1] = "OAF_DEPART_LIGHT" + end + + set_rc(table.concat(cmd, " ")) + atc_send("S0WRD2A1S4D20SM") + F.indicator(ind,false) +end + +__approach_callback_mode = 1 + +if event.approach and not event.has_entered then + atc_set_lzb_tsr(1) + 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 + 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/(1847,17,4266).lua b/durt/nodes/(1847,17,4266).lua new file mode 100644 index 0000000..cd01ee1 --- /dev/null +++ b/durt/nodes/(1847,17,4266).lua @@ -0,0 +1,26 @@ +if event.train then + if not atc_arrow then + atc_set_ars_disable(true) + return + end + + if F.has_rc("OAF_COLLECT_OUTBOUND") then --shunter has joined the chat + F.remove_rc("OAF_COLLECT_OUTBOUND") + step_fc() + atc_send("S4D20SM") + atc_set_ars_disable(false) + return + end + -- depositing wagons + F.remove_rc("OAF_INBOUND") + F.add_rc({ + "OAF_WAGON_NO_MOVE", + "OAF_HS_S", + "OAF_LocoStore" + }) + split_off_locomotive("A0S0",1) + atc_send("S4") + F.remove_rc("OAF_WAGON_NO_MOVE") + atc_set_ars_disable(false) + return +end
\ No newline at end of file diff --git a/durt/nodes/(1855,17,4223).lua b/durt/nodes/(1855,17,4223).lua new file mode 100644 index 0000000..ac3cf51 --- /dev/null +++ b/durt/nodes/(1855,17,4223).lua @@ -0,0 +1,45 @@ +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +local rev_rc = "OAF_HS_S" +local rm_rc = true +local autocouple = "OAF_HS_S_AC" +local rm_cpl_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 not atc_arrow then --train has bounced + if F.has_rc(autocouple) then + atc_send("CplS0WD2S1") + if rm_cpl_rc then F.remove_rc({autocouple}) end + end + return + end + + if not F.has_rc(rev_rc) then --not our train. disregard + 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/(1855,17,4292).lua b/durt/nodes/(1855,17,4292).lua new file mode 100644 index 0000000..6cc1ead --- /dev/null +++ b/durt/nodes/(1855,17,4292).lua @@ -0,0 +1,45 @@ +if not atc_arrow then return end +if not F.has_rc("OAF_SHUNTER") then return end + +__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 not event.train then return end +local cmd = {} +if train_length() == 1 then + cmd = { + "OAF_HS_S", + "OAF_LocoStore" + } +F.add_rc(cmd) + atc_send("S0WD2RA1S4") + return +end + +cmd = { + "OAF_HS_N", + "OAF_HS_TRANSFER_SB", + "OAF_HS_S", + "OAF_HS_S_AC", + "OAF_NB_TK3_SHUNT", + "OAF_SHUTNER_REJOIN" +} + +if not F.has_rc("OAF_SHUTNER_REJOIN") then + split_off_locomotive("A0B0", 1) + F.add_rc(cmd) + atc_send("A1S3") + return +end +--else loco has run around and rejoined +F.remove_rc(cmd) +F.add_rc({ + "OAF_HS_S", + "OAF_HS_S_AC", + "OAF_INBOUND" +}) +atc_send("S0WRD3A1S4")
\ No newline at end of file diff --git a/durt/nodes/(1858,17,4242).lua b/durt/nodes/(1858,17,4242).lua new file mode 100644 index 0000000..4f60fe8 --- /dev/null +++ b/durt/nodes/(1858,17,4242).lua @@ -0,0 +1,87 @@ +local dir = "HEAD" --indicates which part of the train leaves the station: HEAD, SHOVE +local movelist = { + SHOVE = { --loco first into platform, shove the outbound + "OAF_REV_"..dir, + "OAF_HS_N", + "OAF_SB_TK2", + "OAF_HS_S2", + "OAF_HS_S2_AC", + "OAF_NB_TK1_SHUNT", + "OAF_runaround_rejoin", + }, + HEAD = { --shoved into platform, loco first outbound + "OAF_REV_"..dir, + "OAF_HS_N", + "OAF_SB_TK3", + "OAF_HS_S", + "OAF_HS_S_AC", + "OAF_NB_TK2_SHUNT", + "OAF_runaround_rejoin", + } +} + +print("==================================") +print(dir) + +if event.train then + if not atc_arrow then + if F.has_rc("OAF_runaround_rejoin") then --loco has returned, shove through to ensure past signal IP + schedule_in(";05",atc_id) + print("SHOVE THROUGH") + return + end + return + end + if not F.has_rc("OAF_BRANCH_REVERSE") then return end + if not F.has_rc("OAF_runaround_rejoin") then + print("BEGIN") + atc_send("S0WOL") + schedule_in(";03",atc_id) --semi-realistic decoupling time + return + end + if not F.has_rc("OAF_REV_"..dir) then return end + F.remove_rc(movelist[dir]) + F.add_rc("OAF_BRANCH_REVERSE_RECOUPLED") + schedule_in(";05",atc_id) --semi-realistic recoupling time + print("REJOIN") + return +end + +if event.schedule then + print("Arrow: "..tostring(atc_arrow)) + print("ID: "..tostring(atc_id)) + print("msg: "..tostring(event.msg)) + if atc_id and atc_id ~= event.msg then return end --somehow another train snuck in??? or we've coupled weird over the track + if not atc_id then --loco has returned, should have already coupled and shoved through as buffers would have been over track to begin with + atc_send_to_train(event.msg,"B0WRD1A1S1") + return + end + if not F.has_rc("OAF_BRANCH_REVERSE") then return end --probably not our train anyway ??? + + if dir == "HEAD" and atc_arrow ~= true then --!!!!!! previously managed to get valid atc_id and arrow == nil when using (atc_arrow == false) + schedule_in(";01", atc_id) --keep clock going to ensure rejoining loco has coupled + print("CLOCK") + return + end + + if not F.has_rc("OAF_BRANCH_REVERSE_RECOUPLED") then + if dir == "SHOVE" then -- loco first into platform, run around to shove out + -- split_off_locomotive("S0OLA0",2) --ideally each pax wagon has a generic FC, but not likely as few people use them at all + split_at_index(2,"S0OLA0") + atc_send("S3") + F.add_rc(movelist[dir]) + else --dir == "HEAD" --shoved into platform, run around to put loco first + F.add_rc(movelist[dir]) + split_at_index(train_length(),"S0WRA1S3") + F.remove_rc(movelist[dir]) + atc_send("S0WROR") + end + print("SPLIT") + return + end + F.remove_rc("OAF_BRANCH_REVERSE_RECOUPLED") + F.add_rc("OAF_BRANCH_REVERSE_DONE") --triggers the ARS to depart + atc_send("SM") + print("DEPARTING") + return +end
\ No newline at end of file diff --git a/durt/nodes/(1858,17,4292).lua b/durt/nodes/(1858,17,4292).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/durt/nodes/(1858,17,4292).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/durt/nodes/(1861,17,4223).lua b/durt/nodes/(1861,17,4223).lua new file mode 100644 index 0000000..c2110ae --- /dev/null +++ b/durt/nodes/(1861,17,4223).lua @@ -0,0 +1,45 @@ +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +local rev_rc = "OAF_HS_S2" +local rm_rc = true +local autocouple = "OAF_HS_S2_AC" +local rm_cpl_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 not atc_arrow then --train has bounced + if F.has_rc(autocouple) then + atc_send("CplS0WD2S1") + if rm_cpl_rc then F.remove_rc({autocouple}) end + end + return + end + + if not F.has_rc(rev_rc) then --not our train. disregard + 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/(1861,17,4432).lua b/durt/nodes/(1861,17,4432).lua new file mode 100644 index 0000000..dd691ab --- /dev/null +++ b/durt/nodes/(1861,17,4432).lua @@ -0,0 +1 @@ +if F.has_rc("OAF_BRANCH_REVERSE_DONE") then F.remove_rc("OAF_BRANCH_REVERSE_DONE") end
\ No newline at end of file diff --git a/durt/nodes/(1864,17,4296).lua b/durt/nodes/(1864,17,4296).lua new file mode 100644 index 0000000..b0f62d1 --- /dev/null +++ b/durt/nodes/(1864,17,4296).lua @@ -0,0 +1,87 @@ +local dir = "SHOVE" --indicates which part of the train leaves the station: HEAD, SHOVE +local movelist = { + SHOVE = { --loco first into platform, shove the outbound + "OAF_REV_"..dir, + "OAF_HS_N", + "OAF_SB_TK2", + "OAF_HS_S2", + "OAF_HS_S2_AC", + "OAF_NB_TK1_SHUNT", + "OAF_runaround_rejoin", + }, + HEAD = { --shoved into platform, loco first outbound + "OAF_REV_"..dir, + "OAF_HS_N", + "OAF_SB_TK3", + "OAF_HS_S", + "OAF_HS_S_AC", + "OAF_NB_TK2_SHUNT", + "OAF_runaround_rejoin", + } +} + +print("==================================") +print(dir) + +if event.train then + if not atc_arrow then + if F.has_rc("OAF_runaround_rejoin") then --loco has returned, shove through to ensure past signal IP + schedule_in(";05",atc_id) + print("SHOVE THROUGH") + return + end + return + end + if not F.has_rc("OAF_BRANCH_REVERSE") then return end + if not F.has_rc("OAF_runaround_rejoin") then + print("BEGIN") + atc_send("S0WOL") + schedule_in(";03",atc_id) --semi-realistic decoupling time + return + end + if not F.has_rc("OAF_REV_"..dir) then return end + F.remove_rc(movelist[dir]) + F.add_rc("OAF_BRANCH_REVERSE_RECOUPLED") + schedule_in(";05",atc_id) --semi-realistic recoupling time + print("REJOIN") + return +end + +if event.schedule then + print("Arrow: "..tostring(atc_arrow)) + print("ID: "..tostring(atc_id)) + print("msg: "..tostring(event.msg)) + if atc_id and atc_id ~= event.msg then return end --somehow another train snuck in??? or we've coupled weird over the track + if not atc_id then --loco has returned, should have already coupled and shoved through as buffers would have been over track to begin with + atc_send_to_train(event.msg,"B0WRD1A1S1") + return + end + if not F.has_rc("OAF_BRANCH_REVERSE") then return end --probably not our train anyway ??? + + if dir == "HEAD" and atc_arrow ~= true then --!!!!!! previously managed to get valid atc_id and arrow == nil when using (atc_arrow == false) + schedule_in(";01", atc_id) --keep clock going to ensure rejoining loco has coupled + print("CLOCK") + return + end + + if not F.has_rc("OAF_BRANCH_REVERSE_RECOUPLED") then + if dir == "SHOVE" then -- loco first into platform, run around to shove out + -- split_off_locomotive("S0OLA0",2) --ideally each pax wagon has a generic FC, but not likely as few people use them at all + split_at_index(2,"S0OLA0") + atc_send("S3") + F.add_rc(movelist[dir]) + else --dir == "HEAD" --shoved into platform, run around to put loco first + F.add_rc(movelist[dir]) + split_at_index(train_length(),"S0WRA1S3") + F.remove_rc(movelist[dir]) + atc_send("S0WROR") + end + print("SPLIT") + return + end + F.remove_rc("OAF_BRANCH_REVERSE_RECOUPLED") + F.add_rc("OAF_BRANCH_REVERSE_DONE") --triggers the ARS to depart + atc_send("SM") + print("DEPARTING") + return +end
\ No newline at end of file diff --git a/durt/nodes/(1864,17,4317).lua b/durt/nodes/(1864,17,4317).lua new file mode 100644 index 0000000..a39ee9e --- /dev/null +++ b/durt/nodes/(1864,17,4317).lua @@ -0,0 +1,45 @@ +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +local rev_rc = "OAF_HS_N" +local rm_rc = true +local autocouple = "OAF_HS_N_AC" +local rm_cpl_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 not atc_arrow then --train has bounced + if F.has_rc(autocouple) then + atc_send("CplS0WD2S1") + if rm_cpl_rc then F.remove_rc({autocouple}) end + end + return + end + + if not F.has_rc(rev_rc) then --not our train. disregard + 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/(1886,23,4544).lua b/durt/nodes/(1886,23,4544).lua new file mode 100644 index 0000000..63ac1ca --- /dev/null +++ b/durt/nodes/(1886,23,4544).lua @@ -0,0 +1,12 @@ +____approach_callback_mode = 1 +local newstate = "st" +if event.approach and not event.has_entered then + if not F.has_rc("OAF_BRANCH_REVERSE") then return end + atc_set_lzb_tsr(2) + return +end +if event.train and atc_arrow and F.has_rc("OAF_BRANCH_REVERSE") then + atc_send("B3S3") + setstate(POS(1892,23,4547), newstate) + return +end
\ No newline at end of file diff --git a/durt/nodes/(1886,23,4547).lua b/durt/nodes/(1886,23,4547).lua new file mode 100644 index 0000000..22eea60 --- /dev/null +++ b/durt/nodes/(1886,23,4547).lua @@ -0,0 +1,12 @@ +____approach_callback_mode = 1 +local newstate = "cr" +if event.approach and not event.has_entered then + if not F.has_rc("OAF_BRANCH_REVERSE") then return end + atc_set_lzb_tsr(2) + return +end +if event.train and atc_arrow and F.has_rc("OAF_BRANCH_REVERSE") then + atc_send("B3S3") + setstate(POS(1892,23,4547), newstate) + return +end
\ No newline at end of file diff --git a/durt/nodes/(1894,23,4548).lua b/durt/nodes/(1894,23,4548).lua new file mode 100644 index 0000000..5245388 --- /dev/null +++ b/durt/nodes/(1894,23,4548).lua @@ -0,0 +1,25 @@ +__approach_callback_mode = 1 +if event.approach and not event.has_entered then + if not F.has_rc("OAF_BRANCH_REVERSE") then return end + atc_set_lzb_tsr(2) + return +end +if event.train then + if not atc_arrow then return end + if not F.has_rc("OAF_BRANCH_REVERSE") then return end + schedule_in(";01",atc_id) + print("start ping") + return +end +if event.schedule then + if atc_id == event.msg then + schedule_in(";01", atc_id) + print("ping") + return + end + print("end ping") + atc_send_to_train(event.msg, "S0WRD2SM") + local newstate = getstate(POS(1894, 21, 4548)) + setstate(POS(1892, 23, 4547)) + return +end
\ No newline at end of file diff --git a/durt/nodes/(1896,8,9053).lua b/durt/nodes/(1896,8,9053).lua new file mode 100644 index 0000000..0851b53 --- /dev/null +++ b/durt/nodes/(1896,8,9053).lua @@ -0,0 +1,17 @@ +__approach_callback_mode = 1 +if event.approach and not event.has_entered then + atc_set_ars_disable(true) + atc_set_lzb_tsr(4) +end + +if event.train and atc_arrow then + atc_send("S4") + if F.has_rc("WOA_mine_around") then + if train_length() == 1 then + F.add_rc("WOA_ttb_s") + else + F.add_rc("WOA_shed_left") + end + end + atc_set_ars_disable(false) +end
\ No newline at end of file diff --git a/durt/nodes/(1902,8,9059).lua b/durt/nodes/(1902,8,9059).lua index 88b402f..6948744 100644 --- a/durt/nodes/(1902,8,9059).lua +++ b/durt/nodes/(1902,8,9059).lua @@ -1,13 +1,32 @@ +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +local rev_rc = "WOA_rev_south" +local rm_rc = true +local autocouple = "WOA_rev_south_AC" +local rm_cpl_rc = true + + __approach_callback_mode = 1 if event.approach and not event.has_entered then - atc_set_lzb_tsr(4) + atc_set_lzb_tsr(3) + atc_set_ars_disable(true) return end -if event.train and atc_arrow then - if not F.has_rc("WOA_rev_south") then return end - F.remove_rc({"WOA_rev_south"}) +if event.train then + if not atc_arrow then --train has bounced + if F.has_rc(autocouple) then + atc_send("CplS0WD2S1") + if rm_cpl_rc then F.remove_rc({autocouple}) end + end + return + end + + if not F.has_rc(rev_rc) then --not our train. disregard + atc_set_ars_disable(false) + return + end + if rm_rc then F.remove_rc({rev_rc}) end schedule_in(";01",atc_id) return end diff --git a/durt/nodes/(1906,7,9136).lua b/durt/nodes/(1906,7,9136).lua index f83e4fc..2432086 100644 --- a/durt/nodes/(1906,7,9136).lua +++ b/durt/nodes/(1906,7,9136).lua @@ -16,11 +16,15 @@ if event.approach and not event.has_entered then end if event.train and atc_arrow then +print("triggered") digiline_send("mine_counter_lcd",S.yards.WOA.mine_count) if F.has_rc("WOA_mine_around") then +print("has around") if F.has_rc("WOA_around_active") then +print("around active") F.remove_rc(around_rc_list) unset_autocouple() +print(S.yards.WOA.mine_count) if S.yards.WOA.mine_count < 7 then -- send train back to yard S.yards.WOA.mine_count = S.yards.WOA.mine_count + 1 print("WOA Mine Count: "..S.yards.WOA.mine_count) @@ -35,10 +39,12 @@ if event.train and atc_arrow then end atc_set_text_outside("Warmoneaye Mining Co.\nLocomotive Switching Ends") split_off_locomotive("B0A0") +print("split success") set_autocouple() F.remove_rc({"WOA_shed_left"}) F.add_rc(around_rc_list) atc_send("S4A1") +print("completed") return end end diff --git a/durt/nodes/(1914,7,9096).lua b/durt/nodes/(1914,7,9096).lua index 4f58bba..f6bc5f6 100644 --- a/durt/nodes/(1914,7,9096).lua +++ b/durt/nodes/(1914,7,9096).lua @@ -1 +1,5 @@ -__approach_callback_mode = 1
if event.approach and not event.has_entered then
atc_set_ars_disable(true)
atc_set_lzb_tsr(1)
end
if event.train and atc_arrow then
atc_set_ars_disable(false)
atc_send("SM")
end
\ No newline at end of file +__approach_callback_mode = 2
if event.approach and not event.has_entered then
atc_set_ars_disable(true)
atc_set_lzb_tsr(1)
end
if event.train then + if atc_arrow then
atc_set_ars_disable(false)
atc_send("SM") + else + atc_send("S1B1") + end
end
\ No newline at end of file diff --git a/ers/nodes/(1634,4,1331).lua b/ers/nodes/(1634,4,1331).lua new file mode 100644 index 0000000..4693f57 --- /dev/null +++ b/ers/nodes/(1634,4,1331).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1634,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,1291).lua b/ers/nodes/(1656,2,1291).lua new file mode 100644 index 0000000..28d54b2 --- /dev/null +++ b/ers/nodes/(1656,2,1291).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1291) + +F.yard_siding("ers_main", "SIDING03", "end")
\ No newline at end of file diff --git a/ers/nodes/(2008,2,1743).lua b/ers/nodes/(2008,2,1743).lua new file mode 100644 index 0000000..ca383df --- /dev/null +++ b/ers/nodes/(2008,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_mtn/nodes/(1790,3,1241).lua b/ers_mtn/nodes/(1790,3,1241).lua new file mode 100644 index 0000000..88270da --- /dev/null +++ b/ers_mtn/nodes/(1790,3,1241).lua @@ -0,0 +1,36 @@ +-- +-- +-- 1790,3,1241 + +-- far_luaatctrack_spot_check_01.lua + +if event.type == "train" then +--[[ + if atc_arrow then + F.print("ers_mtn " .. atc_id .. " up") + else + F.print("ers_mtn " .. atc_id .. " down") + end +]] + local posTable = POS( 1790,3,1241 ) + F.save_train(posTable) + digiline_send("display", "update") + return +end + +if event.type == "ext_int" then + if event.message == "display" then + interrupt(3,"update_display") + end + return +end + + +if event.type == "int" then + if event.msg == "update_display" then + if S.stop_display == true then return end + digiline_send("display", "update") + interrupt(60,"update_display") + end + return +end
\ No newline at end of file diff --git a/ers_mtn/nodes/(1872,116,1249).lua b/ers_mtn/nodes/(1872,116,1249).lua new file mode 100644 index 0000000..18eb4fb --- /dev/null +++ b/ers_mtn/nodes/(1872,116,1249).lua @@ -0,0 +1,11 @@ +-- +-- +-- 1872,116,1249 + +-- far_luaatctrack_spot_check_01.lua + +if event.train then + local posTable = POS( 1872,116,1249 ) + F.save_train(posTable) + return +end diff --git a/ers_mtn/nodes/(1872,116,1253).lua b/ers_mtn/nodes/(1872,116,1253).lua new file mode 100644 index 0000000..fa99b8b --- /dev/null +++ b/ers_mtn/nodes/(1872,116,1253).lua @@ -0,0 +1,11 @@ +-- +-- +-- 1872,116,1253 + +-- far_luaatctrack_spot_check_01.lua + +if event.train then + local posTable = POS( 1872,116,1253 ) + F.save_train(posTable) + return +end diff --git a/ers_mtn/nodes/(1920,133,1239).lua b/ers_mtn/nodes/(1920,133,1239).lua new file mode 100644 index 0000000..1e6bc3a --- /dev/null +++ b/ers_mtn/nodes/(1920,133,1239).lua @@ -0,0 +1,11 @@ +-- +-- +-- 1920,133,1239 + +-- far_luaatctrack_spot_check_01.lua + +if event.train then + local posTable = POS( 1920,133,1239 ) + F.save_train(posTable) + return +end diff --git a/far/init_code.lua b/far/init_code.lua index a003420..55f685c 100644 --- a/far/init_code.lua +++ b/far/init_code.lua @@ -3,6 +3,7 @@ if S.trains == nil then S.trains = {} end if S.d == nil then S.d = {} end if S.datetime == nil then S.datetime = "" end if S.stop_display == nil then S.stop_display = false end +if S.show_farpass_only == nil then S.show_farpass_only = false end F.print = function (str) if F.debug then print("".. (str or "nil") ) end end F.isempty = function (s) return s == nil or s == "" end @@ -125,6 +126,9 @@ F.list_trains = function(print_info) for _, k in ipairs(trains_table) do if S.trains[k] then v = S.trains[k] + if S.show_farpass_only == true and not F.has_rc("FARPASS", v["rc"]) then + F.delete_train_info(v["id"]) + end if F.has_rc("LILSHUNTER", v["rc"]) or F.has_rc("LIL", v["rc"]) then F.delete_train_info(v["id"]) else @@ -151,7 +155,7 @@ F.list_trains = function(print_info) rc_list_cleansed = "NO E,F |" end for rc in rc_list:gmatch("[^%s]+") do - if rc == "ERSTAZI" or rc == "FREIGHT" then + if rc == "ERSTAZI" or rc == "ERSTAZIDEPOT" or rc == "FREIGHT" then -- leaving for future use do_nothing = true else diff --git a/far/nodes/(10728,46,1225).lua b/far/nodes/(10728,46,1225).lua new file mode 100644 index 0000000..d66a544 --- /dev/null +++ b/far/nodes/(10728,46,1225).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS(10728,46,1225) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(13448,13,717).lua b/far/nodes/(13448,13,717).lua new file mode 100644 index 0000000..66f6352 --- /dev/null +++ b/far/nodes/(13448,13,717).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS(13448,13,717) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(14934,6,736).lua b/far/nodes/(14934,6,736).lua new file mode 100644 index 0000000..4de8fe6 --- /dev/null +++ b/far/nodes/(14934,6,736).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS( 14934,6,736 ) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(16806,10,696).lua b/far/nodes/(16806,10,696).lua new file mode 100644 index 0000000..f961531 --- /dev/null +++ b/far/nodes/(16806,10,696).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS( 16806,10,696 ) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(18971,14,854).lua b/far/nodes/(18971,14,854).lua new file mode 100644 index 0000000..22e8cbb --- /dev/null +++ b/far/nodes/(18971,14,854).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS( 18971,14,854 ) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(26343,30,1503).lua b/far/nodes/(26343,30,1503).lua new file mode 100644 index 0000000..9d4321f --- /dev/null +++ b/far/nodes/(26343,30,1503).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS( 26343,30,1503 ) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(26346,30,1500).lua b/far/nodes/(26346,30,1500).lua new file mode 100644 index 0000000..16e0708 --- /dev/null +++ b/far/nodes/(26346,30,1500).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS( 26346,30,1500 ) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(29459,26,1427).lua b/far/nodes/(29459,26,1427).lua new file mode 100644 index 0000000..e915653 --- /dev/null +++ b/far/nodes/(29459,26,1427).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS( 29459,26,1427 ) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(30825,16,1858).lua b/far/nodes/(30825,16,1858).lua new file mode 100644 index 0000000..aad8e33 --- /dev/null +++ b/far/nodes/(30825,16,1858).lua @@ -0,0 +1,36 @@ +-- far_luaatctrack_farcom_op_01.lua + + +if event.type == "punch" then +-- F.delete_train_info("298909") + S.stop_display = true + S.show_farpass_only = false + + F.send_update_displays() + + digiline_send("notices", "LP: " .. event.name .. "") + + if S.stop_display then + date = F.date_formatted() + time = F.time_formatted() + digiline_send("time", " FAR COM\n\n " .. date .. "\n " .. time) + F.list_trains(true) + else + local pos = POS(30848,15,1852) + interrupt_pos(pos, "display") + end + + return +end + +if event.type == "digiline" then + if event.channel == "display" then + if event.msg == "update" then + date = F.date_formatted() + time = F.time_formatted() + digiline_send("time", " FAR COM\n\n " .. date .. "\n " .. time) + F.list_trains(false) + end + end + return +end diff --git a/far/nodes/(30828,16,1858).lua b/far/nodes/(30828,16,1858).lua new file mode 100644 index 0000000..2f245be --- /dev/null +++ b/far/nodes/(30828,16,1858).lua @@ -0,0 +1,16 @@ + +if event.type == "punch" then +-- F.delete_train_info("240661") + +-- F.slow_train_down("010765") +-- F.slow_train_down("164132") +-- F.slow_train_down("264353") +-- F.slow_train_down("403053") +-- F.slow_train_down("428934") +-- F.slow_train_down("783543") + + digiline_send("notices", "LP: " .. event.name .. "") + F.clear_main_depot_displays() + F.print("Cleared displays at FARCOM") + return +end
\ No newline at end of file diff --git a/far/nodes/(30831,16,1858).lua b/far/nodes/(30831,16,1858).lua new file mode 100644 index 0000000..c531ba3 --- /dev/null +++ b/far/nodes/(30831,16,1858).lua @@ -0,0 +1,21 @@ + +if event.type == "punch" and event.name == "erstazi" then +-- F.delete_train_info("240661") + +-- F.slow_train_down("010765") +-- F.slow_train_down("164132") +-- F.slow_train_down("264353") +-- F.slow_train_down("403053") +-- F.slow_train_down("428934") + F.slow_train_down("783543") + + digiline_send("notices", "LP: " .. event.name .. "") + +-- F.clear_main_depot_displays() +-- F.print("Cleared displays at FARCOM") + return + +elseif event.type == "punch" and event.name ~= "erstazi" then + digiline_send("security", "FARCOM SECURITY\nBLAME: " .. event.name .. "") + return +end
\ No newline at end of file diff --git a/far/nodes/(30833,16,1858).lua b/far/nodes/(30833,16,1858).lua new file mode 100644 index 0000000..2e3043d --- /dev/null +++ b/far/nodes/(30833,16,1858).lua @@ -0,0 +1,20 @@ + +if event.type == "punch" and event.name == "erstazi" then +-- F.delete_train_info("240661") + +-- F.slow_train_down("010765") +-- F.slow_train_down("164132") +-- F.slow_train_down("264353") +-- F.slow_train_down("403053") + F.slow_train_down("428934") +-- F.slow_train_down("783543") + + digiline_send("notices", "LP: " .. event.name .. "") + +-- F.clear_main_depot_displays() +-- F.print("Cleared displays at FARCOM") + return +elseif event.type == "punch" and event.name ~= "erstazi" then + digiline_send("security", "FARCOM SECURITY\nBLAME: " .. event.name .. "") + return +end
\ No newline at end of file diff --git a/far/nodes/(30835,16,1858).lua b/far/nodes/(30835,16,1858).lua new file mode 100644 index 0000000..5822a60 --- /dev/null +++ b/far/nodes/(30835,16,1858).lua @@ -0,0 +1,20 @@ + +if event.type == "punch" and event.name == "erstazi" then +-- F.delete_train_info("240661") + +-- F.slow_train_down("010765") +-- F.slow_train_down("164132") +-- F.slow_train_down("264353") + F.slow_train_down("403053") +-- F.slow_train_down("428934") +-- F.slow_train_down("783543") + + digiline_send("notices", "LP: " .. event.name .. "") + +-- F.clear_main_depot_displays() +-- F.print("Cleared displays at FARCOM") + return +elseif event.type == "punch" and event.name ~= "erstazi" then + digiline_send("security", "FARCOM SECURITY\nBLAME: " .. event.name .. "") + return +end
\ No newline at end of file diff --git a/far/nodes/(30837,16,1858).lua b/far/nodes/(30837,16,1858).lua new file mode 100644 index 0000000..98fcbad --- /dev/null +++ b/far/nodes/(30837,16,1858).lua @@ -0,0 +1,20 @@ + +if event.type == "punch" and event.name == "erstazi" then +-- F.delete_train_info("240661") + +-- F.slow_train_down("010765") +-- F.slow_train_down("164132") + F.slow_train_down("264353") +-- F.slow_train_down("403053") +-- F.slow_train_down("428934") +-- F.slow_train_down("783543") + + digiline_send("notices", "LP: " .. event.name .. "") + +-- F.clear_main_depot_displays() +-- F.print("Cleared displays at FARCOM") + return +elseif event.type == "punch" and event.name ~= "erstazi" then + digiline_send("security", "FARCOM SECURITY\nBLAME: " .. event.name .. "") + return +end
\ No newline at end of file diff --git a/far/nodes/(30839,16,1858).lua b/far/nodes/(30839,16,1858).lua new file mode 100644 index 0000000..4007a2a --- /dev/null +++ b/far/nodes/(30839,16,1858).lua @@ -0,0 +1,20 @@ + +if event.type == "punch" and event.name == "erstazi" then +-- F.delete_train_info("240661") + +-- F.slow_train_down("010765") + F.slow_train_down("164132") +-- F.slow_train_down("264353") +-- F.slow_train_down("403053") +-- F.slow_train_down("428934") +-- F.slow_train_down("783543") + + digiline_send("notices", "LP: " .. event.name .. "") + +-- F.clear_main_depot_displays() +-- F.print("Cleared displays at FARCOM") + return +elseif event.type == "punch" and event.name ~= "erstazi" then + digiline_send("security", "FARCOM SECURITY\nBLAME: " .. event.name .. "") + return +end
\ No newline at end of file diff --git a/far/nodes/(30841,16,1858).lua b/far/nodes/(30841,16,1858).lua new file mode 100644 index 0000000..7028e19 --- /dev/null +++ b/far/nodes/(30841,16,1858).lua @@ -0,0 +1,20 @@ + +if event.type == "punch" and event.name == "erstazi" then +-- F.delete_train_info("240661") + + F.slow_train_down("010765") +-- F.slow_train_down("164132") +-- F.slow_train_down("264353") +-- F.slow_train_down("403053") +-- F.slow_train_down("428934") +-- F.slow_train_down("783543") + + digiline_send("notices", "LP: " .. event.name .. "") + +-- F.clear_main_depot_displays() +-- F.print("Cleared displays at FARCOM") + return +elseif event.type == "punch" and event.name ~= "erstazi" then + digiline_send("security", "FARCOM SECURITY\nBLAME: " .. event.name .. "") + return +end
\ No newline at end of file diff --git a/far/nodes/(30863,15,1807).lua b/far/nodes/(30863,15,1807).lua new file mode 100644 index 0000000..ce3a9c4 --- /dev/null +++ b/far/nodes/(30863,15,1807).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS(30863,15,1807) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(3847,10,1715).lua b/far/nodes/(3847,10,1715).lua new file mode 100644 index 0000000..274d03f --- /dev/null +++ b/far/nodes/(3847,10,1715).lua @@ -0,0 +1,7 @@ +-- far_luaatctrack_spot_check_01.lua + +if event.train then + local posTable = POS( 3847,10,1715 ) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(4586,7,2162).lua b/far/nodes/(4586,7,2162).lua new file mode 100644 index 0000000..25dcde7 --- /dev/null +++ b/far/nodes/(4586,7,2162).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS(4586,7,2162) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(4614,7,2137).lua b/far/nodes/(4614,7,2137).lua new file mode 100644 index 0000000..ea184ff --- /dev/null +++ b/far/nodes/(4614,7,2137).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS(4614,7,2137) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(4831,12,2223).lua b/far/nodes/(4831,12,2223).lua new file mode 100644 index 0000000..163d6b7 --- /dev/null +++ b/far/nodes/(4831,12,2223).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS(4831,12,2223) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(4835,7,2210).lua b/far/nodes/(4835,7,2210).lua new file mode 100644 index 0000000..d11d3f7 --- /dev/null +++ b/far/nodes/(4835,7,2210).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS(4835,7,2210) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(5856,21,2315).lua b/far/nodes/(5856,21,2315).lua new file mode 100644 index 0000000..60a9817 --- /dev/null +++ b/far/nodes/(5856,21,2315).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS(5856,21,2315) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(5857,21,2308).lua b/far/nodes/(5857,21,2308).lua new file mode 100644 index 0000000..c7ec3fa --- /dev/null +++ b/far/nodes/(5857,21,2308).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS(5857,21,2308) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(6173,24,2309).lua b/far/nodes/(6173,24,2309).lua new file mode 100644 index 0000000..e9c58b6 --- /dev/null +++ b/far/nodes/(6173,24,2309).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS(6173,25,2309) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(6173,24,2314).lua b/far/nodes/(6173,24,2314).lua new file mode 100644 index 0000000..2c43ca9 --- /dev/null +++ b/far/nodes/(6173,24,2314).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS(6173,25,2314) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(7321,8,1987).lua b/far/nodes/(7321,8,1987).lua new file mode 100644 index 0000000..f373ca9 --- /dev/null +++ b/far/nodes/(7321,8,1987).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS(7321,8,1987) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(7321,8,1991).lua b/far/nodes/(7321,8,1991).lua new file mode 100644 index 0000000..02b2115 --- /dev/null +++ b/far/nodes/(7321,8,1991).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS(7321,8,1991) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(7795,11,1987).lua b/far/nodes/(7795,11,1987).lua new file mode 100644 index 0000000..28aa696 --- /dev/null +++ b/far/nodes/(7795,11,1987).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS( 7795,11,1987 ) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/far/nodes/(8242,6,2060).lua b/far/nodes/(8242,6,2060).lua new file mode 100644 index 0000000..d1636fa --- /dev/null +++ b/far/nodes/(8242,6,2060).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS( 8242,6,2060 ) + F.save_train(posTable) + return +end
\ No newline at end of file diff --git a/il_timetable/init_code.lua b/il_timetable/init_code.lua index 70d25e4..322b0a4 100644 --- a/il_timetable/init_code.lua +++ b/il_timetable/init_code.lua @@ -147,8 +147,11 @@ S.ttt[train_id] = { - trains ]] local STOP_TIME = 10 +local STOPCMD="B0WO" local DEPCMD="A1OCD1SM" local RDEPCMD="RA1OCD1SM" +local DYNAMIC_THR = 10 +local DYNAMIC_EN = false if not S.ttp then S.ttp = {} end if not S.ttt then S.ttt = {} end @@ -161,7 +164,7 @@ F.ttp={ CFE_S = { outside_text = "[CFE] Origin\nvia Crystal Farms, Personhood West, Ehlodex", inside_line_desc = "CFE to Origin", - stn_display = "CFE Origin ", + stn_display = "CFE Origin North", }, NRG_E = { outside_text = "[NRG] Azena Transirejo", @@ -203,35 +206,35 @@ F.ttp={ inside_line_desc = "S12 to Silver Coast", stn_display = "S12 Silver Coast", }, - E84_N = { - outside_text = "[E84] Namespace Mountains", - inside_line_desc = "E84 to Namespace Mountains", - stn_display = "E84 Namespace M.", - }, - E84_S = { - outside_text = "[E84] Personhood Main", - inside_line_desc = "E84 to Personhood Main", - stn_display = "E84 Personhood ", - }, E85_N = { - outside_text = "[E85] Namespace Mountains", - inside_line_desc = "E85 to Namespace Mountains", - stn_display = "E85 Namespace M.", + outside_text = "[BAK] Namespace Mountains", + inside_line_desc = "Baka Express (BAK) to Namespace Mountains", + stn_display = "BAK Namespace M.", }, E85_S = { - outside_text = "[E85] BRIC / Morija North", - inside_line_desc = "E85 to BRIC / Morija North", - stn_display = "E85 BRIC/Morija ", + outside_text = "[BAK] Morija North", + inside_line_desc = "Baka Express (BAK) to Morija North", + stn_display = "BAK Morija North", }, E11_E = { - outside_text = "[E11] Oasis", - inside_line_desc = "E11 to Oasis", - stn_display = "E11 Oasis ", + outside_text = "[OEX] Oasis", + inside_line_desc = "OEX to Oasis", + stn_display = "OEX Oasis ", }, E11_W = { - outside_text = "[E11] Personhood", - inside_line_desc = "E11 to Personhood", - stn_display = "E11 Personhood ", + outside_text = "[OEX] Personhood", + inside_line_desc = "OEX to Personhood", + stn_display = "OEX Personhood ", + }, + E16_E = { + outside_text = "[E16] Cat-o-Land (By The Way)\nC&C Rail", + inside_line_desc = "E16 to Cat-o-Land (By The Way)", + stn_display = "E16 Cat-o-Land ", + }, + E16_W = { + outside_text = "[E16] Personhood\nC&C Rail", + inside_line_desc = "E16 to Personhood", + stn_display = "E16 Personhood ", }, } @@ -255,7 +258,11 @@ function F.ttp_begin(p) __approach_callback_mode = 1 if not F.ttp[p.tt] then error("No TT instance "..p.tt) end - if not atc_id or not atc_arrow then return end + if not atc_id then + print(p.stn,"missing train!",event) + return + end + if not atc_arrow then return end if p.only_lines and not p.only_lines[get_line()] then return end if not S.ttp[p.tt] then S.ttp[p.tt] = {} end local tti = S.ttp[p.tt] @@ -268,7 +275,7 @@ function F.ttp_begin(p) end if event.train then -- train arrived, planning departure - atc_send("B0 W O"..p.doorside) + atc_send(STOPCMD..p.doorside) local time_now = rwt.now() -- Train might have had another TT before, do the cleanup from ttp_end here. @@ -339,7 +346,10 @@ F.ttp_stop({ ]]function F.ttp_stop(p) -- set my approach callback mode __approach_callback_mode = 1 - if not atc_id or not atc_arrow then return end + if not atc_id then + print(p.stn,"missing train!",event) + return + end if not S.ttt[atc_id] then return end if p.only_lines and not p.only_lines[get_line()] then return end local trn = S.ttt[atc_id] @@ -356,9 +366,17 @@ F.ttp_stop({ atc_set_lzb_tsr(2) atc_set_text_inside("Next stop: "..p.stn) end + +--!-- disaster recovery --!-- +-- if event.approach and event.has_entered then +-- print(atc_id,p.stn,"Disaster Recovery...") +-- atc_send(DEPCMD) +-- end + + if event.train then -- train arrived, planning departure - atc_send("B0 W O"..p.doorside) + atc_send(STOPCMD..p.doorside) local time_now = rwt.now() -- update our location and determine desired and planned departure --L200 @@ -374,6 +392,17 @@ F.ttp_stop({ elseif tti.travel_times[p.stn] then trn.desired_dep = rwt.add(trn.initial_dep or 0, tti.travel_times[p.stn] + STOP_TIME) + -- dyn travel time + if DYNAMIC_EN then + local ttpd = rwt.diff(next_dep_time, trn.desired_dep) + if ttpd > DYNAMIC_THR then + local new_trav = rwt.diff(trn.initial_dep, time_now) + DYNAMIC_THR + print(atc_id,tt,"arrived at",p.stn,ttpd,"s early, TT",tti.travel_times[p.stn],"->",new_trav) + tti.travel_times[p.stn] = new_trav + trn.desired_dep = rwt.add(trn.initial_dep or 0, + new_trav + STOP_TIME) + end + end end if trn.desired_dep then @@ -435,11 +464,11 @@ function F.ttp_info_times(tt, starttime) if tti.recording_train then p[#p+1] = ("recording "..tti.recording_train) end - p[#p+1] = ("Di "..rwt.to_string(starttime, true).." "..tti.station_order[1]) + p[#p+1] = ("Di "..rwt.to_string(starttime, false).." "..tti.station_order[1]) for i=2,#tti.station_order do local ap = rwt.add(starttime, tti.travel_times[tti.station_order[i]]) p[#p+1] = ("Ap "..rwt.to_string(ap, true).. - " Dp "..rwt.to_string(rwt.add(ap, STOP_TIME), true).. + " Dp "..rwt.to_string(rwt.add(ap, STOP_TIME), false).. " "..tti.station_order[i]) end return p @@ -454,13 +483,13 @@ function F.ttp_info_trains(tt, starttime) if trn.actual_dep then p[#p+1] = ("Trn "..tid.. " after "..trn.location.. - " Dd "..rwt.to_string(trn.desired_dep or 0, true).. - " Da "..rwt.to_string(trn.actual_dep, true).. + " Dd "..rwt.to_string(trn.desired_dep or 0, false).. + " Da "..rwt.to_string(trn.actual_dep, false).. " Delay "..rwt.to_string(trn.last_delay or "59;59")) else p[#p+1] = ("Trn "..tid.. " at "..trn.location.. - " Dd "..rwt.to_string(trn.desired_dep or 0, true).. + " Dd "..rwt.to_string(trn.desired_dep or 0, false).. " Delay "..rwt.to_string(trn.last_delay or "59;59")) end end diff --git a/il_timetable/nodes/(-1109,5,-3256).lua b/il_timetable/nodes/(-1109,5,-3256).lua new file mode 100644 index 0000000..98df9b1 --- /dev/null +++ b/il_timetable/nodes/(-1109,5,-3256).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/(-1725,-1,-4420).lua b/il_timetable/nodes/(-1725,-1,-4420).lua new file mode 100644 index 0000000..2a9ff56 --- /dev/null +++ b/il_timetable/nodes/(-1725,-1,-4420).lua @@ -0,0 +1,3 @@ +if event.train and get_line() == "E1" then + atc_send("B1") +end
\ No newline at end of file diff --git a/il_timetable/nodes/(-1735,-1,-4398).lua b/il_timetable/nodes/(-1735,-1,-4398).lua new file mode 100644 index 0000000..2e1f620 --- /dev/null +++ b/il_timetable/nodes/(-1735,-1,-4398).lua @@ -0,0 +1 @@ +-- You forgot to change the env from ers so I did it for you. you had it as ers. It was blank as well. - erstazi
\ No newline at end of file diff --git a/il_timetable/nodes/(-640,14,-426).lua b/il_timetable/nodes/(-640,14,-426).lua index a67254f..72669e1 100644 --- a/il_timetable/nodes/(-640,14,-426).lua +++ b/il_timetable/nodes/(-640,14,-426).lua @@ -1,5 +1,4 @@ F.ttp_stop({ stn = "Spawn Main", doorside = "L", - end_of_tt = {CFE_S=true,NX_S=true,E1_S=true}, })
\ No newline at end of file diff --git a/il_timetable/nodes/(-699,1,-426).lua b/il_timetable/nodes/(-699,1,-426).lua new file mode 100644 index 0000000..908ee47 --- /dev/null +++ b/il_timetable/nodes/(-699,1,-426).lua @@ -0,0 +1,4 @@ +if get_line()=="KVE" then + set_rc("KVE_E") + atc_set_text_outside("[KVE] Kangasvarkaa Express\n-> KANGASVARKAA\nvia Sameary, Morija") +end
\ No newline at end of file diff --git a/il_timetable/nodes/(-863,14,-492).lua b/il_timetable/nodes/(-863,14,-492).lua index d86cc4c..9e9453c 100644 --- a/il_timetable/nodes/(-863,14,-492).lua +++ b/il_timetable/nodes/(-863,14,-492).lua @@ -3,7 +3,7 @@ if flip then atc_set_text_outside("E3 - BigFishCity\n via Trisiston") set_rc("E3_Sra") else - atc_set_text_outside("E3 - Shanielle Inlet\n via Trisiston") + atc_set_text_outside("E3 - Shanielle Park\n via Trisiston, Shn. Inlet") set_rc("E3_Edf") end flip = not flip
\ No newline at end of file diff --git a/il_timetable/nodes/(1074,14,3409).lua b/il_timetable/nodes/(1074,14,3409).lua new file mode 100644 index 0000000..c276192 --- /dev/null +++ b/il_timetable/nodes/(1074,14,3409).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Manaugh Memorial", + doorside = "R", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(1191,16,6141).lua b/il_timetable/nodes/(1191,16,6141).lua index 17e1b2f..8a8c0f9 100644 --- a/il_timetable/nodes/(1191,16,6141).lua +++ b/il_timetable/nodes/(1191,16,6141).lua @@ -1,10 +1,10 @@ F.ttp_begin({ stn = "Namespace Mountains", -- station name - tt = "E84_S", -- timetable ID - depint = "10;00", --departure slot interval - depoff = "07;30", --departure slot offset + tt = "E85_S", -- timetable ID + depint = "05;00", --departure slot interval + depoff = "02;30", --departure slot offset doorside = "L", reverse = true, - only_lines = { E84 = true }, + only_lines = { E85 = true }, force_tt_reset = false, -}) +})
\ No newline at end of file diff --git a/il_timetable/nodes/(1199,18,6127).lua b/il_timetable/nodes/(1199,18,6127).lua index 377e020..47bed36 100644 --- a/il_timetable/nodes/(1199,18,6127).lua +++ b/il_timetable/nodes/(1199,18,6127).lua @@ -1,5 +1,5 @@ F.ttp_station_display({ - lines = {"E84_N", "E84_S", "E85_N", "E85_S", }, + lines = {"E85_N", "E85_S", }, departure = {}, station = "Namespace Mountains", title = "Namespace Mtns", diff --git a/il_timetable/nodes/(152,11,892).lua b/il_timetable/nodes/(152,11,892).lua index a00ccff..c96a8e5 100644 --- a/il_timetable/nodes/(152,11,892).lua +++ b/il_timetable/nodes/(152,11,892).lua @@ -2,4 +2,5 @@ F.ttp_stop({ stn = "Schwarzschild Street", doorside = "L", only_lines={E1=true}, + no_disable_ars = true, })
\ No newline at end of file diff --git a/il_timetable/nodes/(1531,24,2649).lua b/il_timetable/nodes/(1531,24,2649).lua new file mode 100644 index 0000000..b35ef0a --- /dev/null +++ b/il_timetable/nodes/(1531,24,2649).lua @@ -0,0 +1,7 @@ +F.ttp_station_display({ + lines = {"E1_N"}, + departure = {}, + station = "Personhood South", + title = "Personhood South", + display1 = "d1", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(1531,24,2660).lua b/il_timetable/nodes/(1531,24,2660).lua new file mode 100644 index 0000000..d24be5f --- /dev/null +++ b/il_timetable/nodes/(1531,24,2660).lua @@ -0,0 +1,7 @@ +F.ttp_station_display({ + lines = {"E1_S"}, + departure = {}, + station = "Personhood South", + title = "Personhood South", + display1 = "d1", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(158,16,871).lua b/il_timetable/nodes/(158,16,871).lua new file mode 100644 index 0000000..dc89043 --- /dev/null +++ b/il_timetable/nodes/(158,16,871).lua @@ -0,0 +1,8 @@ +F.ttp_station_display({ + lines = {"E1_N", "E1_S", "S12_N", "S12_S"}, + departure = {}, + station = "Schwarzschild Street", + title = "Schwarzschild St.", + display1 = "d1", + display2 = "d2", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(159,11,846).lua b/il_timetable/nodes/(159,11,846).lua index 49e1131..6932523 100644 --- a/il_timetable/nodes/(159,11,846).lua +++ b/il_timetable/nodes/(159,11,846).lua @@ -1,28 +1,28 @@ if event.train then -st_name = "Schwarzschild Street" -set_line("4") -flip = not flip + st_name = "Schwarzschild Street" + set_line("4") + flip = not flip end doors = "L" - if event.train then - local time_now = rwt.now() - local next_dep_time = rwt.next_rpt(rwt.add(time_now, 10), 120, 0) -if flip then - atc_set_text_outside("4 - Showroom") - digiline_send("monitor", "4 Showroom "..rwt.to_string(next_dep_time, true)) - set_rc("SH") -else - digiline_send("monitor", "4 Ice Mountain "..rwt.to_string(next_dep_time, true)) - atc_set_text_outside("4 - Ice Mountain") - set_rc("IM") +if event.train then + local time_now = rwt.now() + local next_dep_time = rwt.next_rpt(rwt.add(time_now, 10), 120, 0) + if flip then + atc_set_text_outside("4 - Showroom") + digiline_send("monitor", "4 Showroom "..rwt.to_string(next_dep_time, true)) + set_rc("SH") + else + digiline_send("monitor", "4 Ice Mountain "..rwt.to_string(next_dep_time, true)) + atc_set_text_outside("4 - Ice Mountain") + set_rc("IM") + end + atc_set_text_inside(st_name.."\nDeparture: "..rwt.to_string(next_dep_time, true)) + atc_send("B0 W O"..doors) + schedule(next_dep_time, "depart") +elseif event.schedule then + atc_send("OCD1SM") + digiline_send("monitor", "Last Departure: | "..rwt.to_string(rwt.now(), true)) + atc_set_text_inside("") + depart = true end - atc_set_text_inside(st_name.."\nDeparture: "..rwt.to_string(next_dep_time, true)) - atc_send("B0 W O"..doors) - schedule(next_dep_time, "depart") - elseif event.schedule then - atc_send("OCD1SM") - digiline_send("monitor", "Last Departure: | "..rwt.to_string(rwt.now(), true)) - atc_set_text_inside("") - depart = true - end diff --git a/il_timetable/nodes/(1633,9,4628).lua b/il_timetable/nodes/(1633,9,4628).lua new file mode 100644 index 0000000..96203b7 --- /dev/null +++ b/il_timetable/nodes/(1633,9,4628).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Intercal", + doorside = "L", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(1722,30,2933).lua b/il_timetable/nodes/(1722,30,2933).lua new file mode 100644 index 0000000..e5f5896 --- /dev/null +++ b/il_timetable/nodes/(1722,30,2933).lua @@ -0,0 +1,9 @@ +F.ttp_station_display({ + lines = {"E1_N", "E11_W", "E16_W"}, + departure = {}, + station = "Personhood Main", + title = "Arrivals", + interval = 15, + display1 = "d1", + --display2 = "d2", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(1722,30,2937).lua b/il_timetable/nodes/(1722,30,2937).lua index 2d9fed2..560dfbe 100644 --- a/il_timetable/nodes/(1722,30,2937).lua +++ b/il_timetable/nodes/(1722,30,2937).lua @@ -1,9 +1,9 @@ F.ttp_station_display({ - lines = {"E1_N", "E1_S", "E84_N", "E84_S", "E11_W", "E11_E"}, + lines = {"E1_S", "E11_E", "E16_E"}, departure = {}, station = "Personhood Main", - title = "Personhood Main", + title = "Departures", interval = 15, display1 = "d1", - display2 = "d2", + --display2 = "d2", })
\ No newline at end of file diff --git a/il_timetable/nodes/(1725,28,2915).lua b/il_timetable/nodes/(1725,28,2915).lua index d28bc16..3d97e94 100644 --- a/il_timetable/nodes/(1725,28,2915).lua +++ b/il_timetable/nodes/(1725,28,2915).lua @@ -1,5 +1,5 @@ F.ttp_station_display({ - lines = {"E1_N", "E1_S"}, + lines = {"E1_N", "E1_S", "E11_W", "E11_E"}, departure = {}, station = "Personhood Main", title = "Personhood Main", diff --git a/il_timetable/nodes/(1728,28,3000).lua b/il_timetable/nodes/(1728,28,3000).lua new file mode 100644 index 0000000..d7f7c78 --- /dev/null +++ b/il_timetable/nodes/(1728,28,3000).lua @@ -0,0 +1 @@ +S.ttt[atc_id] = nil
\ No newline at end of file diff --git a/il_timetable/nodes/(1734,26,2929).lua b/il_timetable/nodes/(1734,26,2929).lua new file mode 100644 index 0000000..1d8f85b --- /dev/null +++ b/il_timetable/nodes/(1734,26,2929).lua @@ -0,0 +1,11 @@ +-- mary4: leave this here +F.ttp_begin({ + stn = "Personhood Main", -- station name + tt = "E16_E", -- timetable ID + depint = "05;00", --departure slot interval + depoff = "02;30", --departure slot offset + doorside = "R", + reverse = false, + only_lines = { E16 = true }, + force_tt_reset = false, +})
\ No newline at end of file diff --git a/il_timetable/nodes/(1739,28,2910).lua b/il_timetable/nodes/(1739,28,2910).lua new file mode 100644 index 0000000..ef59fd3 --- /dev/null +++ b/il_timetable/nodes/(1739,28,2910).lua @@ -0,0 +1,9 @@ +F.ttp_station_display({ + lines = {"E16_W", "E16_E"}, + 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/(1806,13,-217).lua b/il_timetable/nodes/(1806,13,-217).lua new file mode 100644 index 0000000..db11017 --- /dev/null +++ b/il_timetable/nodes/(1806,13,-217).lua @@ -0,0 +1,3 @@ +if get_line()=="KVE" then + set_rc("KVE_W") +end
\ No newline at end of file diff --git a/il_timetable/nodes/(1936,7,9131).lua b/il_timetable/nodes/(1936,7,9131).lua index cef8d24..ce4683f 100644 --- a/il_timetable/nodes/(1936,7,9131).lua +++ b/il_timetable/nodes/(1936,7,9131).lua @@ -8,4 +8,4 @@ F.ttp_begin({ only_lines = {['CFE'] = true}, force_tt_reset = false, }) -F.stat("CFE")
\ No newline at end of file +F.stat("CFE", false)
\ No newline at end of file diff --git a/il_timetable/nodes/(2253,25,4412).lua b/il_timetable/nodes/(2253,25,4412).lua new file mode 100644 index 0000000..35632c2 --- /dev/null +++ b/il_timetable/nodes/(2253,25,4412).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Hound's Wood", + doorside = "L", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(2514,7,5027).lua b/il_timetable/nodes/(2514,7,5027).lua new file mode 100644 index 0000000..1ab4b5c --- /dev/null +++ b/il_timetable/nodes/(2514,7,5027).lua @@ -0,0 +1,10 @@ +F.ttp_begin({ + stn = "Overfish Beach", -- station name + tt = "E16_W", -- timetable ID + depint = "00;30", --departure slot interval + depoff = "00;00", --departure slot offset + doorside = "L", + reverse = false, + only_lines = { E16 = true }, + force_tt_reset = false, +}) diff --git a/il_timetable/nodes/(2635,13,4369).lua b/il_timetable/nodes/(2635,13,4369).lua index 56e00a2..cf13114 100644 --- a/il_timetable/nodes/(2635,13,4369).lua +++ b/il_timetable/nodes/(2635,13,4369).lua @@ -1,4 +1,5 @@ F.ttp_stop({ stn = "Grub Valley (GVMER)", doorside = "R", + end_of_tt = {E16_E = true}, })
\ No newline at end of file diff --git a/il_timetable/nodes/(2655,15,4359).lua b/il_timetable/nodes/(2655,15,4359).lua index b2ab890..b9732b0 100644 --- a/il_timetable/nodes/(2655,15,4359).lua +++ b/il_timetable/nodes/(2655,15,4359).lua @@ -1,7 +1,8 @@ F.ttp_station_display({ - lines = {"E84_N", "E84_S", "E85_N", "E85_S"}, + lines = {"E85_N", "E85_S", "E16_E", "E16_W"}, departure = {}, station = "Grub Valley (GVMER)", title = "Grub Valley", display1 = "d1", + display2 = "d2", })
\ No newline at end of file diff --git a/il_timetable/nodes/(2716,8,4326).lua b/il_timetable/nodes/(2716,8,4326).lua new file mode 100644 index 0000000..f364e84 --- /dev/null +++ b/il_timetable/nodes/(2716,8,4326).lua @@ -0,0 +1,7 @@ +F.ttp_station_display({ + lines = {"E85_S"}, + departure = {}, + station = "Grub Valley", + title = "Grub Valley", + display1 = "d1", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(2716,8,4338).lua b/il_timetable/nodes/(2716,8,4338).lua new file mode 100644 index 0000000..bc9576a --- /dev/null +++ b/il_timetable/nodes/(2716,8,4338).lua @@ -0,0 +1,7 @@ +F.ttp_station_display({ + lines = {"E85_N"}, + departure = {}, + station = "Grub Valley", + title = "Grub Valley", + display1 = "d1", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(2739,6,4330).lua b/il_timetable/nodes/(2739,6,4330).lua new file mode 100644 index 0000000..73d6fe1 --- /dev/null +++ b/il_timetable/nodes/(2739,6,4330).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Grub Valley", + doorside = "R", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(288,4,206).lua b/il_timetable/nodes/(288,4,206).lua new file mode 100644 index 0000000..8b9e918 --- /dev/null +++ b/il_timetable/nodes/(288,4,206).lua @@ -0,0 +1,28 @@ +if event.train then +st_name = "NYE Square" +flip = not flip +end + +doors = "L" + if event.train then + local time_now = rwt.now() + local next_dep_time = rwt.next_rpt(rwt.add(time_now, 10), 120, 0) +if flip then + atc_set_text_outside("4 - Showroom") + digiline_send("monitor", "4 Showroom "..rwt.to_string(next_dep_time, true)) + set_rc("SH") +else + digiline_send("monitor", "4 Ice Mountain "..rwt.to_string(next_dep_time, true)) + atc_set_text_outside("4 - Ice Mountain") + set_rc("IM") +end + atc_set_text_inside(st_name.."\nDeparture: "..rwt.to_string(next_dep_time, true)) + atc_send("A0 B0 W O"..doors) + schedule(next_dep_time, "depart") + elseif event.schedule then + atc_send("A1OCD1SM") + digiline_send("monitor", "Last Departure: | "..rwt.to_string(rwt.now(), true)) + atc_set_text_inside("") + depart = true + end + diff --git a/il_timetable/nodes/(3974,7,4046).lua b/il_timetable/nodes/(3974,7,4046).lua new file mode 100644 index 0000000..a43a423 --- /dev/null +++ b/il_timetable/nodes/(3974,7,4046).lua @@ -0,0 +1,4 @@ +F.ttp_stop({ + stn = "Konquest", + doorside = "R", +})
\ No newline at end of file diff --git a/il_timetable/nodes/(4100,4,5242).lua b/il_timetable/nodes/(4100,4,5242).lua new file mode 100644 index 0000000..2c1e7f7 --- /dev/null +++ b/il_timetable/nodes/(4100,4,5242).lua @@ -0,0 +1,4 @@ +if get_line()=="KVE" then + set_rc("KVE_W") + atc_set_text_outside("[KVE] Kangasvarkaa Express\n-> SPAWN\nvia Morija, Sameary, Origin") +end
\ No newline at end of file diff --git a/il_timetable/nodes/(4393,-2,1947).lua b/il_timetable/nodes/(4393,-2,1947).lua new file mode 100644 index 0000000..5e9d62c --- /dev/null +++ b/il_timetable/nodes/(4393,-2,1947).lua @@ -0,0 +1,10 @@ +F.ttp_begin({ + stn = "Morija North", -- station name + tt = "E85_N", -- timetable ID + depint = "05;00", --departure slot interval + depoff = "07;30", --departure slot offset + doorside = "L", + reverse = true, + only_lines = { E85 = true }, + force_tt_reset = false, +})
\ No newline at end of file diff --git a/il_timetable/nodes/(4587,7,2174).lua b/il_timetable/nodes/(4587,7,2174).lua new file mode 100644 index 0000000..5e9d62c --- /dev/null +++ b/il_timetable/nodes/(4587,7,2174).lua @@ -0,0 +1,10 @@ +F.ttp_begin({ + stn = "Morija North", -- station name + tt = "E85_N", -- timetable ID + depint = "05;00", --departure slot interval + depoff = "07;30", --departure slot offset + doorside = "L", + reverse = true, + only_lines = { E85 = true }, + force_tt_reset = false, +})
\ No newline at end of file diff --git a/il_timetable/nodes/(4622,12,6795).lua b/il_timetable/nodes/(4622,12,6795).lua new file mode 100644 index 0000000..cf6751b --- /dev/null +++ b/il_timetable/nodes/(4622,12,6795).lua @@ -0,0 +1,3 @@ +if event.train and get_line() == "E16" then + set_rc("E16_poor_mans_ars") +end
\ No newline at end of file diff --git a/il_timetable/nodes/(788,8,-109).lua b/il_timetable/nodes/(788,8,-109).lua new file mode 100644 index 0000000..78cf1f7 --- /dev/null +++ b/il_timetable/nodes/(788,8,-109).lua @@ -0,0 +1,5 @@ +-- 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) +atc_set_text_outside("Line 1 - Palm Bay") +F.stop_sd_sched("Szymon's Dam Regional", "L", "RSM", 10, 120, 0)
\ No newline at end of file diff --git a/il_timetable/nodes/(957,14,1047).lua b/il_timetable/nodes/(957,14,1047).lua index 5e0be27..d9017d9 100644 --- a/il_timetable/nodes/(957,14,1047).lua +++ b/il_timetable/nodes/(957,14,1047).lua @@ -1,3 +1,4 @@ +--print(event,atc_id,"id") F.ttp_stop({ stn = "Ehlodex", doorside = "R", diff --git a/il_timetable/nodes/(981,22,1053).lua b/il_timetable/nodes/(981,22,1053).lua new file mode 100644 index 0000000..2a52ca4 --- /dev/null +++ b/il_timetable/nodes/(981,22,1053).lua @@ -0,0 +1,11 @@ +--S.ttt["901424"] = nil +--S.ttp["E85_N"] = nil + +local tr="E85" +S.ttp[tr.."_N"].force_tt_reset = true +S.ttp[tr.."_S"].force_tt_reset = true +print(tr.." resetting timetable") + + +--print(rwt.get_time()) +--print(rwt.to_secs(rwt.now()))
\ No newline at end of file diff --git a/il_timetable/nodes/(982,22,1053).lua b/il_timetable/nodes/(982,22,1053).lua new file mode 100644 index 0000000..a30cd5d --- /dev/null +++ b/il_timetable/nodes/(982,22,1053).lua @@ -0,0 +1,6 @@ + +lines = F.ttp_info_times("E84_S", "00;00") +linestr = F.ttp_info_trains("E84_S", "00;00") +local li = lines +for i=1,#linestr do li[#li+1] = linestr[i] end +print(" E84\n"..table.concat(li, "\n"))
\ No newline at end of file diff --git a/il_timetable/nodes/(999,16,1034).lua b/il_timetable/nodes/(999,16,1034).lua new file mode 100644 index 0000000..243ec26 --- /dev/null +++ b/il_timetable/nodes/(999,16,1034).lua @@ -0,0 +1,7 @@ +F.ttp_station_display({ + lines = {"CFE_N", "NX_N"}, + departure = {}, + station = "Ehlodex", + title = "Ehlodex", + display1 = "d1", +})
\ No newline at end of file diff --git a/m4/init_code.lua b/m4/init_code.lua new file mode 100644 index 0000000..8133311 --- /dev/null +++ b/m4/init_code.lua @@ -0,0 +1,96 @@ +--env-m4.lua +if S.trains == nil then S.trains = {} end +if S.d == nil then S.d = {} end +if S.datetime == nil then S.datetime = "" end +if S.stop_display == nil then S.stop_display = false end + +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.printAllTrainsInfo = true + F.max_displays = 4 + F.print("Initialized") +end + +F.does_train_have_rc = function(wanted_rc) + local rc = F.get_rc_safe() + if rc:match(wanted_rc) then return true end +end + +--old splitter and cpl for demo +function F.cpllooparound(ln) + if not (event.train) then + return + end + if not (F.get_line_safe() == ln) then return end + + if "ENGINE" == F.get_rc_safe() then + atc_send("CplS0WRSM") + set_rc("") + return + end + + split_at_index(F.get_train_length_safe()-1,"A0S0") --Stopping the wagons is handled here by SO + set_rc("ENGINE") + atc_send("A1") + +end + +--new ones +function F.split_looparound(ln) + if not (event.train) then return end + if not (F.get_line_safe() == ln) then return end + + split_at_index(F.get_train_length_safe()-1,"A0S0OC") --Stopping the wagons is handled here by SO + set_rc("ENGINE") + atc_send("A1") + +end + +function F.split_looparound_left(ln) + if not (event.train) then return end + if not (F.get_line_safe() == ln) then return end + + split_at_index(F.get_train_length_safe()-1,"A0S0OL") --Stopping the wagons is handled here by SO + set_rc("ENGINE") + atc_send("A1") + +end +function F.split_looparound_right(ln) + if not (event.train) then return end + if not (F.get_line_safe() == ln) then return end + + split_at_index(F.get_train_length_safe()-1,"A0S0OR") --Stopping the wagons is handled here by SO + set_rc("ENGINE") + atc_send("A1") + +end + +function F.cpl_looparound(ln) + if not (event.train) then return end + if not (F.get_line_safe() == ln) then return end + + if "ENGINE" == F.get_rc_safe() then + atc_send("CplS0WD2RS4") + set_rc("") + return + end + +end +--end of new cpl functions diff --git a/m4/nodes/(1734,26,2901).lua b/m4/nodes/(1734,26,2901).lua new file mode 100644 index 0000000..66ba746 --- /dev/null +++ b/m4/nodes/(1734,26,2901).lua @@ -0,0 +1 @@ +F.split_looparound_left("E16")
\ No newline at end of file diff --git a/m4/nodes/(1734,26,2935).lua b/m4/nodes/(1734,26,2935).lua new file mode 100644 index 0000000..0e0dc9c --- /dev/null +++ b/m4/nodes/(1734,26,2935).lua @@ -0,0 +1,3 @@ +if atc_arrow then + F.cpl_looparound("E16") +end
\ No newline at end of file diff --git a/m4/nodes/(1937,3,5835).lua b/m4/nodes/(1937,3,5835).lua new file mode 100644 index 0000000..9b60573 --- /dev/null +++ b/m4/nodes/(1937,3,5835).lua @@ -0,0 +1,2 @@ +-- +F.cpllooparound("E16")
\ No newline at end of file diff --git a/m4/nodes/(2010,3,5860).lua b/m4/nodes/(2010,3,5860).lua new file mode 100644 index 0000000..5229dce --- /dev/null +++ b/m4/nodes/(2010,3,5860).lua @@ -0,0 +1,22 @@ +local ch = { + get = "ars_set_query", + input = "ars_set", + indicator = "ars_indicator", +} + +if event.train then + digiline_send(ch.get, "GET") + return +end + +if event.digiline then + if event.channel==ch.input then + if not atc_id then + digiline_send(ch.indicator, true) + return + end + set_rc(tostring(event.msg)) + digiline_send(ch.indicator, false) + return + end +end
\ No newline at end of file diff --git a/m4/nodes/(2010,3,5895).lua b/m4/nodes/(2010,3,5895).lua new file mode 100644 index 0000000..bb6fdaa --- /dev/null +++ b/m4/nodes/(2010,3,5895).lua @@ -0,0 +1 @@ +F.cpllooparound("E16")
\ No newline at end of file diff --git a/m4/nodes/(2011,3,5835).lua b/m4/nodes/(2011,3,5835).lua new file mode 100644 index 0000000..9b60573 --- /dev/null +++ b/m4/nodes/(2011,3,5835).lua @@ -0,0 +1,2 @@ +-- +F.cpllooparound("E16")
\ No newline at end of file diff --git a/m4/nodes/(2013,3,5889).lua b/m4/nodes/(2013,3,5889).lua new file mode 100644 index 0000000..bb6fdaa --- /dev/null +++ b/m4/nodes/(2013,3,5889).lua @@ -0,0 +1 @@ +F.cpllooparound("E16")
\ No newline at end of file diff --git a/m4/nodes/(4539,11,6809).lua b/m4/nodes/(4539,11,6809).lua new file mode 100644 index 0000000..c42277b --- /dev/null +++ b/m4/nodes/(4539,11,6809).lua @@ -0,0 +1,2 @@ +atc_set_text_outside("[E16] Personhood\nvia Grub Valley\nC&C Rail") +F.split_looparound_left("E16")
\ No newline at end of file diff --git a/m4/nodes/(4542,11,6809).lua b/m4/nodes/(4542,11,6809).lua new file mode 100644 index 0000000..67b31a2 --- /dev/null +++ b/m4/nodes/(4542,11,6809).lua @@ -0,0 +1,4 @@ +-- Poor Man's ARS +if event.train and get_rc() == "E16_poor_mans_ars" then + set_route("Btw-E16-behelf", "E16Turnback") +end
\ No newline at end of file diff --git a/m4/nodes/(4568,11,6809).lua b/m4/nodes/(4568,11,6809).lua new file mode 100644 index 0000000..0e0dc9c --- /dev/null +++ b/m4/nodes/(4568,11,6809).lua @@ -0,0 +1,3 @@ +if atc_arrow then + F.cpl_looparound("E16") +end
\ No newline at end of file diff --git a/nlvcross/init_code.lua b/nlvcross/init_code.lua index 2a5ffeb..cee6d29 100644 --- a/nlvcross/init_code.lua +++ b/nlvcross/init_code.lua @@ -21,6 +21,8 @@ F.crossings={ gardonst = 4, Trs_Church = 3, NRG = 6, + Rsi_stn = 2, + Rsi = 2, } --[[ Setting up level crossings: 1. choose a name diff --git a/nlvcross/nodes/(-543,10,-772).lua b/nlvcross/nodes/(-543,10,-772).lua new file mode 100644 index 0000000..a21f820 --- /dev/null +++ b/nlvcross/nodes/(-543,10,-772).lua @@ -0,0 +1 @@ +F.on("Rsi_stn", "")
\ No newline at end of file diff --git a/nlvcross/nodes/(-543,10,-773).lua b/nlvcross/nodes/(-543,10,-773).lua new file mode 100644 index 0000000..a21f820 --- /dev/null +++ b/nlvcross/nodes/(-543,10,-773).lua @@ -0,0 +1 @@ +F.on("Rsi_stn", "")
\ No newline at end of file diff --git a/nlvcross/nodes/(-547,10,-771).lua b/nlvcross/nodes/(-547,10,-771).lua new file mode 100644 index 0000000..d3d07a3 --- /dev/null +++ b/nlvcross/nodes/(-547,10,-771).lua @@ -0,0 +1 @@ +F.off("Rsi_stn", "")
\ No newline at end of file diff --git a/nlvcross/nodes/(-550,10,-769).lua b/nlvcross/nodes/(-550,10,-769).lua new file mode 100644 index 0000000..d3d07a3 --- /dev/null +++ b/nlvcross/nodes/(-550,10,-769).lua @@ -0,0 +1 @@ +F.off("Rsi_stn", "")
\ No newline at end of file diff --git a/nlvcross/nodes/(-554,10,-762).lua b/nlvcross/nodes/(-554,10,-762).lua new file mode 100644 index 0000000..a21f820 --- /dev/null +++ b/nlvcross/nodes/(-554,10,-762).lua @@ -0,0 +1 @@ +F.on("Rsi_stn", "")
\ No newline at end of file diff --git a/nlvcross/nodes/(-571,10,-742).lua b/nlvcross/nodes/(-571,10,-742).lua new file mode 100644 index 0000000..1a038e2 --- /dev/null +++ b/nlvcross/nodes/(-571,10,-742).lua @@ -0,0 +1 @@ +F.on("Rsi", "")
\ No newline at end of file diff --git a/nlvcross/nodes/(-590,9,-743).lua b/nlvcross/nodes/(-590,9,-743).lua new file mode 100644 index 0000000..d70268e --- /dev/null +++ b/nlvcross/nodes/(-590,9,-743).lua @@ -0,0 +1 @@ +F.off("Rsi", "")
\ No newline at end of file diff --git a/nlvcross/nodes/(-598,9,-747).lua b/nlvcross/nodes/(-598,9,-747).lua new file mode 100644 index 0000000..d70268e --- /dev/null +++ b/nlvcross/nodes/(-598,9,-747).lua @@ -0,0 +1 @@ +F.off("Rsi", "")
\ No newline at end of file diff --git a/nlvcross/nodes/(-620,9,-749).lua b/nlvcross/nodes/(-620,9,-749).lua new file mode 100644 index 0000000..1a038e2 --- /dev/null +++ b/nlvcross/nodes/(-620,9,-749).lua @@ -0,0 +1 @@ +F.on("Rsi", "")
\ No newline at end of file diff --git a/subway/nodes/(-1586,-1,685).lua b/subway/nodes/(-1586,-1,685).lua index c14728e..40b7f1b 100644 --- a/subway/nodes/(-1586,-1,685).lua +++ b/subway/nodes/(-1586,-1,685).lua @@ -1,2 +1,2 @@ F.stn_return_free("Apl1W", "Pal1ES", "st") -atc_send("B2")
\ No newline at end of file +atc_send("B3")
\ No newline at end of file diff --git a/subway/nodes/(-1606,2,595).lua b/subway/nodes/(-1606,2,595).lua index 7dbb72c..c750f91 100644 --- a/subway/nodes/(-1606,2,595).lua +++ b/subway/nodes/(-1606,2,595).lua @@ -1,6 +1,6 @@ if event.train then if flip then - atc_set_text_outside("1 - Syzmon's Dam") + atc_set_text_outside("1 - Szymon's Dam") set_rc("Szy") else atc_set_text_outside("1 - Windy Mountains") diff --git a/subway/nodes/(-543,-5,-772).lua b/subway/nodes/(-543,-5,-772).lua index ce124b7..6fc7189 100644 --- a/subway/nodes/(-543,-5,-772).lua +++ b/subway/nodes/(-543,-5,-772).lua @@ -1,3 +1,3 @@ depart=false F.stn("Wbb3N", "Rsi3N", "Leo3N", "L") --- F.stat("Line 3", false)
\ No newline at end of file +F.stat("Line 3", false)
\ No newline at end of file diff --git a/subway/nodes/(-6,25,43).lua b/subway/nodes/(-6,25,43).lua index 230acc7..ad0b06e 100644 --- a/subway/nodes/(-6,25,43).lua +++ b/subway/nodes/(-6,25,43).lua @@ -1 +1 @@ -F.stn("OEs2", "OIr2", "OTh2", "L", 10) +F.stn("OEs2", "OIr2", "OLv2", "L", 10) diff --git a/subway/nodes/(114,10,-10).lua b/subway/nodes/(114,10,-10).lua new file mode 100644 index 0000000..6ddab96 --- /dev/null +++ b/subway/nodes/(114,10,-10).lua @@ -0,0 +1,9 @@ +if event.type == "punch" then + interrupt_pos({x= 124,y=14,z=-12} , "toggle") + return +end + +if event.type == "digiline" and event.channel == "tdetectors" then + interrupt_pos({x= 119,y=10,z=-26} , event.msg) + return +end
\ No newline at end of file diff --git a/subway/nodes/(42,25,-67).lua b/subway/nodes/(42,25,-67).lua index 22fee4f..5105ed2 100644 --- a/subway/nodes/(42,25,-67).lua +++ b/subway/nodes/(42,25,-67).lua @@ -1 +1 @@ -F.stn("OTh2", "OLv2", "OBa2", "L", 10)
\ No newline at end of file +F.stn("OIr2", "OLv2", "OBa2", "L", 10)
\ No newline at end of file diff --git a/ywang/init_code.lua b/ywang/init_code.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/ywang/init_code.lua diff --git a/ywang/nodes/(1991,19,8251).lua b/ywang/nodes/(1991,19,8251).lua new file mode 100644 index 0000000..740144a --- /dev/null +++ b/ywang/nodes/(1991,19,8251).lua @@ -0,0 +1,35 @@ +local formats = {".%d", "+%d", "%d\t", "\t%d", "%d ", " %d", "%d\n", "\n%d", "-%d", "%d."} +local len = #formats*10 + +local function color(num) + return math.fmod(num*67+101, 255) + math.fmod(num*97+109, 255) + math.fmod(num*73+127, 255) +end + +if not disco then + disco = 0 +end +if not atc_id then + return +end +if event.type == "train" then + if not atc_id then return end + atc_send("B0") + disco = 0 +end +if event.type == "train" or event.type == "schedule" then + local line = get_line() + if not line or line == "" or (line:len() == 2 and tonumber(line)) then + local digit, fmt, str + for _ = 1, 10 do + digit = math.floor(disco/#formats) + fmt = formats[disco%#formats+1] + str = fmt:format(digit) + disco = (disco+1)%len + if color(tonumber(str)) <= 512 then + break + end + end + set_line(str) + schedule_in(5) + end +end
\ No newline at end of file |