summaryrefslogtreecommitdiff
path: root/auto_yards/nodes
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-04-22 14:58:03 +0200
committerautocommitter <autocommitter@linux-forks.de>2024-04-22 14:58:03 +0200
commit7b3ac07f3f9b9d92582aceb74050215a36646bc5 (patch)
tree3eda9d8e0a85b9d0daa53dd2887d154d9e0ef172 /auto_yards/nodes
parentefa99edcbd392873d8ed78eae7760f8c0b23dc45 (diff)
downloadluaatc_envs-7b3ac07f3f9b9d92582aceb74050215a36646bc5.tar.gz
luaatc_envs-7b3ac07f3f9b9d92582aceb74050215a36646bc5.tar.bz2
luaatc_envs-7b3ac07f3f9b9d92582aceb74050215a36646bc5.zip
State at 2023-03-26
Diffstat (limited to 'auto_yards/nodes')
-rw-r--r--auto_yards/nodes/(-1908,16,835).lua1
-rw-r--r--auto_yards/nodes/(-1910,16,837).lua1
-rw-r--r--auto_yards/nodes/(-1912,16,839).lua1
-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/(-1933,16,806).lua1
-rw-r--r--auto_yards/nodes/(-1933,16,833).lua1
-rw-r--r--auto_yards/nodes/(-1936,16,834).lua1
-rw-r--r--auto_yards/nodes/(-1946,16,801).lua1
-rw-r--r--auto_yards/nodes/(-1947,16,837).lua2
-rw-r--r--auto_yards/nodes/(-1954,16,797).lua1
-rw-r--r--auto_yards/nodes/(-1957,3,-1059).lua1
-rw-r--r--auto_yards/nodes/(-1958,16,808).lua1
-rw-r--r--auto_yards/nodes/(-1959,16,811).lua1
-rw-r--r--auto_yards/nodes/(-1965,16,793).lua1
-rw-r--r--auto_yards/nodes/(-1966,16,796).lua1
-rw-r--r--auto_yards/nodes/(-1976,16,782).lua1
-rw-r--r--auto_yards/nodes/(-1982,17,780).lua51
-rw-r--r--auto_yards/nodes/(-2004,2,-1101).lua18
-rw-r--r--auto_yards/nodes/(-2029,19,733).lua10
-rw-r--r--auto_yards/nodes/(-2030,3,-1091).lua1
-rw-r--r--auto_yards/nodes/(-2038,20,730).lua6
-rw-r--r--auto_yards/nodes/(-4023,12,-2660).lua16
-rw-r--r--auto_yards/nodes/(-513,26,2455).lua2
-rw-r--r--auto_yards/nodes/(-522,26,2469).lua2
-rw-r--r--auto_yards/nodes/(-528,26,2475).lua2
-rw-r--r--auto_yards/nodes/(-574,26,2469).lua2
-rw-r--r--auto_yards/nodes/(-575,26,2465).lua2
-rw-r--r--auto_yards/nodes/(-594,26,2485).lua28
-rw-r--r--auto_yards/nodes/(-604,26,2469).lua1
-rw-r--r--auto_yards/nodes/(-614,26,2469).lua1
-rw-r--r--auto_yards/nodes/(-623,26,2469).lua2
-rw-r--r--auto_yards/nodes/(-623,26,2472).lua2
-rw-r--r--auto_yards/nodes/(-623,26,2475).lua2
-rw-r--r--auto_yards/nodes/(-630,26,2454).lua73
-rw-r--r--auto_yards/nodes/(-633,26,2456).lua4
-rw-r--r--auto_yards/nodes/(-643,26,2475).lua83
-rw-r--r--auto_yards/nodes/(-668,20,2478).lua3
-rw-r--r--auto_yards/nodes/(1178,16,3851).lua11
-rw-r--r--auto_yards/nodes/(417,17,4).lua62
-rw-r--r--auto_yards/nodes/(417,18,4).lua3
41 files changed, 398 insertions, 7 deletions
diff --git a/auto_yards/nodes/(-1908,16,835).lua b/auto_yards/nodes/(-1908,16,835).lua
new file mode 100644
index 0000000..89349e3
--- /dev/null
+++ b/auto_yards/nodes/(-1908,16,835).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1910,16,837).lua b/auto_yards/nodes/(-1910,16,837).lua
new file mode 100644
index 0000000..89349e3
--- /dev/null
+++ b/auto_yards/nodes/(-1910,16,837).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1912,16,839).lua b/auto_yards/nodes/(-1912,16,839).lua
new file mode 100644
index 0000000..89349e3
--- /dev/null
+++ b/auto_yards/nodes/(-1912,16,839).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1925,16,833).lua b/auto_yards/nodes/(-1925,16,833).lua
new file mode 100644
index 0000000..2d94f29
--- /dev/null
+++ b/auto_yards/nodes/(-1925,16,833).lua
@@ -0,0 +1 @@
+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
new file mode 100644
index 0000000..89349e3
--- /dev/null
+++ b/auto_yards/nodes/(-1928,16,834).lua
@@ -0,0 +1 @@
+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/(-1933,16,806).lua
new file mode 100644
index 0000000..4503e25
--- /dev/null
+++ b/auto_yards/nodes/(-1933,16,806).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1933,16,833).lua b/auto_yards/nodes/(-1933,16,833).lua
new file mode 100644
index 0000000..89349e3
--- /dev/null
+++ b/auto_yards/nodes/(-1933,16,833).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1936,16,834).lua b/auto_yards/nodes/(-1936,16,834).lua
new file mode 100644
index 0000000..89349e3
--- /dev/null
+++ b/auto_yards/nodes/(-1936,16,834).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1946,16,801).lua b/auto_yards/nodes/(-1946,16,801).lua
new file mode 100644
index 0000000..4503e25
--- /dev/null
+++ b/auto_yards/nodes/(-1946,16,801).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1947,16,837).lua b/auto_yards/nodes/(-1947,16,837).lua
new file mode 100644
index 0000000..f77e28c
--- /dev/null
+++ b/auto_yards/nodes/(-1947,16,837).lua
@@ -0,0 +1,2 @@
+S.yards.ARC.notify = {['ARC_SB'] = true, ['CANNERY'] = 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/(-1954,16,797).lua
new file mode 100644
index 0000000..4503e25
--- /dev/null
+++ b/auto_yards/nodes/(-1954,16,797).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1957,3,-1059).lua b/auto_yards/nodes/(-1957,3,-1059).lua
new file mode 100644
index 0000000..ad61223
--- /dev/null
+++ b/auto_yards/nodes/(-1957,3,-1059).lua
@@ -0,0 +1 @@
+F.lane_EOL("BY",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1958,16,808).lua b/auto_yards/nodes/(-1958,16,808).lua
new file mode 100644
index 0000000..4503e25
--- /dev/null
+++ b/auto_yards/nodes/(-1958,16,808).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1959,16,811).lua b/auto_yards/nodes/(-1959,16,811).lua
new file mode 100644
index 0000000..4503e25
--- /dev/null
+++ b/auto_yards/nodes/(-1959,16,811).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1965,16,793).lua b/auto_yards/nodes/(-1965,16,793).lua
new file mode 100644
index 0000000..677ba3a
--- /dev/null
+++ b/auto_yards/nodes/(-1965,16,793).lua
@@ -0,0 +1 @@
+F.classification("ARC",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1966,16,796).lua b/auto_yards/nodes/(-1966,16,796).lua
new file mode 100644
index 0000000..4503e25
--- /dev/null
+++ b/auto_yards/nodes/(-1966,16,796).lua
@@ -0,0 +1 @@
+F.lane_EOL("ARC",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1976,16,782).lua b/auto_yards/nodes/(-1976,16,782).lua
new file mode 100644
index 0000000..3c1b64f
--- /dev/null
+++ b/auto_yards/nodes/(-1976,16,782).lua
@@ -0,0 +1 @@
+F.yard_arrival("ARC",false,true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-1982,17,780).lua b/auto_yards/nodes/(-1982,17,780).lua
new file mode 100644
index 0000000..072f902
--- /dev/null
+++ b/auto_yards/nodes/(-1982,17,780).lua
@@ -0,0 +1,51 @@
+local yard_id = "ARC"
+
+
+if event.train then
+ if F.has_rc("ARC_LIGHT_EXIT") then return end
+ if F.has_rc("ARC_NOSHUNT") then return end
+
+ if train_length() == 1 then -- eliminates near half the trains
+ if F.has_rc("ARC_LOCOSTORE") then -- specifies only the relevant train
+ if F.has_rc("ARC_DEPART") and F.has_rc("ARC_FINAL_COLLECT") and F.has_rc("ARC_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({"ARC_DEPART","ARC_FINAL_COLLECT"})
+ F.add_rc("ARC_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 --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
+ 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")
+ F.indicator(yard.error_indicator_pos,true)
+ end
+ end
+ return
+end
+
+
+
+-- if all else fails, do a normal headshunt_yard function
+F.headshunt_yard("ARC",true) \ 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 b686f37..c0d57ae 100644
--- a/auto_yards/nodes/(-2004,2,-1101).lua
+++ b/auto_yards/nodes/(-2004,2,-1101).lua
@@ -1,13 +1,25 @@
local yard_id = "BY"
+
+if not S.yards[yard_id].notify then return end
+
local subs = {
- ['S27'] = POS(-1512,8,-2613),
+--[[
+ A list of FC subscribers to send out notifications for.
+ Each entry must have a coresponding Lua Track / Operators Panel to trigger (using event.ext_int)
+ Used to alert a shunter locomotive or other yard that there's wagons available to collect from this yard.
+]]--
+
+ ['ARC'] = {['pos'] = POS(-1973,16,800), ['msg'] = "notify"},
}
if event.ext_int or event.punch then
- for fc, pos in pairs(subs) do
+ local list = "Notify: "
+ for fc, sub in pairs(subs) do
if S.yards[yard_id].notify[fc] then
- interrupt_pos(pos,"notify")
+ interrupt_pos(sub.pos,sub.msg or "notify")
+ list = list .. fc .. ", "
end
end
+ digiline_send("lcd",list)
S.yards[yard_id].notify = {}
end
diff --git a/auto_yards/nodes/(-2029,19,733).lua b/auto_yards/nodes/(-2029,19,733).lua
new file mode 100644
index 0000000..2672033
--- /dev/null
+++ b/auto_yards/nodes/(-2029,19,733).lua
@@ -0,0 +1,10 @@
+local yard_id = "ARC"
+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/(-2030,3,-1091).lua b/auto_yards/nodes/(-2030,3,-1091).lua
new file mode 100644
index 0000000..cbce1da
--- /dev/null
+++ b/auto_yards/nodes/(-2030,3,-1091).lua
@@ -0,0 +1 @@
+F.lane_EOL("BY",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-2038,20,730).lua b/auto_yards/nodes/(-2038,20,730).lua
new file mode 100644
index 0000000..a790746
--- /dev/null
+++ b/auto_yards/nodes/(-2038,20,730).lua
@@ -0,0 +1,6 @@
+local yard_id = "ARC"
+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
+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
new file mode 100644
index 0000000..9d743b7
--- /dev/null
+++ b/auto_yards/nodes/(-4023,12,-2660).lua
@@ -0,0 +1,16 @@
+local yard_id = "TY"
+local subs = {
+-- ['MMF'] = {['pos'] = POS(1,2,3), ['msg'] = "notify"},
+}
+
+if event.ext_int or event.punch then
+ local list = "Notify: "
+ for fc, sub in pairs(subs) do
+ if S.yards[yard_id].notify[fc] then
+ interrupt_pos(sub.pos,sub.msg or "notify")
+ list = list .. fc .. ", "
+ end
+ end
+ digiline_send("lcd",list)
+ S.yards[yard_id].notify = {}
+end \ No newline at end of file
diff --git a/auto_yards/nodes/(-513,26,2455).lua b/auto_yards/nodes/(-513,26,2455).lua
new file mode 100644
index 0000000..14a78ea
--- /dev/null
+++ b/auto_yards/nodes/(-513,26,2455).lua
@@ -0,0 +1,2 @@
+-- hs-exit
+F.headshunt_exit("CAN",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-522,26,2469).lua b/auto_yards/nodes/(-522,26,2469).lua
new file mode 100644
index 0000000..59df437
--- /dev/null
+++ b/auto_yards/nodes/(-522,26,2469).lua
@@ -0,0 +1,2 @@
+-- hs-yard
+F.headshunt_yard("CAN",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-528,26,2475).lua b/auto_yards/nodes/(-528,26,2475).lua
new file mode 100644
index 0000000..bb8ce55
--- /dev/null
+++ b/auto_yards/nodes/(-528,26,2475).lua
@@ -0,0 +1,2 @@
+-- arrival
+F.yard_arrival("CAN",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-574,26,2469).lua b/auto_yards/nodes/(-574,26,2469).lua
new file mode 100644
index 0000000..74a7624
--- /dev/null
+++ b/auto_yards/nodes/(-574,26,2469).lua
@@ -0,0 +1,2 @@
+-- EOL
+F.lane_EOL("CAN",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-575,26,2465).lua b/auto_yards/nodes/(-575,26,2465).lua
new file mode 100644
index 0000000..74a7624
--- /dev/null
+++ b/auto_yards/nodes/(-575,26,2465).lua
@@ -0,0 +1,2 @@
+-- EOL
+F.lane_EOL("CAN",false) \ No newline at end of file
diff --git a/auto_yards/nodes/(-594,26,2485).lua b/auto_yards/nodes/(-594,26,2485).lua
new file mode 100644
index 0000000..270750f
--- /dev/null
+++ b/auto_yards/nodes/(-594,26,2485).lua
@@ -0,0 +1,28 @@
+local yard_id = "CAN"
+
+if not S.yards[yard_id].notify then return end
+
+local subs = {
+--[[
+ A list of FC subscribers to send out notifications for.
+ Each entry must have a coresponding Lua Track / Operators Panel to trigger (using event.ext_int)
+ Used to alert a shunter locomotive or other yard that there's wagons available to collect from this yard.
+]]--
+
+ ['ARC'] = {['pos'] = POS(-630,26,2454), ['msg'] = "notify"}, --send the CAN loco to collect from ARC, then return and deliver here for ARC
+ ['CORN'] = {['pos'] = POS(-630,26,2454), ['msg'] = "shuffle"} -- consolidate wagons to the departure track
+ ['BOTTLES'] = {['pos'] = POS(-630,26,2454), ['msg'] = "shuffle"} -- consolidate wagons to the departure track
+ ['ETHANOL'] = {['pos'] = POS(-630,26,2454), ['msg'] = "shuffle"} -- consolidate wagons to the departure track
+}
+
+if event.ext_int or event.punch then
+ local list = "Notify: "
+ for fc, sub in pairs(subs) do
+ if S.yards[yard_id].notify[fc] then
+ interrupt_pos(sub.pos,sub.msg or "notify")
+ list = list .. fc .. ", "
+ end
+ end
+ digiline_send("lcd",list)
+ S.yards[yard_id].notify = {}
+end \ No newline at end of file
diff --git a/auto_yards/nodes/(-604,26,2469).lua b/auto_yards/nodes/(-604,26,2469).lua
new file mode 100644
index 0000000..7489acc
--- /dev/null
+++ b/auto_yards/nodes/(-604,26,2469).lua
@@ -0,0 +1 @@
+-- \ No newline at end of file
diff --git a/auto_yards/nodes/(-614,26,2469).lua b/auto_yards/nodes/(-614,26,2469).lua
new file mode 100644
index 0000000..7489acc
--- /dev/null
+++ b/auto_yards/nodes/(-614,26,2469).lua
@@ -0,0 +1 @@
+-- \ No newline at end of file
diff --git a/auto_yards/nodes/(-623,26,2469).lua b/auto_yards/nodes/(-623,26,2469).lua
new file mode 100644
index 0000000..46e3050
--- /dev/null
+++ b/auto_yards/nodes/(-623,26,2469).lua
@@ -0,0 +1,2 @@
+-- EOL
+F.lane_EOL("CAN",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-623,26,2472).lua b/auto_yards/nodes/(-623,26,2472).lua
new file mode 100644
index 0000000..46e3050
--- /dev/null
+++ b/auto_yards/nodes/(-623,26,2472).lua
@@ -0,0 +1,2 @@
+-- EOL
+F.lane_EOL("CAN",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-623,26,2475).lua b/auto_yards/nodes/(-623,26,2475).lua
new file mode 100644
index 0000000..f919bc0
--- /dev/null
+++ b/auto_yards/nodes/(-623,26,2475).lua
@@ -0,0 +1,2 @@
+-- class
+F.classification("CAN",true) \ No newline at end of file
diff --git a/auto_yards/nodes/(-630,26,2454).lua b/auto_yards/nodes/(-630,26,2454).lua
new file mode 100644
index 0000000..e01fb60
--- /dev/null
+++ b/auto_yards/nodes/(-630,26,2454).lua
@@ -0,0 +1,73 @@
+local notification_id = "CAN"
+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")
+ 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
+end
+
+if event.ext_int then
+ if event.message == "notify" then
+ if print_notification then print(rwt.to_string(rwt.now()).. " "..notification_id.." RX Notification") end
+ if F.indicator(ind) then return end
+ if atc_id then
+ send_train()
+ return
+ else
+ 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
+ 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")
+ return
+ end
+ return
+end
+
+if event.train then
+ unset_autocouple()
+ if F.indicator(shuffle_ind) then
+ shuffle_wagons()
+ return
+ end
+ if F.indicator(ind) then
+ send_train()
+ return
+ end
+ 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
new file mode 100644
index 0000000..8dc117b
--- /dev/null
+++ b/auto_yards/nodes/(-633,26,2456).lua
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000..1523fcd
--- /dev/null
+++ b/auto_yards/nodes/(-643,26,2475).lua
@@ -0,0 +1,83 @@
+local yard_id = "CAN"
+
+
+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
+ 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
+ end
+end
+
+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
+ 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")
+ 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
diff --git a/auto_yards/nodes/(-668,20,2478).lua b/auto_yards/nodes/(-668,20,2478).lua
new file mode 100644
index 0000000..7c582c0
--- /dev/null
+++ b/auto_yards/nodes/(-668,20,2478).lua
@@ -0,0 +1,3 @@
+-- arrival
+if not F.has_rc("CANNERY") then return end
+F.yard_arrival("CAN",false) \ 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 35047d5..6d126c4 100644
--- a/auto_yards/nodes/(1178,16,3851).lua
+++ b/auto_yards/nodes/(1178,16,3851).lua
@@ -1,13 +1,16 @@
local yard_id = "IP"
local subs = {
- ['WOA_mine_empty'] = POS(1949,7,9112),
+ ['WOA_mine_empty'] = {['pos'] = POS(1949,7,9112), ['msg'] = "notify"},
}
if event.ext_int or event.punch then
- for fc, pos in pairs(subs) do
+ local list = "Notify: "
+ for fc, sub in pairs(subs) do
if S.yards[yard_id].notify[fc] then
- interrupt_pos(pos,"notify")
+ interrupt_pos(sub.pos,sub.msg or "notify")
+ list = list .. fc .. ", "
end
end
+ digiline_send("lcd",list)
S.yards[yard_id].notify = {}
-end
+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
new file mode 100644
index 0000000..b634cde
--- /dev/null
+++ b/auto_yards/nodes/(417,17,4).lua
@@ -0,0 +1,62 @@
+if event.channel=="clock" then
+ local yard_id = event.msg
+ local info = S.yards[yard_id]
+ digiline_send("rwt_clock","Rwt Now:\n"..rwt.to_string(rwt.now()))
+
+ if not S.yards[yard_id] then
+ digiline_send(yard_id.."_1",yard_id.." -- Not In Service")
+ digiline_send(yard_id.."_2"," ")
+ digiline_send(yard_id.."_NOTIFY"," ")
+ return
+ end
+
+ local function getN(t)
+ local count = 0
+ for _ in pairs(t) do
+ count = count+1
+ end
+ return count
+ end
+
+
+ local txt = {}
+ local txt2 = {}
+ txt[#txt+1] = yard_id.." --"..info.yard_name.." Yard--"
+ 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)..")"
+ 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"))
+
+
+
+
+ txt2[#txt2+1] = "RTS: "..tostring(info.rts)
+ txt2[#txt2+1] = "Error: ".. tostring(F.indicator(info.error_indicator_pos))
+ txt2[#txt2+1] = ""
+ digiline_send(yard_id.."_2",table.concat(txt2,"\n"))
+
+ local notifications = ""
+ if info.notify then
+ local nt = ""
+ if getN(info.notify) > 0 then
+ nt = "Notify: "
+ for k in pairs(info.notify) do
+ nt = nt..k..", "
+ end
+ else
+ nt = "Notify: No Notifications"
+ end
+
+ local st_len = 26
+ if nt:len() > st_len then
+ nt = nt:sub(1,st_len).."\n"..nt:sub(st_len+1)
+ end
+ notifications = nt
+ else
+ notifications = "Notify: Not Enabled"
+ end
+ digiline_send(yard_id.."_NOTIFY",notifications)
+ return
+end \ No newline at end of file
diff --git a/auto_yards/nodes/(417,18,4).lua b/auto_yards/nodes/(417,18,4).lua
new file mode 100644
index 0000000..48ef9b8
--- /dev/null
+++ b/auto_yards/nodes/(417,18,4).lua
@@ -0,0 +1,3 @@
+if event.channel ~= "debug_switch" then return end
+S.print_debug = event.msg
+print("Print Debug: "..tostring(S.print_debug)) \ No newline at end of file