summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-11-02 00:00:01 +0100
committerautocommitter <autocommitter@linux-forks.de>2024-11-02 00:00:01 +0100
commit91cc36ecd4e2c68040642dbaf0b0dc46106df61c (patch)
tree9c663a4233ddc831f6c3d0ed10a4d8166d4b93db
parent2d065ce9bedc6c7c0740a9148e96463749f8bf24 (diff)
downloadluaatc_envs-91cc36ecd4e2c68040642dbaf0b0dc46106df61c.tar.gz
luaatc_envs-91cc36ecd4e2c68040642dbaf0b0dc46106df61c.tar.bz2
luaatc_envs-91cc36ecd4e2c68040642dbaf0b0dc46106df61c.zip
State at 2024-11-02
-rw-r--r--auto_yards/init_code.lua16
-rw-r--r--auto_yards/nodes/(-1946,16,840).lua2
-rw-r--r--auto_yards/nodes/(-1947,16,837).lua2
-rw-r--r--auto_yards/nodes/(-524,26,2481).lua1
-rw-r--r--auto_yards/nodes/(-584,26,2481).lua17
-rw-r--r--auto_yards/nodes/(-588,26,2504).lua49
-rw-r--r--auto_yards/nodes/(-588,26,2534).lua1
-rw-r--r--auto_yards/nodes/(-630,26,2454).lua88
-rw-r--r--auto_yards/nodes/(-633,26,2456).lua4
-rw-r--r--auto_yards/nodes/(-643,26,2475).lua74
-rw-r--r--auto_yards/nodes/(-668,20,2478).lua4
-rw-r--r--auto_yards/nodes/(-719,20,2475).lua2
-rw-r--r--auto_yards/nodes/(417,17,4).lua2
-rw-r--r--durt/nodes/(-1373,10,-2507).lua3
-rw-r--r--durt/nodes/(-1419,11,-2545).lua5
-rw-r--r--durt/nodes/(-1426,11,-2548).lua2
-rw-r--r--durt/nodes/(-1439,11,-2551).lua7
-rw-r--r--durt/nodes/(-1442,11,-2568).lua4
-rw-r--r--durt/nodes/(-1444,11,-2546).lua8
-rw-r--r--durt/nodes/(-1444,11,-2556).lua7
-rw-r--r--durt/nodes/(-572,27,2515).lua1
-rw-r--r--durt/nodes/(-743,18,2424).lua45
22 files changed, 234 insertions, 110 deletions
diff --git a/auto_yards/init_code.lua b/auto_yards/init_code.lua
index 0a4312c..f3b4282 100644
--- a/auto_yards/init_code.lua
+++ b/auto_yards/init_code.lua
@@ -83,6 +83,16 @@ if event.init then
-- error_indicator_pos = POS(-4025,13,-2671),
-- },
}
+ S.known_trains = {
+ ['120684'] = "LHF #1", --Maverick2797
+ ['249165'] = "LHF #2", --Maverick2797
+ ['734206'] = "ARC-BY", --Maverick2797
+ ['588750'] = "MMF-TY", --survivalg/erstazi
+ ['543381'] = "WOA-IP", --Maverick2797
+ ['834721'] = "S27-ARC", --Maverick2797
+ ['513598'] = "S27EX-ARC", --Maverick2797
+ ['590988'] = "CAN-ARC", --Maverick2797
+ }
end
------------------------------------------------------------------------------------
-- Utility Functions
@@ -220,7 +230,7 @@ F.yard_arrival = function(yard_id,this_dir, force_rts) -- arrow points towards y
if S.print_debug then
print(rwt.to_string(rwt.now()))
- print("YARD "..yard_id..": Train "..atc_id.." enters from the "..tostring(this_dir).." direction and will exit in the "..tostring(rts).." direction")
+ print("YARD "..yard_id..": Train "..atc_id.." ("..(S.known_trains[atc_id] or "Unknown")..") enters from the "..tostring(this_dir).." direction and will exit in the "..tostring(rts).." direction")
print("YARD "..yard_id..": Length "..train_length())
end
return
@@ -237,7 +247,7 @@ F.yard_arrival = function(yard_id,this_dir, force_rts) -- arrow points towards y
if F.indicator(yard.active_indicator_pos) then
if S.print_debug then
print(rwt.to_string(rwt.now()))
- print("YARD "..yard_id..": Train "..atc_id.." has arrived from the "..tostring(this_dir).." direction and has to wait for the yard to deactivate.")
+ print("YARD "..yard_id..": Train "..atc_id.." ("..(S.known_trains[atc_id] or "Unknown")..") has arrived from the "..tostring(this_dir).." direction and has to wait for the yard to deactivate.")
end
schedule_in(";10","recheck")
return
@@ -410,7 +420,7 @@ F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard
if F.has_rc(yard_id.."_DEPART") then
if S.print_debug then
print(rwt.to_string(rwt.now()))
- print("YARD "..yard_id..": Train "..atc_id.." has a length of "..train_length())
+ print("YARD "..yard_id..": Train "..atc_id.." ("..(S.known_trains[atc_id] or "Unknown")..") has a length of "..train_length())
print("YARD "..yard_id..": It will depart in the "..tostring(this_dir).." direction.")
end
S.yards[yard_id].departure_length = train_length()
diff --git a/auto_yards/nodes/(-1946,16,840).lua b/auto_yards/nodes/(-1946,16,840).lua
index 4dd7c28..3176b25 100644
--- a/auto_yards/nodes/(-1946,16,840).lua
+++ b/auto_yards/nodes/(-1946,16,840).lua
@@ -13,6 +13,8 @@ local subs = {
['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"},
+ ['S27_EXPORT'] = {['pos'] = POS(-1444,11,-2546), ['msg'] = "notify"},
+
}
if event.ext_int or event.punch then
diff --git a/auto_yards/nodes/(-1947,16,837).lua b/auto_yards/nodes/(-1947,16,837).lua
index 7ddaaf6..0a82dfd 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_LOAD'] = true}
+S.yards.ARC.notify = {['S27_EXPORT'] = true}
print(S.yards.ARC.notify) \ No newline at end of file
diff --git a/auto_yards/nodes/(-524,26,2481).lua b/auto_yards/nodes/(-524,26,2481).lua
index 74a7624..e119505 100644
--- a/auto_yards/nodes/(-524,26,2481).lua
+++ b/auto_yards/nodes/(-524,26,2481).lua
@@ -1,2 +1,3 @@
+if F.has_rc("CAN_INTRA_SHUFFLE") then atc_send("S0WD2RS2") return end
-- 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
index 46e3050..2995aaa 100644
--- a/auto_yards/nodes/(-584,26,2481).lua
+++ b/auto_yards/nodes/(-584,26,2481).lua
@@ -1,2 +1,19 @@
+-- Cannery departures lane modified
+
+local ind = POS(-594,26,2488) --notification indicator
+
+if F.has_rc("CAN_INTRA_SHUFFLE") then
+ if not atc_arrow then atc_send("A0S1CplD2S1") return end
+ split_off_locomotive("A0B0")
+ F.remove_rc("CAN_CLASS_DEPARTURES")
+ F.add_rc({
+ "CAN_HS_W",
+ "CAN_send_to_locostore"
+ })
+ atc_send("A1S3")
+ F.indicator(ind,true) --re-enable the notification as we haven't actually left the yard yet
+ F.indicator(S.yards.CAN.active_indicator_pos, false) -- disable the active indicator
+ return
+end
-- 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
index cb800d9..5382804 100644
--- a/auto_yards/nodes/(-588,26,2504).lua
+++ b/auto_yards/nodes/(-588,26,2504).lua
@@ -1,26 +1,27 @@
-function tprint (tbl, indent)
- local s = ""
- if not indent then indent = 0 end
- for k, v in pairs(tbl) do
- local formatting = string.rep(" ", indent) .. "['"..k .. "']= "
- if type(v) == "table" then
- s = s .. formatting .. "{"..tprint(v, indent+1).."}"
- else
- s = s .. formatting .. tostring(v)
- end
- s = s .. ", "
- end
- return s
-end
+-- Cannery Dirt Loading Lane Modified
+local sand_indicator = POS(-572,26,2515) --sand indicator
-local str = "CAN_SB!S27!SAND_UNLOAD!DIRT_LOAD!S27_NB!CANNERY!DIRT_UNLOAD!SAND_LOAD"
-local fc_table = {""}
-for i=2,train_length() do
-table.insert(fc_table,str)
+if F.has_rc("CAN_INTRA_SHUFFLE") then
+ if not atc_arrow then return end
+ if F.has_rc("CAN_CLASS_DIRT_UNLOAD") then -- remove wagons, step the fc, return the wagons
+ F.remove_rc("CAN_CLASS_DIRT_UNLOAD")
+ F.add_rc({
+ "CAN_HS_W",
+ "CAN_CLASS_SAND_LOAD"
+ })
+ step_fc()
+ return
+ end
+ if F.has_rc("CAN_CLASS_SAND_LOAD") then -- remove wagons, step the fc, move wagons to departures
+ F.remove_rc("CAN_CLASS_SAND_LOAD")
+ F.add_rc({
+ "CAN_HS_W", --departures track has Cpl function built in
+ "CAN_CLASS_DEPARTURES"
+ })
+ step_fc()
+ F.indicator(sand_indicator, false)
+ return
+ end
+ return
end
-set_fc(fc_table, true)
-print(tprint(get_fc()))
-
-
--- EOL
---F.lane_EOL("CAN",true) \ No newline at end of file
+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
index 74a7624..d783815 100644
--- a/auto_yards/nodes/(-588,26,2534).lua
+++ b/auto_yards/nodes/(-588,26,2534).lua
@@ -1,2 +1,3 @@
+if F.has_rc("CAN_INTRA_SHUFFLE") then atc_send("A0S0WRD5S3A1") return end
-- 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 5715c34..8dd1ff7 100644
--- a/auto_yards/nodes/(-630,26,2454).lua
+++ b/auto_yards/nodes/(-630,26,2454).lua
@@ -1,22 +1,53 @@
+-- Cannery Loco Storage
local notification_id = "CAN"
-local ind = POS(-594,26,2488)
-local shuffle_ind = POS(-594,26,2487)
+local ind = POS(-594,26,2488) --notification indicator
+local sand_indicator = POS(-572,26,2515) --sand indicator
local print_notification = true
+
+local sections = {
+ clay_factory = "327479",
+ departures = "484515"
+}
+
local function send_train()
- 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")
+ if F.indicator(S.yards[notification_id].active_indicator_pos) then -- another train already in the yard. wait for it to exit first
+ print("yard still active")
+ schedule_in("0;2","send_train")
+ return
+ end
+ print("Sending Train")
+ local base_rc = {
+ "FREIGHT",
+ "CAN_LOCOSTORE",
+ "EWL-W",
+ "EWL",
+ "S23",
+ "ARC_AUTO",
+ "ARC_COLLECT_CANNERY",
+ "ARC_AUTO_S23N",
+ "CANNERY",
+ "CAN_COLLECT_DEPARTURES"
+ }
+ if section_occupancy(sections.clay_factory)[1] and F.indicator(sand_indicator) then
+ -- step the dirt wagons forward into sand wagons
+ print("Reshuffling sand export before departure")
+ base_rc[#base_rc+1] = "CAN_INTRA_SHUFFLE"
+ base_rc[#base_rc+1] = "CAN_HS_W"
+ base_rc[#base_rc+1] = "CAN_HS_W_AC"
+ base_rc[#base_rc+1] = "CAN_CLASS_DIRT_UNLOAD"
+ F.indicator(S.yards.CAN.active_indicator_pos, true) --activate the yard to prevent other trains entering while we're moving around
+ elseif section_occupancy(sections.departures)[1] then --collect departures wagons before departing proper
+ base_rc[#base_rc+1] = "CAN_REENTER_YARD"
+ print("Collecting Departures")
+ else
+ base_rc[#base_rc+1] = "CAN_LIGHT_EXIT"
+ end
+ print("rc list set")
+ set_rc(table.concat(base_rc," "))
+ print("rc set")
atc_send("S0WRD2A1S4")
F.indicator(ind,false)
-end
-
-local function shuffle_wagons()
- F.indicator(S.yards[notification_id].active_indicator_pos, true) --stop other trains entering the yard
- F.indicator(S.yards[notification_id].dir_indicator_pos,true)
- F.indicator(shuffle_ind,false)
- F.indicator(ind,true)
- S.yards[notification_id].shuffle_stage = 1 -- set a shuffle stage counter
- set_rc("CAN_LOCOSTORE CAN_SHUFFLE")
- atc_send("S0WRD2A1S4") --send train to headshunt
- return
+ print("train sent")
end
if event.ext_int then
@@ -30,44 +61,27 @@ if event.ext_int then
F.indicator(ind,true)
return
end
- elseif event.message == "shuffle" then
- if atc_id then
- if not F.indicator(S.yards[notification_id].active_indicator_pos) then
- shuffle_wagons()
- return
- end
- schedule_in(":05","shuffle")
- return
- else
- F.indicator(shuffle_ind,true)
- return
- end
+ return
end
return
end
if event.schedule then
- if event.message=="shuffle" then
- if not F.idicator(S.yards[notification_id].active_indicator_pos) then
- shuffle_wagons()
- return
- end
- schedule_in(":05","shuffle")
+ if event.msg=="send_train" then
+ send_train()
return
end
return
end
if event.train then
- unset_autocouple()
- if F.indicator(shuffle_ind) then
- shuffle_wagons()
- return
- end
+ print("Train arrived")
if F.indicator(ind) then
+ print("indicator on. Sending Train")
send_train()
return
end
+ print("train movements completed")
atc_send("B0")
return
end \ No newline at end of file
diff --git a/auto_yards/nodes/(-633,26,2456).lua b/auto_yards/nodes/(-633,26,2456).lua
deleted file mode 100644
index 8dc117b..0000000
--- a/auto_yards/nodes/(-633,26,2456).lua
+++ /dev/null
@@ -1,4 +0,0 @@
-if event.punch then
- F.indicator(S.yards.CAN.active_indicator_pos,false)
- interrupt_pos(POS(-630,26,2454),"shuffle")
-end \ No newline at end of file
diff --git a/auto_yards/nodes/(-643,26,2475).lua b/auto_yards/nodes/(-643,26,2475).lua
index 086074b..cd822d6 100644
--- a/auto_yards/nodes/(-643,26,2475).lua
+++ b/auto_yards/nodes/(-643,26,2475).lua
@@ -1,37 +1,50 @@
--- 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
+--Cannery Yard Headshunt
+local yard_id = "CAN"
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(yard_id.."_LIGHT_EXIT") then return end
+ if F.has_rc(yard_id.."_NOSHUNT") then return end
+ if F.has_rc("CAN_HS_W") then
+ if not atc_arrow then
+ atc_send("B3")
+ schedule_in("0;01", atc_id)
+ return
end
- return
- end
-
- if not F.has_rc(rev_rc) then --not our train. disregard
atc_set_ars_disable(false)
+ F.remove_rc("CAN_HS_W")
+ if F.has_rc("CAN_HS_W_AC") then
+ F.remove_rc("CAN_HS_W_AC")
+ atc_send("S3CplS0D2S3")
+ return
+ end
return
end
- if rm_rc then F.remove_rc({rev_rc}) end
- schedule_in(";01",atc_id)
- return
+ if train_length() == 1 then -- eliminates near half the trains
+ if F.has_rc(yard_id.."_LOCOSTORE") then -- specifies only the relevant train
+ if F.has_rc(yard_id.."_DEPART") and F.has_rc(yard_id.."_FINAL_COLLECT") and F.has_rc(yard_id.."_HEADSHUNT") then --only activate if train is set to depart anyway
+ if not atc_arrow then -- train is pointing towards exit. let it pass and the reverse it
+ atc_set_ars_disable(true)
+ schedule_in(";01",atc_id) -- prepare to reverse the train
+ return
+ else --train has reversed. send it to the siding and deactivate the yard
+ F.remove_rc({yard_id.."_DEPART",yard_id.."_FINAL_COLLECT"})
+ F.add_rc(yard_id.."_send_to_locostore")
+ atc_set_ars_disable(false)
+ F.indicator(S.yards[yard_id].active_indicator_pos, false)
+ S.yards[yard_id].departure_time = rwt.now()
+ S.yards[yard_id].departure_length = S.yards[yard_id].arrival_length
+
+ if S.yards[yard_id].notify_pos then
+ interrupt_pos(S.yards[yard_id].notify_pos,"notify")
+ end
+ return
+ end
+ end
+ end
+ end
end
-if event.schedule then
+if event.schedule then --this is a duplicate of the reversing schedule in the env anyway
if not atc_id then --bounce the train that just passed
atc_send_to_train(event.msg,"B0WRD1A1S3")
else
@@ -40,6 +53,13 @@ if event.schedule then
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
-end \ No newline at end of file
+ return
+end
+
+
+
+-- if all else fails, do a normal headshunt_yard function
+F.headshunt_yard(yard_id,true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-668,20,2478).lua b/auto_yards/nodes/(-668,20,2478).lua
index 7c582c0..beb2639 100644
--- a/auto_yards/nodes/(-668,20,2478).lua
+++ b/auto_yards/nodes/(-668,20,2478).lua
@@ -1,3 +1,3 @@
-- arrival
-if not F.has_rc("CANNERY") then return end
-F.yard_arrival("CAN",false) \ No newline at end of file
+if not F.has_rc("CANNERY") and not atc_arrow then return end
+F.yard_arrival("CAN", false, true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-719,20,2475).lua b/auto_yards/nodes/(-719,20,2475).lua
index acfc06a..350ff88 100644
--- a/auto_yards/nodes/(-719,20,2475).lua
+++ b/auto_yards/nodes/(-719,20,2475).lua
@@ -1,6 +1,6 @@
local yard_id = "CAN"
if event.train then
- if F.has_rc(yard_id.."_LIGHT_EXIT") then
+ if F.has_rc(yard_id.."_LIGHT_EXIT") or F.has_rc(yard_id.."_REENTER_YARD") then
F.remove_rc(yard_id.."_LIGHT_EXIT")
atc_set_ars_disable(false)
atc_send("SM")
diff --git a/auto_yards/nodes/(417,17,4).lua b/auto_yards/nodes/(417,17,4).lua
index b634cde..b72d4eb 100644
--- a/auto_yards/nodes/(417,17,4).lua
+++ b/auto_yards/nodes/(417,17,4).lua
@@ -25,7 +25,7 @@ if event.channel=="clock" then
txt[#txt+1] = "Active: " .. tostring(F.indicator(info.active_indicator_pos))
txt[#txt+1] = "Direction: " .. tostring(F.indicator(info.dir_indicator_pos))
- txt[#txt+1] = "Last Train: " .. tostring(info.last_id).." ("..tostring(info.arrival_length).."-"..tostring(info.departure_length)..")"
+ txt[#txt+1] = "Last Train: " .. tostring(S.known_trains[info.last_id] or info.last_id).." ("..tostring(info.arrival_length).."-"..tostring(info.departure_length)..")"
txt2[#txt2+1] = "Time: "..tostring(rwt.to_string(info.arrival_time)).."+"..tostring(rwt.to_string(rwt.diff(info.arrival_time,info.departure_time)))
digiline_send(yard_id.."_1",table.concat(txt,"\n"))
diff --git a/durt/nodes/(-1373,10,-2507).lua b/durt/nodes/(-1373,10,-2507).lua
index b811ea0..b48996c 100644
--- a/durt/nodes/(-1373,10,-2507).lua
+++ b/durt/nodes/(-1373,10,-2507).lua
@@ -1,7 +1,8 @@
if atc_arrow and F.has_rc("S27_EXP_EXIT_N") then
F.remove_rc({
"S27_EXP_EXIT_N",
- "S27_EXPORT_FINAL"
+ "S27_EXPORT_FINAL",
+ "S27_EXPORT_ACTIVE"
})
step_fc()
atc_send("D10SM")
diff --git a/durt/nodes/(-1419,11,-2545).lua b/durt/nodes/(-1419,11,-2545).lua
index 7926f0b..36c4310 100644
--- a/durt/nodes/(-1419,11,-2545).lua
+++ b/durt/nodes/(-1419,11,-2545).lua
@@ -6,11 +6,12 @@ if not atc_arrow then -- loco has rejoined from headshunt
return
end
-local fc = split_at_fc("A0B0",1) or "DEPART" --should be either SAND_RAMP or DIRT_LOAD. anything else goes to departures
+local fc = split_at_fc("A0B0",2) or "DEPART" --should be either SAND_RAMP or DIRT_LOAD. anything else goes to departures
F.add_rc({
"S27_EXP_HS_N",
"S27_EXP_DIR_"..fc
})
if fc == "DEPART" then
F.add_rc("S27_EXP_HS_N_AC")
-end \ No newline at end of file
+end
+atc_send("S3") \ No newline at end of file
diff --git a/durt/nodes/(-1426,11,-2548).lua b/durt/nodes/(-1426,11,-2548).lua
index a8de413..127133d 100644
--- a/durt/nodes/(-1426,11,-2548).lua
+++ b/durt/nodes/(-1426,11,-2548).lua
@@ -6,7 +6,7 @@ if not atc_arrow then
end
if not F.has_rc("S27_EXPORT_FINAL") then --still more train to shuffle
- split_off_locomotive("A0B0",1)
+ split_off_locomotive("A0B0",2)
F.add_rc({
"S27_EXP_HS_N",
"S27_EXP_HS_N_AC",
diff --git a/durt/nodes/(-1439,11,-2551).lua b/durt/nodes/(-1439,11,-2551).lua
index fd68288..14b91b4 100644
--- a/durt/nodes/(-1439,11,-2551).lua
+++ b/durt/nodes/(-1439,11,-2551).lua
@@ -2,7 +2,8 @@
if not F.has_rc("S27_SHUNTER") or not F.has_rc("S27_EXPORT_ACTIVE") then return end
if atc_arrow then
F.remove_rc_match("S27_EXP_DIR_%S+")
- local fc = split_at_fc("A0B0",1) or "DEPART" --should be either DIRT_LOAD or DEPART. anything else goes to departures by default
+ step_fc()
+ local fc = split_at_fc("A0B0",2) or "DEPART" --should be either DIRT_LOAD or DEPART. anything else goes to departures by default
F.add_rc({
"S27_EXP_HS_N",
"S27_EXP_DIR_"..fc
@@ -11,4 +12,6 @@ if atc_arrow then
F.add_rc("S27_EXP_HS_N_AC")
end
atc_send("A1S3")
-end \ No newline at end of file
+ return
+end
+atc_send("S1") \ No newline at end of file
diff --git a/durt/nodes/(-1442,11,-2568).lua b/durt/nodes/(-1442,11,-2568).lua
index 8a09604..5346db1 100644
--- a/durt/nodes/(-1442,11,-2568).lua
+++ b/durt/nodes/(-1442,11,-2568).lua
@@ -15,9 +15,11 @@ if not F.has_rc("S27_EXPORT_ACTIVE") then --train has just arrived. run around
"S27_EXPORT_ACTIVE",
"S27_EXP_HS_S",
"S27_EXP_AROUND",
+ "S27_EXP_HS_N",
+ "S27_EXP_HS_N_AC",
"S27_EXP_DIR_ARRIVALS"
})
return
end
-F.remove("S27_EXP_AROUND")
+F.remove_rc("S27_EXP_AROUND")
atc_send("S0WD3RS1") --bounce the train \ No newline at end of file
diff --git a/durt/nodes/(-1444,11,-2546).lua b/durt/nodes/(-1444,11,-2546).lua
index e0bf68f..aeef76b 100644
--- a/durt/nodes/(-1444,11,-2546).lua
+++ b/durt/nodes/(-1444,11,-2546).lua
@@ -3,15 +3,21 @@ local function send_train()
local rc = {
"FREIGHT",
"S27_SHUNTER",
+ "S27_EXP_EXIT_N",
"S27_EXP",
+ "S23",
"ARC_AUTO",
- "ARC_COLLECT_S27_EXPORT"
+ "ARC_COLLECT_S27_EXPORT",
+ "ARC_AUTO_S23S",
+ "MGGR"
}
set_rc(table.concat(rc," "))
atc_send("S0WRD2A1S4")
+ print(rwt.to_string(rwt.now()).." S27_EXPORT Send Train")
F.indicator(ind,false)
end
if event.ext_int then
+ print(rwt.to_string(rwt.now()).." S27_EXPORT RX Notification")
if F.indicator(ind) then return end
if atc_id then
send_train()
diff --git a/durt/nodes/(-1444,11,-2556).lua b/durt/nodes/(-1444,11,-2556).lua
index fd68288..14b91b4 100644
--- a/durt/nodes/(-1444,11,-2556).lua
+++ b/durt/nodes/(-1444,11,-2556).lua
@@ -2,7 +2,8 @@
if not F.has_rc("S27_SHUNTER") or not F.has_rc("S27_EXPORT_ACTIVE") then return end
if atc_arrow then
F.remove_rc_match("S27_EXP_DIR_%S+")
- local fc = split_at_fc("A0B0",1) or "DEPART" --should be either DIRT_LOAD or DEPART. anything else goes to departures by default
+ step_fc()
+ local fc = split_at_fc("A0B0",2) or "DEPART" --should be either DIRT_LOAD or DEPART. anything else goes to departures by default
F.add_rc({
"S27_EXP_HS_N",
"S27_EXP_DIR_"..fc
@@ -11,4 +12,6 @@ if atc_arrow then
F.add_rc("S27_EXP_HS_N_AC")
end
atc_send("A1S3")
-end \ No newline at end of file
+ return
+end
+atc_send("S1") \ No newline at end of file
diff --git a/durt/nodes/(-572,27,2515).lua b/durt/nodes/(-572,27,2515).lua
new file mode 100644
index 0000000..0f76f28
--- /dev/null
+++ b/durt/nodes/(-572,27,2515).lua
@@ -0,0 +1 @@
+interrupt_pos(POS(-630,26,2454), "notify") \ No newline at end of file
diff --git a/durt/nodes/(-743,18,2424).lua b/durt/nodes/(-743,18,2424).lua
new file mode 100644
index 0000000..d922a42
--- /dev/null
+++ b/durt/nodes/(-743,18,2424).lua
@@ -0,0 +1,45 @@
+-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt
+local rev_rc = "CAN_REENTER_YARD"
+local rm_rc = true
+-- local autocouple = "ARC_LOAD_HS_N_AC"
+-- local rm_cpl_rc = true
+
+__approach_callback_mode = 1
+
+if event.approach and not event.has_entered then
+ if not F.has_rc("CAN_REENTER_YARD") 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
+ 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