summaryrefslogtreecommitdiff
path: root/durt/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'durt/nodes')
-rw-r--r--durt/nodes/(-1373,10,-2507).lua8
-rw-r--r--durt/nodes/(-1403,11,-2533).lua51
-rw-r--r--durt/nodes/(-1419,11,-2545).lua24
-rw-r--r--durt/nodes/(-1426,11,-2548).lua21
-rw-r--r--durt/nodes/(-1439,11,-2551).lua14
-rw-r--r--durt/nodes/(-1442,11,-2568).lua44
-rw-r--r--durt/nodes/(-1444,11,-2546).lua9
-rw-r--r--durt/nodes/(-1444,11,-2556).lua14
-rw-r--r--durt/nodes/(-1446,11,-2568).lua3
-rw-r--r--durt/nodes/(-1468,11,-2561).lua2
-rw-r--r--durt/nodes/(-1468,15,-2551).lua0
-rw-r--r--durt/nodes/(-1515,7,-2621).lua2
12 files changed, 123 insertions, 69 deletions
diff --git a/durt/nodes/(-1373,10,-2507).lua b/durt/nodes/(-1373,10,-2507).lua
index 450ca4a..b811ea0 100644
--- a/durt/nodes/(-1373,10,-2507).lua
+++ b/durt/nodes/(-1373,10,-2507).lua
@@ -1,5 +1,9 @@
-if atc_arrow and F.has_rc("S27_EXP_EXIT") then
- F.remove_rc("S27_EXP_EXIT")
+if atc_arrow and F.has_rc("S27_EXP_EXIT_N") then
+ F.remove_rc({
+ "S27_EXP_EXIT_N",
+ "S27_EXPORT_FINAL"
+ })
+ step_fc()
atc_send("D10SM")
return
end \ No newline at end of file
diff --git a/durt/nodes/(-1403,11,-2533).lua b/durt/nodes/(-1403,11,-2533).lua
index 898b856..e6f76db 100644
--- a/durt/nodes/(-1403,11,-2533).lua
+++ b/durt/nodes/(-1403,11,-2533).lua
@@ -1,6 +1,8 @@
-local rev_rc = "S27_REV_East"
-local rm_rc = false
-
+-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt
+local rev_rc = "S27_EXP_HS_N"
+local rm_rc = true
+local autocouple = "S27_EXP_HS_N_AC"
+local rm_cpl_rc = true
__approach_callback_mode = 1
@@ -10,38 +12,25 @@ if event.approach and not event.has_entered then
return
end
-if event.train and atc_arrow then
- if not F.has_rc(rev_rc) then
- atc_set_ars_disable(false)
+if event.train then
+ if not atc_arrow then --train has bounced
+ if F.has_rc("S27_EXPORT_ACTIVE") and not F.has_rc("S27_EXPORT_FINAL") then
+ if not section_occupancy("254098")[1] then --no more train to shuffle
+ F.add_rc("S27_EXPORT_FINAL")
+ end
+ end
+ if F.has_rc(autocouple) then
+ atc_send("CplS0WD2S1")
+ if rm_cpl_rc then F.remove_rc({autocouple}) end
+ end
return
end
- if rm_rc then F.remove_rc({rev_rc}) end
- if F.has_rc("S27_SHUNTER") then
- local stages = {
- "S27_EXP_PICKUP",
- "S27_EXP_LOAD",
- "S27_EXP_DEPART"
- }
-
- for i,v in ipairs(stages) do
- if F.has_rc(v) then
- unset_autocouple()
- F.remove_rc(v)
- local next_stage = stages[i == #stages and 1 or i+1]
- if next_stage == "S27_EXP_PICKUP" and not section_occupancy("254098")[1] then -- no wagons left to load. store loco
- F.add_rc("S27_LOCOSTORE")
- break
- end
- if next_stage ~= "S27_EXP_DEPART" then
- set_autocouple()
- end
- F.add_rc(next_stage)
-
- break
- end
- end
+ if not F.has_rc(rev_rc) then --not our train. disregard
+ atc_set_ars_disable(false)
+ return
end
+ if rm_rc then F.remove_rc({rev_rc}) end
schedule_in(";01",atc_id)
return
end
diff --git a/durt/nodes/(-1419,11,-2545).lua b/durt/nodes/(-1419,11,-2545).lua
index c17e7b9..7926f0b 100644
--- a/durt/nodes/(-1419,11,-2545).lua
+++ b/durt/nodes/(-1419,11,-2545).lua
@@ -1,12 +1,16 @@
-- S27 Export Arrivals Splitter
-if event.train and atc_arrow then
- if not F.has_rc("S27_EXPORT_ACTIVE") then return end
- local fc = split_at_fc("A0B0",1) or "DEPART"
- F.add_rc({
- "S27_EXP_HS_N",
- "S27_"..fc
- })
- if fc == "DEPART" then
- F.add_rc("S27_EXP_HS_N_AC")
- end
+if not F.has_rc("S27_EXPORT_ACTIVE") then return end
+
+if not atc_arrow then -- loco has rejoined from headshunt
+ F.remove_rc_match("S27_EXP_DIR_%S+")
+ return
+end
+
+local fc = split_at_fc("A0B0",1) 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
diff --git a/durt/nodes/(-1426,11,-2548).lua b/durt/nodes/(-1426,11,-2548).lua
index e69de29..a8de413 100644
--- a/durt/nodes/(-1426,11,-2548).lua
+++ b/durt/nodes/(-1426,11,-2548).lua
@@ -0,0 +1,21 @@
+-- S27 Export Departures splitter
+if not F.has_rc("S27_SHUNTER") or not F.has_rc("S27_EXPORT_ACTIVE") then return end
+if not atc_arrow then
+ F.remove_rc_match("S27_EXP_DIR_%S+")
+ return
+end
+
+if not F.has_rc("S27_EXPORT_FINAL") then --still more train to shuffle
+ split_off_locomotive("A0B0",1)
+ F.add_rc({
+ "S27_EXP_HS_N",
+ "S27_EXP_HS_N_AC",
+ "S27_EXP_DIR_ARRIVALS",
+ })
+ return
+end
+
+F.add_rc({
+ "S27_EXP_EXIT_N"
+})
+atc_send("S3")
diff --git a/durt/nodes/(-1439,11,-2551).lua b/durt/nodes/(-1439,11,-2551).lua
new file mode 100644
index 0000000..fd68288
--- /dev/null
+++ b/durt/nodes/(-1439,11,-2551).lua
@@ -0,0 +1,14 @@
+-- S27 Load/Unload Ramp
+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
+ F.add_rc({
+ "S27_EXP_HS_N",
+ "S27_EXP_DIR_"..fc
+ })
+ if fc == "DEPART" then
+ F.add_rc("S27_EXP_HS_N_AC")
+ end
+ atc_send("A1S3")
+end \ No newline at end of file
diff --git a/durt/nodes/(-1442,11,-2568).lua b/durt/nodes/(-1442,11,-2568).lua
index 6b7502e..8a09604 100644
--- a/durt/nodes/(-1442,11,-2568).lua
+++ b/durt/nodes/(-1442,11,-2568).lua
@@ -1,25 +1,23 @@
--S27 Export Arrivals
-if event.train and atc_arrow then
- if not F.has_rc("S27_SHUNTER") then return end
- if train_length() == 1 then
- F.add_rc({
- "S27_LOCOSTORE",
- "S27_EXP_HS_N",
- "S27_EXP_AROUND",
- "S27_EXP_HS_S"
- })
- atc_send("S0WD3RS3")
- return
- end
- if not F.has_rc("S27_EXPORT_ACTIVE") then
- split_off_locomotive("A0B0",1)
- F.add_rc({
- "S27_EXPORT_ACTIVE",
- "S27_EXP_HS_S",
- "S27_EXP_AROUND",
- })
- return
- end
- atc_send("S0WD3RS1")
+if not atc_arrow then return end
+if not F.has_rc("S27_SHUNTER") then return end
+if train_length() == 1 then --return loco to storage via N headshunt (backwards)
+ F.add_rc({
+ "S27_EXP_LOCOSTORE",
+ "S27_EXP_HS_N",
+ })
+ atc_send("S0WD3RS3")
return
-end \ No newline at end of file
+end
+if not F.has_rc("S27_EXPORT_ACTIVE") then --train has just arrived. run around
+ split_off_locomotive("A0B0",1)
+ F.add_rc({
+ "S27_EXPORT_ACTIVE",
+ "S27_EXP_HS_S",
+ "S27_EXP_AROUND",
+ "S27_EXP_DIR_ARRIVALS"
+ })
+ return
+end
+F.remove("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 235e7d3..e0bf68f 100644
--- a/durt/nodes/(-1444,11,-2546).lua
+++ b/durt/nodes/(-1444,11,-2546).lua
@@ -1,6 +1,13 @@
local ind = POS(-1444,10,-2546)
local function send_train()
- set_rc("S27_SHUNTER S27_REV_East S27")
+ local rc = {
+ "FREIGHT",
+ "S27_SHUNTER",
+ "S27_EXP",
+ "ARC_AUTO",
+ "ARC_COLLECT_S27_EXPORT"
+ }
+ set_rc(table.concat(rc," "))
atc_send("S0WRD2A1S4")
F.indicator(ind,false)
end
diff --git a/durt/nodes/(-1444,11,-2556).lua b/durt/nodes/(-1444,11,-2556).lua
new file mode 100644
index 0000000..fd68288
--- /dev/null
+++ b/durt/nodes/(-1444,11,-2556).lua
@@ -0,0 +1,14 @@
+-- S27 Load/Unload Ramp
+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
+ F.add_rc({
+ "S27_EXP_HS_N",
+ "S27_EXP_DIR_"..fc
+ })
+ if fc == "DEPART" then
+ F.add_rc("S27_EXP_HS_N_AC")
+ end
+ atc_send("A1S3")
+end \ No newline at end of file
diff --git a/durt/nodes/(-1446,11,-2568).lua b/durt/nodes/(-1446,11,-2568).lua
index e69de29..6db85e3 100644
--- a/durt/nodes/(-1446,11,-2568).lua
+++ b/durt/nodes/(-1446,11,-2568).lua
@@ -0,0 +1,3 @@
+-- S27 Export Departures Bouncer
+if not F.has_rc("S27_SHUNTER") or not F.has_rc("S27_EXPORT_ACTIVE") then return end
+if atc_arrow then atc_send("A0B0WRD2S2A1") return end \ No newline at end of file
diff --git a/durt/nodes/(-1468,11,-2561).lua b/durt/nodes/(-1468,11,-2561).lua
index df410b9..04e5a88 100644
--- a/durt/nodes/(-1468,11,-2561).lua
+++ b/durt/nodes/(-1468,11,-2561).lua
@@ -1,5 +1,5 @@
if event.train and atc_arrow then
F.remove_rc({"S27_slag_shed"})
- F.add_rc({"S27_main_yard"})
+ F.add_rc({"S27_main_yard", "S27_EXP_HS_N"})
atc_send("A0S0WRD50S3A1")
end
diff --git a/durt/nodes/(-1468,15,-2551).lua b/durt/nodes/(-1468,15,-2551).lua
deleted file mode 100644
index e69de29..0000000
--- a/durt/nodes/(-1468,15,-2551).lua
+++ /dev/null
diff --git a/durt/nodes/(-1515,7,-2621).lua b/durt/nodes/(-1515,7,-2621).lua
index 0abb68d..5af9c6c 100644
--- a/durt/nodes/(-1515,7,-2621).lua
+++ b/durt/nodes/(-1515,7,-2621).lua
@@ -1,5 +1,5 @@
if event.train and atc_arrow then
F.remove_rc({"S27_main_yard"})
- F.add_rc({"S27_slag_shed"})
+ F.add_rc({"S27_slag_shed","S27_EXP_HS_N"})
atc_send("A0S0WRD100S3A1")
end