summaryrefslogtreecommitdiff
path: root/auto_yards/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'auto_yards/nodes')
-rw-r--r--auto_yards/nodes/(-1897,10,-921).lua16
-rw-r--r--auto_yards/nodes/(-1902,10,-893).lua1
-rw-r--r--auto_yards/nodes/(-1909,10,-930).lua1
-rw-r--r--auto_yards/nodes/(-1909,10,-957).lua1
-rw-r--r--auto_yards/nodes/(-1909,7,-1017).lua1
-rw-r--r--auto_yards/nodes/(-1910,16,837).lua1
-rw-r--r--auto_yards/nodes/(-1912,10,-928).lua1
-rw-r--r--auto_yards/nodes/(-1912,10,-957).lua1
-rw-r--r--auto_yards/nodes/(-1912,16,839).lua1
-rw-r--r--auto_yards/nodes/(-1912,7,-1017).lua1
-rw-r--r--auto_yards/nodes/(-1915,10,-957).lua1
-rw-r--r--auto_yards/nodes/(-1915,7,-1017).lua1
-rw-r--r--auto_yards/nodes/(-1918,10,-957).lua1
-rw-r--r--auto_yards/nodes/(-1918,7,-1017).lua1
-rw-r--r--auto_yards/nodes/(-1919,16,839).lua (renamed from auto_yards/nodes/(-1918,16,840).lua)0
-rw-r--r--auto_yards/nodes/(-1925,16,833).lua1
-rw-r--r--auto_yards/nodes/(-1928,16,834).lua1
-rw-r--r--auto_yards/nodes/(-1932,16,807).lua (renamed from auto_yards/nodes/(-1933,16,806).lua)0
-rw-r--r--auto_yards/nodes/(-1932,3,-1053).lua1
-rw-r--r--auto_yards/nodes/(-1933,16,833).lua1
-rw-r--r--auto_yards/nodes/(-1933,3,-1050).lua1
-rw-r--r--auto_yards/nodes/(-1936,16,834).lua1
-rw-r--r--auto_yards/nodes/(-1937,16,806).lua (renamed from auto_yards/nodes/(-1938,16,805).lua)0
-rw-r--r--auto_yards/nodes/(-1945,16,802).lua (renamed from auto_yards/nodes/(-1946,16,801).lua)0
-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/(-1953,16,798).lua (renamed from auto_yards/nodes/(-1954,16,797).lua)0
-rw-r--r--auto_yards/nodes/(-1959,16,811).lua1
-rw-r--r--auto_yards/nodes/(-1969,16,824).lua (renamed from auto_yards/nodes/(-1958,16,808).lua)0
-rw-r--r--auto_yards/nodes/(-1969,16,852).lua (renamed from auto_yards/nodes/(-1908,16,835).lua)0
-rw-r--r--auto_yards/nodes/(-1982,3,-1079).lua1
-rw-r--r--auto_yards/nodes/(-2004,2,-1101).lua1
-rw-r--r--auto_yards/nodes/(-2006,3,-1099).lua2
-rw-r--r--auto_yards/nodes/(-2029,19,733).lua27
-rw-r--r--auto_yards/nodes/(-2035,3,-1091).lua1
-rw-r--r--auto_yards/nodes/(-2042,19,723).lua8
-rw-r--r--auto_yards/nodes/(-4148,13,-5844).lua9
-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/(-586,26,2504).lua43
-rw-r--r--auto_yards/nodes/(-586,26,2534).lua3
-rw-r--r--auto_yards/nodes/(-588,26,2504).lua18
-rw-r--r--auto_yards/nodes/(-588,26,2534).lua1
-rw-r--r--auto_yards/nodes/(-590,26,2504).lua43
-rw-r--r--auto_yards/nodes/(-590,26,2534).lua3
-rw-r--r--auto_yards/nodes/(-630,26,2454).lua105
-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/(416,17,5).lua27
-rw-r--r--auto_yards/nodes/(417,17,4).lua2
-rw-r--r--auto_yards/nodes/(771,14,-16).lua55
-rw-r--r--auto_yards/nodes/(775,13,-20).lua1
-rw-r--r--auto_yards/nodes/(783,10,-57).lua2
-rw-r--r--auto_yards/nodes/(785,10,40).lua2
-rw-r--r--auto_yards/nodes/(789,10,-31).lua1
-rw-r--r--auto_yards/nodes/(789,10,13).lua1
-rw-r--r--auto_yards/nodes/(792,10,-31).lua1
-rw-r--r--auto_yards/nodes/(792,10,11).lua1
-rw-r--r--auto_yards/nodes/(794,10,31).lua46
-rw-r--r--auto_yards/nodes/(796,10,-39).lua1
-rw-r--r--auto_yards/nodes/(796,10,-54).lua46
-rw-r--r--auto_yards/nodes/(796,10,3).lua1
-rw-r--r--auto_yards/nodes/(799,10,-37).lua1
-rw-r--r--auto_yards/nodes/(799,10,3).lua1
66 files changed, 449 insertions, 147 deletions
diff --git a/auto_yards/nodes/(-1897,10,-921).lua b/auto_yards/nodes/(-1897,10,-921).lua
deleted file mode 100644
index 98955fa..0000000
--- a/auto_yards/nodes/(-1897,10,-921).lua
+++ /dev/null
@@ -1,16 +0,0 @@
-local function tprint (tbl, indent)
- if not indent then indent = 0 end
- for k, v in pairs(tbl) do
- formatting = string.rep("--", indent) .."[".. k .. "]: "
- if type(v) == "table" then
- print(formatting)
- tprint(v, indent+1)
- elseif type(v) == 'boolean' then
- print(formatting .. tostring(v))
- else
- print(formatting .. v)
- end
- end
-end
-
-if event.punch then tprint(S) end \ No newline at end of file
diff --git a/auto_yards/nodes/(-1902,10,-893).lua b/auto_yards/nodes/(-1902,10,-893).lua
deleted file mode 100644
index a878623..0000000
--- a/auto_yards/nodes/(-1902,10,-893).lua
+++ /dev/null
@@ -1 +0,0 @@
---EXIT \ No newline at end of file
diff --git a/auto_yards/nodes/(-1909,10,-930).lua b/auto_yards/nodes/(-1909,10,-930).lua
deleted file mode 100644
index 90ea19a..0000000
--- a/auto_yards/nodes/(-1909,10,-930).lua
+++ /dev/null
@@ -1 +0,0 @@
--- HEADSHUNT and EXIT \ No newline at end of file
diff --git a/auto_yards/nodes/(-1909,10,-957).lua b/auto_yards/nodes/(-1909,10,-957).lua
deleted file mode 100644
index 3774070..0000000
--- a/auto_yards/nodes/(-1909,10,-957).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.pickup("BY","N","0") \ No newline at end of file
diff --git a/auto_yards/nodes/(-1909,7,-1017).lua b/auto_yards/nodes/(-1909,7,-1017).lua
deleted file mode 100644
index b78dee7..0000000
--- a/auto_yards/nodes/(-1909,7,-1017).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.pickup("BY","S","0") \ No newline at end of file
diff --git a/auto_yards/nodes/(-1910,16,837).lua b/auto_yards/nodes/(-1910,16,837).lua
deleted file mode 100644
index 89349e3..0000000
--- a/auto_yards/nodes/(-1910,16,837).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.lane_EOL("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1912,10,-928).lua b/auto_yards/nodes/(-1912,10,-928).lua
deleted file mode 100644
index afbdcef..0000000
--- a/auto_yards/nodes/(-1912,10,-928).lua
+++ /dev/null
@@ -1 +0,0 @@
--- ENTRY and WAITING \ No newline at end of file
diff --git a/auto_yards/nodes/(-1912,10,-957).lua b/auto_yards/nodes/(-1912,10,-957).lua
deleted file mode 100644
index 68f24bb..0000000
--- a/auto_yards/nodes/(-1912,10,-957).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.EOL("BY","N","1") \ No newline at end of file
diff --git a/auto_yards/nodes/(-1912,16,839).lua b/auto_yards/nodes/(-1912,16,839).lua
deleted file mode 100644
index 89349e3..0000000
--- a/auto_yards/nodes/(-1912,16,839).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.lane_EOL("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1912,7,-1017).lua b/auto_yards/nodes/(-1912,7,-1017).lua
deleted file mode 100644
index 572ed50..0000000
--- a/auto_yards/nodes/(-1912,7,-1017).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.EOL("BY","S","1") \ No newline at end of file
diff --git a/auto_yards/nodes/(-1915,10,-957).lua b/auto_yards/nodes/(-1915,10,-957).lua
deleted file mode 100644
index 40a85b3..0000000
--- a/auto_yards/nodes/(-1915,10,-957).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.EOL("BY","N","2") \ No newline at end of file
diff --git a/auto_yards/nodes/(-1915,7,-1017).lua b/auto_yards/nodes/(-1915,7,-1017).lua
deleted file mode 100644
index 217f0f4..0000000
--- a/auto_yards/nodes/(-1915,7,-1017).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.EOL("BY","S","2") \ No newline at end of file
diff --git a/auto_yards/nodes/(-1918,10,-957).lua b/auto_yards/nodes/(-1918,10,-957).lua
deleted file mode 100644
index f4f335b..0000000
--- a/auto_yards/nodes/(-1918,10,-957).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.EOL("BY","N","3") \ No newline at end of file
diff --git a/auto_yards/nodes/(-1918,7,-1017).lua b/auto_yards/nodes/(-1918,7,-1017).lua
deleted file mode 100644
index 6c9c7d1..0000000
--- a/auto_yards/nodes/(-1918,7,-1017).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.EOL("BY","S","3") \ No newline at end of file
diff --git a/auto_yards/nodes/(-1918,16,840).lua b/auto_yards/nodes/(-1919,16,839).lua
index 2d94f29..2d94f29 100644
--- a/auto_yards/nodes/(-1918,16,840).lua
+++ b/auto_yards/nodes/(-1919,16,839).lua
diff --git a/auto_yards/nodes/(-1925,16,833).lua b/auto_yards/nodes/(-1925,16,833).lua
deleted file mode 100644
index 2d94f29..0000000
--- a/auto_yards/nodes/(-1925,16,833).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.classification("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1928,16,834).lua b/auto_yards/nodes/(-1928,16,834).lua
deleted file mode 100644
index 89349e3..0000000
--- a/auto_yards/nodes/(-1928,16,834).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.lane_EOL("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1933,16,806).lua b/auto_yards/nodes/(-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/(-1932,3,-1053).lua b/auto_yards/nodes/(-1932,3,-1053).lua
deleted file mode 100644
index 2970f21..0000000
--- a/auto_yards/nodes/(-1932,3,-1053).lua
+++ /dev/null
@@ -1 +0,0 @@
---HEADSHUNT and EXIT \ No newline at end of file
diff --git a/auto_yards/nodes/(-1933,16,833).lua b/auto_yards/nodes/(-1933,16,833).lua
deleted file mode 100644
index 89349e3..0000000
--- a/auto_yards/nodes/(-1933,16,833).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.lane_EOL("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1933,3,-1050).lua b/auto_yards/nodes/(-1933,3,-1050).lua
deleted file mode 100644
index afbdcef..0000000
--- a/auto_yards/nodes/(-1933,3,-1050).lua
+++ /dev/null
@@ -1 +0,0 @@
--- ENTRY and WAITING \ No newline at end of file
diff --git a/auto_yards/nodes/(-1936,16,834).lua b/auto_yards/nodes/(-1936,16,834).lua
deleted file mode 100644
index 89349e3..0000000
--- a/auto_yards/nodes/(-1936,16,834).lua
+++ /dev/null
@@ -1 +0,0 @@
-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/(-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/(-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..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 = {['ARC_LOAD'] = 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/(-1959,16,811).lua b/auto_yards/nodes/(-1959,16,811).lua
deleted file mode 100644
index 4503e25..0000000
--- a/auto_yards/nodes/(-1959,16,811).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.lane_EOL("ARC",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1958,16,808).lua b/auto_yards/nodes/(-1969,16,824).lua
index 4503e25..4503e25 100644
--- a/auto_yards/nodes/(-1958,16,808).lua
+++ b/auto_yards/nodes/(-1969,16,824).lua
diff --git a/auto_yards/nodes/(-1908,16,835).lua b/auto_yards/nodes/(-1969,16,852).lua
index 89349e3..89349e3 100644
--- a/auto_yards/nodes/(-1908,16,835).lua
+++ b/auto_yards/nodes/(-1969,16,852).lua
diff --git a/auto_yards/nodes/(-1982,3,-1079).lua b/auto_yards/nodes/(-1982,3,-1079).lua
deleted file mode 100644
index a878623..0000000
--- a/auto_yards/nodes/(-1982,3,-1079).lua
+++ /dev/null
@@ -1 +0,0 @@
---EXIT \ No newline at end of file
diff --git a/auto_yards/nodes/(-2004,2,-1101).lua b/auto_yards/nodes/(-2004,2,-1101).lua
index c0d57ae..031f395 100644
--- a/auto_yards/nodes/(-2004,2,-1101).lua
+++ b/auto_yards/nodes/(-2004,2,-1101).lua
@@ -10,6 +10,7 @@ local subs = {
]]--
['ARC'] = {['pos'] = POS(-1973,16,800), ['msg'] = "notify"},
+ ['NOID'] = {['pos'] = POS(-2204,8,-676), ['msg'] = "notify"},
}
if event.ext_int or event.punch then
diff --git a/auto_yards/nodes/(-2006,3,-1099).lua b/auto_yards/nodes/(-2006,3,-1099).lua
deleted file mode 100644
index d774476..0000000
--- a/auto_yards/nodes/(-2006,3,-1099).lua
+++ /dev/null
@@ -1,2 +0,0 @@
-if event.digiline then return end
-print("Notification Sent") \ 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 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/(-2035,3,-1091).lua b/auto_yards/nodes/(-2035,3,-1091).lua
deleted file mode 100644
index cbce1da..0000000
--- a/auto_yards/nodes/(-2035,3,-1091).lua
+++ /dev/null
@@ -1 +0,0 @@
-F.lane_EOL("BY",false) \ No newline at end of file
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/(-4148,13,-5844).lua b/auto_yards/nodes/(-4148,13,-5844).lua
index 06ab20e..18e89c5 100644
--- a/auto_yards/nodes/(-4148,13,-5844).lua
+++ b/auto_yards/nodes/(-4148,13,-5844).lua
@@ -1,4 +1,5 @@
-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt
+-- modified to bounce all trains, rc removal still works though
local rev_rc = "DLG_HS_S"
local rm_rc = true
local autocouple = "DLG_HS_S_AC"
@@ -22,10 +23,10 @@ if event.train then
return
end
- if not F.has_rc(rev_rc) 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
schedule_in(";01",atc_id)
return
diff --git a/auto_yards/nodes/(-524,26,2481).lua b/auto_yards/nodes/(-524,26,2481).lua
index 74a7624..fb7f7a6 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("S0WD2A0RS2") 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/(-586,26,2504).lua b/auto_yards/nodes/(-586,26,2504).lua
new file mode 100644
index 0000000..e5831fc
--- /dev/null
+++ b/auto_yards/nodes/(-586,26,2504).lua
@@ -0,0 +1,43 @@
+-- Cannery Dirt Loading Lane Modified
+local ind = POS(-594,26,2488) --notification indicator
+local sand_indicator = POS(-572,26,2515) --sand indicator
+
+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, move wagons to sand loading
+ F.remove_rc("CAN_CLASS_DIRT_UNLOAD")
+ F.add_rc({
+ "CAN_HS_W",
+ "CAN_CLASS_SAND_LOAD",
+ "CAN_FROM_DIRT"
+ })
+ step_fc()
+ return
+ end
+ if F.has_rc("CAN_FROM_DIRT") then --leave wagons and return to locostore, shutting down the yard as we go
+ F.remove_rc({
+ "CAN_CLASS_SAND_LOAD",
+ "CAN_FROM_DIRT"
+ })
+ split_off_locomotive("A0B0")
+ F.add_rc({
+ "CAN_HS_W",
+ "CAN_send_to_locostore"
+ })
+ F.indicator(sand_indicator, false) --ensure the sand indicator is off to allow the wagons to load
+ 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
+ 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"
+ })
+ F.indicator(sand_indicator, false) -- Loaded wagons have been sent to departures track. Disable the request indicator
+ return
+ end
+ return
+end
+F.lane_EOL("CAN",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-586,26,2534).lua b/auto_yards/nodes/(-586,26,2534).lua
new file mode 100644
index 0000000..d783815
--- /dev/null
+++ b/auto_yards/nodes/(-586,26,2534).lua
@@ -0,0 +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/(-588,26,2504).lua b/auto_yards/nodes/(-588,26,2504).lua
index 46e3050..8b1f38e 100644
--- a/auto_yards/nodes/(-588,26,2504).lua
+++ b/auto_yards/nodes/(-588,26,2504).lua
@@ -1,2 +1,18 @@
--- EOL
+-- Cannery Dirt Loading Lane Modified
+local ind = POS(-594,26,2488) --notification indicator
+local clay_indicator = POS(-570,26,2515) --clay loaded indicator
+
+if F.has_rc("CAN_INTRA_SHUFFLE") then
+ if not atc_arrow then return end
+ if F.has_rc("CAN_CLASS_CLAY_LOAD") then -- remove wagons, step the fc, move wagons to departures
+ F.remove_rc("CAN_CLASS_CLAY_LOAD")
+ F.add_rc({
+ "CAN_HS_W", --departures track has Cpl function built in
+ "CAN_CLASS_DEPARTURES"
+ })
+ F.indicator(clay_indicator, false) -- Loaded wagons have been sent to departures track. Disable the request indicator
+ return
+ end
+ return
+end
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/(-590,26,2504).lua b/auto_yards/nodes/(-590,26,2504).lua
new file mode 100644
index 0000000..7632bd2
--- /dev/null
+++ b/auto_yards/nodes/(-590,26,2504).lua
@@ -0,0 +1,43 @@
+-- Cannery Dirt Loading Lane Modified
+local ind = POS(-594,26,2488) --notification indicator
+local sand_indicator = POS(-572,26,2515) --sand indicator
+
+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, move wagons to sand loading
+ F.remove_rc("CAN_CLASS_DIRT_UNLOAD")
+ F.add_rc({
+ "CAN_HS_W",
+ "CAN_CLASS_SAND_LOAD",
+ "CAN_FROM_DIRT"
+ })
+ step_fc()
+ return
+ end
+ if F.has_rc("CAN_FROM_DIRT") then --leave wagons and return to locostore, shutting down the yard as we go
+ F.remove_rc({
+ "CAN_CLASS_SAND_LOAD",
+ "CAN_FROM_DIRT"
+ })
+ split_off_locomotive("A0B0")
+ F.add_rc({
+ "CAN_HS_W",
+ "CAN_send_to_locostore"
+ })
+ F.indicator(sand_indicator, false) --ensure the sand indicator is off to allow the wagons to load
+ 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
+ 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()
+ return
+ end
+ return
+end
+F.lane_EOL("CAN",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-590,26,2534).lua b/auto_yards/nodes/(-590,26,2534).lua
new file mode 100644
index 0000000..d783815
--- /dev/null
+++ b/auto_yards/nodes/(-590,26,2534).lua
@@ -0,0 +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..d968800 100644
--- a/auto_yards/nodes/(-630,26,2454).lua
+++ b/auto_yards/nodes/(-630,26,2454).lua
@@ -1,22 +1,70 @@
+-- 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 loaded indicator
+local clay_indicator = POS(-570,26,2515) --clay loaded indicator
local print_notification = true
+
+local sections = {
+ clay_loading = "769966",
+ sand_loading = "199126",
+ dirt_unloading = "541313",
+ 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_loading)[1] and F.indicator(clay_indicator) then -- move the loaded clay wagons to the departures track when requested
+ 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_CLAY_LOAD"
+ F.indicator(S.yards.CAN.active_indicator_pos, true) --activate the yard to prevent other trains entering while we're moving around
+ print("Collecting loaded clay wagons")
+ elseif section_occupancy(sections.sand_loading)[1] and F.indicator(sand_indicator) then -- move the loaded sand wagons to the departures track when requested
+ 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_SAND_LOAD"
+ F.indicator(S.yards.CAN.active_indicator_pos, true) --activate the yard to prevent other trains entering while we're moving around
+ print("Collecting loaded sand wagons")
+ elseif section_occupancy(sections.dirt_unloading)[1] and not section_occupancy(sections.sand_loading)[1] then -- move the unloaded dirt wagons to the sand track if there's room
+ 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
+ print("Respotting unloaded dirt wagons to sand loading area")
+ elseif section_occupancy(sections.departures)[1] then --collect departures wagons before departing proper
+ base_rc[#base_rc+1] = "CAN_REENTER_YARD"
+ F.indicator(ind, false)
+ 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 +78,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/(416,17,5).lua b/auto_yards/nodes/(416,17,5).lua
deleted file mode 100644
index e8c1b0e..0000000
--- a/auto_yards/nodes/(416,17,5).lua
+++ /dev/null
@@ -1,27 +0,0 @@
-local stack = function(t,channel,num_screens)
- for i=0,math.ceil(#t/4) do
- local calc = i*4
- local working_t = {t[calc+1],t[calc+2],t[calc+3],t[calc+4]}
- local message = table.concat(working_t,"\n")
- if i+1 > num_screens then return end
- digiline_send(channel..i+1,message)
- end
-end
-
-if event.channel=="clock" or event.punch then
- local txt = {"-- AUTOMATIC YARD STATUS --","Railway Time: "..rwt.to_string(rwt.now(),true),"LHF Trains: 719814"," ========================"}
- local s
- for yard_id,info in pairs(S.yards) do
- table.insert(txt, yard_id.." - Active: " .. tostring(F.indicator(info.active_indicator_pos)))
- table.insert(txt," Direction: " .. tostring(F.indicator(info.dir_indicator_pos)))
- table.insert(txt," Error: ".. tostring(F.indicator(info.error_indicator_pos)))
- if info.notify and info.notify[1] then
- table.insert(txt,"Notify: "..table.concat(info.notify,", "))
- else
- table.insert(txt,"Notify: N/A")
- end
- end
-
- stack(txt,"yard_status",4)
- return
-end \ No newline at end of file
diff --git a/auto_yards/nodes/(417,17,4).lua b/auto_yards/nodes/(417,17,4).lua
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/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