summaryrefslogtreecommitdiff
path: root/auto_yards
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-10-15 22:37:32 +0200
committerautocommitter <autocommitter@linux-forks.de>2024-10-15 22:37:32 +0200
commit5c7f77725394d47ce0b907aabf885ea207a507bd (patch)
treea1ff9c67ef8f225a259e4c6f4c163a45c58bb870 /auto_yards
parentb435d1b1b26db6f7c4f3eb589ecf1ed3bb79b57e (diff)
downloadluaatc_envs-5c7f77725394d47ce0b907aabf885ea207a507bd.tar.gz
luaatc_envs-5c7f77725394d47ce0b907aabf885ea207a507bd.tar.bz2
luaatc_envs-5c7f77725394d47ce0b907aabf885ea207a507bd.zip
State at 2024-10-15
Diffstat (limited to 'auto_yards')
-rw-r--r--auto_yards/nodes/(-1901,16,844).lua1
-rw-r--r--auto_yards/nodes/(-1901,16,850).lua1
-rw-r--r--auto_yards/nodes/(-1901,16,856).lua1
-rw-r--r--auto_yards/nodes/(-1901,16,862).lua1
-rw-r--r--auto_yards/nodes/(-1913,16,857).lua1
-rw-r--r--auto_yards/nodes/(-1918,16,840).lua1
-rw-r--r--auto_yards/nodes/(-1922,16,840).lua1
-rw-r--r--auto_yards/nodes/(-1938,16,805).lua1
-rw-r--r--auto_yards/nodes/(-1946,16,840).lua1
-rw-r--r--auto_yards/nodes/(-1947,16,837).lua2
-rw-r--r--auto_yards/nodes/(-1961,16,809).lua1
-rw-r--r--auto_yards/nodes/(-2004,3,-1099).lua2
-rw-r--r--auto_yards/nodes/(-2029,19,733).lua9
-rw-r--r--auto_yards/nodes/(-2038,20,730).lua1
-rw-r--r--auto_yards/nodes/(-4023,12,-2660).lua1
-rw-r--r--auto_yards/nodes/(-4148,13,-5844).lua45
-rw-r--r--auto_yards/nodes/(-524,26,2481).lua2
-rw-r--r--auto_yards/nodes/(-563,26,2472).lua2
-rw-r--r--auto_yards/nodes/(-584,26,2481).lua2
-rw-r--r--auto_yards/nodes/(-588,26,2504).lua2
-rw-r--r--auto_yards/nodes/(-588,26,2534).lua2
-rw-r--r--auto_yards/nodes/(-630,26,2454).lua2
-rw-r--r--auto_yards/nodes/(-643,26,2475).lua88
-rw-r--r--auto_yards/nodes/(-719,20,2475).lua10
-rw-r--r--auto_yards/nodes/(1178,16,3851).lua1
25 files changed, 115 insertions, 66 deletions
diff --git a/auto_yards/nodes/(-1901,16,844).lua b/auto_yards/nodes/(-1901,16,844).lua
new file mode 100644
index 0000000..89349e3
--- /dev/null
+++ b/auto_yards/nodes/(-1901,16,844).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1901,16,850).lua b/auto_yards/nodes/(-1901,16,850).lua
new file mode 100644
index 0000000..89349e3
--- /dev/null
+++ b/auto_yards/nodes/(-1901,16,850).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1901,16,856).lua b/auto_yards/nodes/(-1901,16,856).lua
new file mode 100644
index 0000000..89349e3
--- /dev/null
+++ b/auto_yards/nodes/(-1901,16,856).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1901,16,862).lua b/auto_yards/nodes/(-1901,16,862).lua
new file mode 100644
index 0000000..89349e3
--- /dev/null
+++ b/auto_yards/nodes/(-1901,16,862).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1913,16,857).lua b/auto_yards/nodes/(-1913,16,857).lua
new file mode 100644
index 0000000..89349e3
--- /dev/null
+++ b/auto_yards/nodes/(-1913,16,857).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1918,16,840).lua b/auto_yards/nodes/(-1918,16,840).lua
new file mode 100644
index 0000000..2d94f29
--- /dev/null
+++ b/auto_yards/nodes/(-1918,16,840).lua
@@ -0,0 +1 @@
+F.classification("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1922,16,840).lua b/auto_yards/nodes/(-1922,16,840).lua
new file mode 100644
index 0000000..89349e3
--- /dev/null
+++ b/auto_yards/nodes/(-1922,16,840).lua
@@ -0,0 +1 @@
+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/(-1938,16,805).lua
new file mode 100644
index 0000000..4503e25
--- /dev/null
+++ b/auto_yards/nodes/(-1938,16,805).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1946,16,840).lua b/auto_yards/nodes/(-1946,16,840).lua
index def9136..4dd7c28 100644
--- a/auto_yards/nodes/(-1946,16,840).lua
+++ b/auto_yards/nodes/(-1946,16,840).lua
@@ -11,6 +11,7 @@ local subs = {
['S27'] = {['pos'] = POS(-1515,7,-2625), ['msg'] = "notify"},
['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"},
}
diff --git a/auto_yards/nodes/(-1947,16,837).lua b/auto_yards/nodes/(-1947,16,837).lua
index f77e28c..7ddaaf6 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_SB'] = true, ['CANNERY'] = true}
+S.yards.ARC.notify = {['ARC_LOAD'] = true}
print(S.yards.ARC.notify) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1961,16,809).lua b/auto_yards/nodes/(-1961,16,809).lua
new file mode 100644
index 0000000..4503e25
--- /dev/null
+++ b/auto_yards/nodes/(-1961,16,809).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-2004,3,-1099).lua b/auto_yards/nodes/(-2004,3,-1099).lua
index 8f4b247..101a393 100644
--- a/auto_yards/nodes/(-2004,3,-1099).lua
+++ b/auto_yards/nodes/(-2004,3,-1099).lua
@@ -4,4 +4,4 @@ for k in pairs(S.yards.BY.notify) do
s = s ..k..", "
end
s = s.."--"
-digiline_send("notification_screen",s) \ No newline at end of file
+digiline_send("lcd",s) \ 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 2672033..f88c9f0 100644
--- a/auto_yards/nodes/(-2029,19,733).lua
+++ b/auto_yards/nodes/(-2029,19,733).lua
@@ -1,5 +1,14 @@
local yard_id = "ARC"
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
+ atc_send("S4D1A1")
+ return
+ end
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/(-2038,20,730).lua b/auto_yards/nodes/(-2038,20,730).lua
index a790746..cf774a3 100644
--- a/auto_yards/nodes/(-2038,20,730).lua
+++ b/auto_yards/nodes/(-2038,20,730).lua
@@ -3,4 +3,5 @@ if event.digiline and event.channel=="yard_ctl" and event.msg=="disable" then
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
+ print("ARC YARD Manually Disabled")
end \ No newline at end of file
diff --git a/auto_yards/nodes/(-4023,12,-2660).lua b/auto_yards/nodes/(-4023,12,-2660).lua
index 9d743b7..df83930 100644
--- a/auto_yards/nodes/(-4023,12,-2660).lua
+++ b/auto_yards/nodes/(-4023,12,-2660).lua
@@ -1,6 +1,7 @@
local yard_id = "TY"
local subs = {
-- ['MMF'] = {['pos'] = POS(1,2,3), ['msg'] = "notify"},
+ ['DLG'] = {['pos'] = POS(-4152,13,-5840), ['msg'] = "notify"},
}
if event.ext_int or event.punch then
diff --git a/auto_yards/nodes/(-4148,13,-5844).lua b/auto_yards/nodes/(-4148,13,-5844).lua
new file mode 100644
index 0000000..06ab20e
--- /dev/null
+++ b/auto_yards/nodes/(-4148,13,-5844).lua
@@ -0,0 +1,45 @@
+-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt
+local rev_rc = "DLG_HS_S"
+local rm_rc = true
+local autocouple = "DLG_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/auto_yards/nodes/(-524,26,2481).lua b/auto_yards/nodes/(-524,26,2481).lua
new file mode 100644
index 0000000..74a7624
--- /dev/null
+++ b/auto_yards/nodes/(-524,26,2481).lua
@@ -0,0 +1,2 @@
+-- EOL
+F.lane_EOL("CAN",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-563,26,2472).lua b/auto_yards/nodes/(-563,26,2472).lua
new file mode 100644
index 0000000..74a7624
--- /dev/null
+++ b/auto_yards/nodes/(-563,26,2472).lua
@@ -0,0 +1,2 @@
+-- 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
new file mode 100644
index 0000000..46e3050
--- /dev/null
+++ b/auto_yards/nodes/(-584,26,2481).lua
@@ -0,0 +1,2 @@
+-- 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
new file mode 100644
index 0000000..46e3050
--- /dev/null
+++ b/auto_yards/nodes/(-588,26,2504).lua
@@ -0,0 +1,2 @@
+-- EOL
+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
new file mode 100644
index 0000000..74a7624
--- /dev/null
+++ b/auto_yards/nodes/(-588,26,2534).lua
@@ -0,0 +1,2 @@
+-- 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 e01fb60..5715c34 100644
--- a/auto_yards/nodes/(-630,26,2454).lua
+++ b/auto_yards/nodes/(-630,26,2454).lua
@@ -3,7 +3,7 @@ local ind = POS(-594,26,2488)
local shuffle_ind = POS(-594,26,2487)
local print_notification = true
local function send_train()
- set_rc("FREIGHT CAN_LOCOSTORE CAN_LIGHT_EXIT EWL-W EWL S23 ARCAUTO ARC_RTS ARC_COLLECT_CANNERY ARC_AUTO_S23N CANNERY CAN_RTS CAN_COLLECT_ARC")
+ 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")
atc_send("S0WRD2A1S4")
F.indicator(ind,false)
end
diff --git a/auto_yards/nodes/(-643,26,2475).lua b/auto_yards/nodes/(-643,26,2475).lua
index 1523fcd..086074b 100644
--- a/auto_yards/nodes/(-643,26,2475).lua
+++ b/auto_yards/nodes/(-643,26,2475).lua
@@ -1,68 +1,37 @@
-local yard_id = "CAN"
+-- 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
+
if event.train then
- 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_SHUFFLE") then -- train is consolidating wagons for export to ARC
- if not atc_arrow then
- schedule_in(";01",atc_id) -- prepare to reverse the train
- return
- end
- print(F.get_rc_safe())
- F.remove_rc_match("CAN_CLASS_%S+")
- F.remove_rc_match("CAN_COLLECT_%S+")
- F.remove_rc("CAN_PICKUP CAN_HEADSHUNT CAN_FINAL_COLLECT")
- local stage_list = {
- "CAN_CLASS_ETHANOL CAN_COLLECT_ETHANOL CAN_FINAL_COLLECT",
- "CAN_CLASS_ARC",
- "CAN_CLASS_CORN CAN_COLLECT_CORN CAN_FINAL_COLLECT",
- "CAN_CLASS_ARC",
- "CAN_send_to_locostore"
- }
- F.add_rc(stage_list[S.yards[yard_id].shuffle_stage])
- print(F.get_rc_safe())
- print(S.yards[yard_id].shuffle_stage)
- set_autocouple()
- atc_set_ars_disable(false)
-
- if S.yards[yard_id].shuffle_stage == #stage_list then -- loco is returning to storage. release the yard
- F.indicator(S.yards[yard_id].active_indicator_pos,false)
- S.yards[yard_id].notify.ARC = true
- interrupt_pos(S.yards[yard_id].notify_pos)
- else
- S.yards[yard_id].shuffle_stage = S.yards[yard_id].shuffle_stage + 1
+ 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 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
+ 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 --this is a duplicate of the reversing schedule in the env anyway
+if event.schedule then
if not atc_id then --bounce the train that just passed
atc_send_to_train(event.msg,"B0WRD1A1S3")
else
@@ -71,13 +40,6 @@ if event.schedule then --this is a duplicate of the reversing schedule in the en
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
- return
-end
-
-
-
--- if all else fails, do a normal headshunt_yard function
-F.headshunt_yard(yard_id,true) \ No newline at end of file
+end \ No newline at end of file
diff --git a/auto_yards/nodes/(-719,20,2475).lua b/auto_yards/nodes/(-719,20,2475).lua
new file mode 100644
index 0000000..acfc06a
--- /dev/null
+++ b/auto_yards/nodes/(-719,20,2475).lua
@@ -0,0 +1,10 @@
+local yard_id = "CAN"
+if event.train then
+ if F.has_rc(yard_id.."_LIGHT_EXIT") then
+ F.remove_rc(yard_id.."_LIGHT_EXIT")
+ atc_set_ars_disable(false)
+ atc_send("SM")
+ return
+ end
+end
+F.headshunt_exit(yard_id,true) \ No newline at end of file
diff --git a/auto_yards/nodes/(1178,16,3851).lua b/auto_yards/nodes/(1178,16,3851).lua
index 6d126c4..bc78e81 100644
--- a/auto_yards/nodes/(1178,16,3851).lua
+++ b/auto_yards/nodes/(1178,16,3851).lua
@@ -1,6 +1,7 @@
local yard_id = "IP"
local subs = {
['WOA_mine_empty'] = {['pos'] = POS(1949,7,9112), ['msg'] = "notify"},
+ ['OAF_Logging'] = {['pos'] = POS(1843, 17, 4278), ['msg'] = "notify"},
}
if event.ext_int or event.punch then