summaryrefslogtreecommitdiff
path: root/durt/nodes/(-1403,11,-2533).lua
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-11-01 00:00:01 +0100
committerautocommitter <autocommitter@linux-forks.de>2024-11-01 00:00:01 +0100
commit2d065ce9bedc6c7c0740a9148e96463749f8bf24 (patch)
treeb341c4c48a9132d6c31d0564fa4ba478aaf78e15 /durt/nodes/(-1403,11,-2533).lua
parentc019cfb8391dae72a1480e6d8ae8f06ff3d702ee (diff)
downloadluaatc_envs-2d065ce9bedc6c7c0740a9148e96463749f8bf24.tar.gz
luaatc_envs-2d065ce9bedc6c7c0740a9148e96463749f8bf24.tar.bz2
luaatc_envs-2d065ce9bedc6c7c0740a9148e96463749f8bf24.zip
State at 2024-11-01
Diffstat (limited to 'durt/nodes/(-1403,11,-2533).lua')
-rw-r--r--durt/nodes/(-1403,11,-2533).lua51
1 files changed, 20 insertions, 31 deletions
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