summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--auto_yards/init_code.lua25
-rw-r--r--durt/nodes/(1902,8,9059).lua26
-rw-r--r--durt/nodes/(1904,8,9057).lua18
-rw-r--r--durt/nodes/(1906,7,9136).lua33
-rw-r--r--durt/nodes/(1920,7,9187).lua26
-rw-r--r--durt/nodes/(1949,7,9112).lua27
-rw-r--r--durt/nodes/(1950,7,9108).lua1
7 files changed, 135 insertions, 21 deletions
diff --git a/auto_yards/init_code.lua b/auto_yards/init_code.lua
index 6e4551f..689b7e3 100644
--- a/auto_yards/init_code.lua
+++ b/auto_yards/init_code.lua
@@ -8,8 +8,6 @@ if event.init then
active_indicator_pos = POS(),
dir_indicator_pos = POS(),
error_indicator_pos = POS(),
- ext_notify_pos = POS(),
- notify = table,
headshunt_max = number,
},
@@ -24,8 +22,6 @@ if event.init then
active_indicator_pos = POS(-2002,3,-1099),
dir_indicator_pos = POS(-2009,3,-1101),
error_indicator_pos = POS(-1999,3,-1099),
- ext_notify_pos = POS(-2004,2,-1101),
- notify = {},
headshunt_max = 5,
},
IP = {
@@ -167,7 +163,7 @@ F.yard_arrival = function(yard_id,this_dir) -- arrow points towards yard
end
atc_set_ars_disable(false)
atc_send("S6")
- print("Train "..atc_id.." enters yard ".. yard_id.." from the "..tostring(this_dir).." direction and "..((rts and "will") or "won't").." return in the same direction")
+ print("YARD: "..yard_id..": Train "..atc_id.." enters from the "..tostring(this_dir).." direction and "..((rts and "will") or "won't").." return in the same direction")
return
end
@@ -180,7 +176,7 @@ F.yard_arrival = function(yard_id,this_dir) -- arrow points towards yard
if event.train and atc_arrow then
if F.indicator(yard.active_indicator_pos) then
- print("Train "..atc_id.." has arrived at "..yard_id.." yard and has to wait for the yard to deactivate.")
+ print("YARD: "..yard_id..": Train "..atc_id.." has arrived and has to wait for the yard to deactivate.")
schedule_in(";10","recheck")
return
else
@@ -350,8 +346,8 @@ F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard
if event.train then
if atc_arrow and (F.indicator(yard.dir_indicator_pos) == this_dir) then
if F.has_rc(yard_id.."_DEPART") then
- print("Train "..atc_id.." has a length of "..train_length())
- print("It will depart in the "..tostring(this_dir).." direction.")
+ print("YARD: "..yard_id..": Train "..atc_id.." has a length of "..train_length())
+ print("YARD: "..yard_id..": It will depart in the "..tostring(this_dir).." direction.")
unset_autocouple()
F.remove_rc({yard_id.."_FINAL_COLLECT",yard_id.."_DEPART"})
F.remove_rc_match(yard_id.."_LOCOS_%d+")
@@ -377,7 +373,6 @@ F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard
if event.msg == "deactivate_check" then
if not atc_id then
F.indicator(yard.active_indicator_pos,false)
- if yard.ext_notify_pos then interrupt_pos(yard.ext_notify_pos,{command="EXIT"}) end
print(yard_id.." yard Disabled")
else
schedule_in(";05","deactivate_check")
@@ -410,18 +405,6 @@ F.lane_EOL = function(yard_id,this_dir) -- arrow points towards headshunt
end
else
if F.indicator(yard.dir_indicator_pos) == this_dir then
- --train is clasifying wagons, let it pass and couple to the rest of the rake
- --send a notification to the yard controller to trigger external functions
- if yard.ext_notify_pos then
- local fc = F.get_rc_safe():match(yard_id.."_CLASS_(%S+)") or nil
- if fc then
- if F.has_rc(yard_id.."_COLLECT_"..fc) then
- interrupt_pos(yard.ext_notify_pos,{command="COLLECTED",msg=fc})
- else
- interrupt_pos(yard.ext_notify_pos,{command="NOTIFY",msg=fc})
- end
- end
- end
F.remove_rc_match(yard_id.."_CLASS_%S+")
else --this should never come into play as it means the train has entered from the wrong end somehow
atc_send("BBOL") --stop the train and open the doors (if available) to signify assistance required
diff --git a/durt/nodes/(1902,8,9059).lua b/durt/nodes/(1902,8,9059).lua
new file mode 100644
index 0000000..88b402f
--- /dev/null
+++ b/durt/nodes/(1902,8,9059).lua
@@ -0,0 +1,26 @@
+__approach_callback_mode = 1
+
+if event.approach and not event.has_entered then
+ atc_set_lzb_tsr(4)
+ return
+end
+
+if event.train and atc_arrow then
+ if not F.has_rc("WOA_rev_south") then return end
+ F.remove_rc({"WOA_rev_south"})
+ 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/durt/nodes/(1904,8,9057).lua b/durt/nodes/(1904,8,9057).lua
new file mode 100644
index 0000000..4858c34
--- /dev/null
+++ b/durt/nodes/(1904,8,9057).lua
@@ -0,0 +1,18 @@
+__approach_callback_mode = 1
+if event.approach and not event.has_entered then
+ atc_set_ars_disable(true)
+ atc_set_lzb_tsr(4)
+end
+
+if event.train and atc_arrow then
+ atc_send("S4")
+ if F.has_rc("WOA_mine_around") then
+ if train_length() == 1 then
+ F.remove_rc("FREIGHT")
+ F.add_rc("WOA_ttb_s")
+ else
+ F.add_rc("WOA_freight_left")
+ end
+ end
+ atc_set_ars_disable(false)
+end \ No newline at end of file
diff --git a/durt/nodes/(1906,7,9136).lua b/durt/nodes/(1906,7,9136).lua
new file mode 100644
index 0000000..a80aa6a
--- /dev/null
+++ b/durt/nodes/(1906,7,9136).lua
@@ -0,0 +1,33 @@
+local around_rc_list = {
+ "WOA_around_active",
+ "WOA_rev_north",
+ "WOA_around_station",
+ "WOA_rev_south",
+ "WOA_rejoin_overburden"
+}
+
+__approach_callback_mode = 1
+
+if event.approach and not event.has_entered then
+ atc_set_ars_disable(true)
+ atc_set_lzb_tsr(1)
+ return
+end
+
+if event.train and atc_arrow then
+ if F.has_rc("WOA_mine_around") then
+ if F.has_rc("WOA_around_active") then
+ F.remove_rc(around_rc_list)
+ unset_autocouple()
+ atc_send("B0WRD3SMA1")
+ atc_set_text_outside("Warmonaye Mining Co.")
+ return
+ end
+ atc_set_text_outside("Warmoneaye Mining Co.\nLocomotive Switching Ends")
+ split_off_locomotive("B0A0")
+ set_autocouple()
+ F.add_rc(around_rc_list)
+ atc_send("S4A1")
+ return
+ end
+end \ No newline at end of file
diff --git a/durt/nodes/(1920,7,9187).lua b/durt/nodes/(1920,7,9187).lua
new file mode 100644
index 0000000..d477345
--- /dev/null
+++ b/durt/nodes/(1920,7,9187).lua
@@ -0,0 +1,26 @@
+__approach_callback_mode = 1
+
+if event.approach and not event.has_entered then
+ atc_set_lzb_tsr(1)
+ return
+end
+
+if event.train and atc_arrow then
+ if not F.has_rc("WOA_rev_north") then return end
+ F.remove_rc({"WOA_rev_north"})
+ 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/durt/nodes/(1949,7,9112).lua b/durt/nodes/(1949,7,9112).lua
new file mode 100644
index 0000000..f434548
--- /dev/null
+++ b/durt/nodes/(1949,7,9112).lua
@@ -0,0 +1,27 @@
+local ind = POS(1951,7,9111)
+__approach_callback_mode = 1
+if event.approach and not event.has_entered then
+ atc_set_ars_disable(true)
+ atc_set_lzb_tsr(1)
+end
+
+if event.train and atc_arrow then
+ F.remove_rc({"WOA_ttb_s"})
+ if F.indicator(ind) then
+ schedule_in(";02","send")
+ end
+ atc_send("B0WR")
+end
+
+if (event.channel == "train_ctl" and event.msg == "send") or ((event.ext_int or event.schedule) and event.message == "send") then
+ print("RX Notification")
+ if not atc_id then
+ F.indicator(ind,true)
+ return
+ end
+ F.add_rc("FREIGHT")
+ set_route(POS(1942,8,9102),"Exit South")
+ atc_send("I+S0WRD2;SMA1")
+ F.indicator(ind,false)
+ return
+end \ No newline at end of file
diff --git a/durt/nodes/(1950,7,9108).lua b/durt/nodes/(1950,7,9108).lua
new file mode 100644
index 0000000..a3a64b6
--- /dev/null
+++ b/durt/nodes/(1950,7,9108).lua
@@ -0,0 +1 @@
+interrupt_pos(POS(1949,7,9112),"send") \ No newline at end of file