diff options
Diffstat (limited to 'auto_yards')
22 files changed, 196 insertions, 4 deletions
diff --git a/auto_yards/init_code.lua b/auto_yards/init_code.lua index f3b4282..3d442bc 100644 --- a/auto_yards/init_code.lua +++ b/auto_yards/init_code.lua @@ -86,8 +86,9 @@ if event.init then S.known_trains = { ['120684'] = "LHF #1", --Maverick2797 ['249165'] = "LHF #2", --Maverick2797 - ['734206'] = "ARC-BY", --Maverick2797 + ['368003'] = "ARC-BY", --Maverick2797 ['588750'] = "MMF-TY", --survivalg/erstazi + ['879136'] = "ERS-SNS", --erstazi ['543381'] = "WOA-IP", --Maverick2797 ['834721'] = "S27-ARC", --Maverick2797 ['513598'] = "S27EX-ARC", --Maverick2797 diff --git a/auto_yards/nodes/(-1933,16,806).lua b/auto_yards/nodes/(-1932,16,807).lua index 4503e25..4503e25 100644 --- a/auto_yards/nodes/(-1933,16,806).lua +++ b/auto_yards/nodes/(-1932,16,807).lua diff --git a/auto_yards/nodes/(-1938,16,805).lua b/auto_yards/nodes/(-1937,16,806).lua index 4503e25..4503e25 100644 --- a/auto_yards/nodes/(-1938,16,805).lua +++ b/auto_yards/nodes/(-1937,16,806).lua diff --git a/auto_yards/nodes/(-1946,16,801).lua b/auto_yards/nodes/(-1945,16,802).lua index 4503e25..4503e25 100644 --- a/auto_yards/nodes/(-1946,16,801).lua +++ b/auto_yards/nodes/(-1945,16,802).lua diff --git a/auto_yards/nodes/(-1947,16,837).lua b/auto_yards/nodes/(-1947,16,837).lua index 0a82dfd..5e2841b 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 = {['S27_EXPORT'] = true} +S.yards.ARC.notify = {['S27'] = true} print(S.yards.ARC.notify)
\ No newline at end of file diff --git a/auto_yards/nodes/(-1954,16,797).lua b/auto_yards/nodes/(-1953,16,798).lua index 4503e25..4503e25 100644 --- a/auto_yards/nodes/(-1954,16,797).lua +++ b/auto_yards/nodes/(-1953,16,798).lua diff --git a/auto_yards/nodes/(-2029,19,733).lua b/auto_yards/nodes/(-2029,19,733).lua index f88c9f0..afbb94b 100644 --- a/auto_yards/nodes/(-2029,19,733).lua +++ b/auto_yards/nodes/(-2029,19,733).lua @@ -1,14 +1,37 @@ local yard_id = "ARC" + +__approach_callback_mode = 1 +if event.approach and not event.has_entered then --disable ARS for all approaching trains + atc_set_ars_disable(true) + atc_set_lzb_tsr(1) + return +end + 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 + F.indicator(S.yards[yard_id].active_indicator_pos,false) + + -- Extract the second exit director from ARC_2nd_EXIT_x and insert if available + -- should be safe to add it now as the route has already been set to reenter the yard first + local rc = F.get_rc_safe():match("ARC_2ND_EXIT_(%S+)") + print("Second Exit RC: "..tostring(rc)) + if rc then + F.remove_rc_match("ARC_2ND_EXIT_%S+") + F.add_rc(rc) + print(F.get_rc_safe()) + end + + -- defer re-enabling ARS to ensure the route has been accepted, or at least queued atc_send("S4D1A1") - return + return end + + -- disregard light exit locos 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/(-2042,19,723).lua b/auto_yards/nodes/(-2042,19,723).lua new file mode 100644 index 0000000..a0d12bd --- /dev/null +++ b/auto_yards/nodes/(-2042,19,723).lua @@ -0,0 +1,8 @@ +if event.train and atc_arrow then + F.remove_rc_match("ARC_LOCOS_%S+") + F.remove_rc_match("ARC_WAGONS_%S+") + F.remove_rc({ + "ARC_DEPART", + "ARC_FINAL_COLLECT" + }) +end
\ No newline at end of file diff --git a/auto_yards/nodes/(771,14,-16).lua b/auto_yards/nodes/(771,14,-16).lua new file mode 100644 index 0000000..447dce1 --- /dev/null +++ b/auto_yards/nodes/(771,14,-16).lua @@ -0,0 +1,55 @@ +--leekston collection controller +local up_dir = "North" +local down_dir = "South" +local up_dir_indicator = POS(771,13,-14) +local down_dir_indicator = POS(771,13,-15) +local exit_indicator_pos = POS(771,13,-18) + +local userlist = { + "Maverick2797", + "mary4" +} + +if event.ext_int then --to be pinged by the departing LHF train only + local dir + if F.indicator(exit_indicator_pos) then + F.indicator(up_dir_indicator, false) + dir = up_dir + else + F.indicator(down_dir_indicator, false) + dir = down_dir + end + digiline_send("lcd",string.format("%s | Train collected and departed %sbound",rwt.to_string(rwt.now()), dir)) + return +end + +--confirm user is actually allowed to use this system +local permitted_user = false +for _,name in pairs(userlist) do + if name == event.name then + permitted_user = name + break + end +end +if not permitted_user then + digiline_send("lcd","User is not permitted to use this. Contact a moderator") + return +end + +local dir = "" +--cycle through the departure options +if F.indicator(up_dir_indicator) then + F.indicator(up_dir_indicator, false) + F.indicator(down_dir_indicator, true) + dir = down_dir.."bound" +elseif F.indicator(down_dir_indicator) then + F.indicator(up_dir_indicator, false) + F.indicator(down_dir_indicator, false) + dir = "Disabled" +else + F.indicator(up_dir_indicator, true) + F.indicator(down_dir_indicator, false) + dir = up_dir.."bound" +end + +digiline_send("lcd",string.format("%s\nCollection %s.\nUser %s", rwt.to_string(rwt.now()), dir, event.name))
\ No newline at end of file diff --git a/auto_yards/nodes/(775,13,-20).lua b/auto_yards/nodes/(775,13,-20).lua new file mode 100644 index 0000000..8cd2bb9 --- /dev/null +++ b/auto_yards/nodes/(775,13,-20).lua @@ -0,0 +1 @@ +interrupt_pos(POS(771,14,-16))
\ No newline at end of file diff --git a/auto_yards/nodes/(783,10,-57).lua b/auto_yards/nodes/(783,10,-57).lua new file mode 100644 index 0000000..e56cc30 --- /dev/null +++ b/auto_yards/nodes/(783,10,-57).lua @@ -0,0 +1,2 @@ +if not F.has_rc("LEEK_EXIT") then return end +-- remove any extra yard RCs here
\ No newline at end of file diff --git a/auto_yards/nodes/(785,10,40).lua b/auto_yards/nodes/(785,10,40).lua new file mode 100644 index 0000000..e56cc30 --- /dev/null +++ b/auto_yards/nodes/(785,10,40).lua @@ -0,0 +1,2 @@ +if not F.has_rc("LEEK_EXIT") then return end +-- remove any extra yard RCs here
\ No newline at end of file diff --git a/auto_yards/nodes/(789,10,-31).lua b/auto_yards/nodes/(789,10,-31).lua new file mode 100644 index 0000000..e877483 --- /dev/null +++ b/auto_yards/nodes/(789,10,-31).lua @@ -0,0 +1 @@ +-- arrival, dir = false
\ No newline at end of file diff --git a/auto_yards/nodes/(789,10,13).lua b/auto_yards/nodes/(789,10,13).lua new file mode 100644 index 0000000..4d16159 --- /dev/null +++ b/auto_yards/nodes/(789,10,13).lua @@ -0,0 +1 @@ +-- arrival, dir = true
\ No newline at end of file diff --git a/auto_yards/nodes/(792,10,-31).lua b/auto_yards/nodes/(792,10,-31).lua new file mode 100644 index 0000000..fa98cc9 --- /dev/null +++ b/auto_yards/nodes/(792,10,-31).lua @@ -0,0 +1 @@ +-- continue onwards
\ No newline at end of file diff --git a/auto_yards/nodes/(792,10,11).lua b/auto_yards/nodes/(792,10,11).lua new file mode 100644 index 0000000..ece3c16 --- /dev/null +++ b/auto_yards/nodes/(792,10,11).lua @@ -0,0 +1 @@ +-- continue northwards
\ No newline at end of file diff --git a/auto_yards/nodes/(794,10,31).lua b/auto_yards/nodes/(794,10,31).lua new file mode 100644 index 0000000..f7e80a9 --- /dev/null +++ b/auto_yards/nodes/(794,10,31).lua @@ -0,0 +1,46 @@ +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +local rev_rc = "LEEK_HS_north" +local rm_rc = true +local autocouple = nil +local rm_cpl_rc = true + +__approach_callback_mode = 1 + +if event.approach and not event.has_entered then + if not F.has_rc(rev_rc) then return end + 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 + atc_send("S3") + 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/(796,10,-39).lua b/auto_yards/nodes/(796,10,-39).lua new file mode 100644 index 0000000..265c211 --- /dev/null +++ b/auto_yards/nodes/(796,10,-39).lua @@ -0,0 +1 @@ +-- collection track (controlled by tower UI)
\ No newline at end of file diff --git a/auto_yards/nodes/(796,10,-54).lua b/auto_yards/nodes/(796,10,-54).lua new file mode 100644 index 0000000..a3f3e42 --- /dev/null +++ b/auto_yards/nodes/(796,10,-54).lua @@ -0,0 +1,46 @@ +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +local rev_rc = "LEEK_HS_south" +local rm_rc = true +local autocouple = nil +local rm_cpl_rc = true + +__approach_callback_mode = 1 + +if event.approach and not event.has_entered then + if not F.has_rc(rev_rc) then return end + 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 + atc_send("S3") + 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/(796,10,3).lua b/auto_yards/nodes/(796,10,3).lua new file mode 100644 index 0000000..265c211 --- /dev/null +++ b/auto_yards/nodes/(796,10,3).lua @@ -0,0 +1 @@ +-- collection track (controlled by tower UI)
\ No newline at end of file diff --git a/auto_yards/nodes/(799,10,-37).lua b/auto_yards/nodes/(799,10,-37).lua new file mode 100644 index 0000000..1db4581 --- /dev/null +++ b/auto_yards/nodes/(799,10,-37).lua @@ -0,0 +1 @@ +-- drop off here from LFH
\ No newline at end of file diff --git a/auto_yards/nodes/(799,10,3).lua b/auto_yards/nodes/(799,10,3).lua new file mode 100644 index 0000000..1db4581 --- /dev/null +++ b/auto_yards/nodes/(799,10,3).lua @@ -0,0 +1 @@ +-- drop off here from LFH
\ No newline at end of file |