diff options
Diffstat (limited to 'durt')
45 files changed, 1216 insertions, 80 deletions
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 |