summaryrefslogtreecommitdiff
path: root/Tyard/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'Tyard/nodes')
-rw-r--r--Tyard/nodes/(-4012,12,-2646).lua23
-rw-r--r--Tyard/nodes/(-4027,12,-2655).lua47
-rw-r--r--Tyard/nodes/(-4027,12,-2731).lua47
-rw-r--r--Tyard/nodes/(-4031,12,-2655).lua29
-rw-r--r--Tyard/nodes/(-4031,12,-2731).lua29
-rw-r--r--Tyard/nodes/(-4035,12,-2655).lua29
-rw-r--r--Tyard/nodes/(-4035,12,-2731).lua29
-rw-r--r--Tyard/nodes/(-4039,12,-2655).lua29
-rw-r--r--Tyard/nodes/(-4039,12,-2731).lua29
-rw-r--r--Tyard/nodes/(-4043,12,-2655).lua29
-rw-r--r--Tyard/nodes/(-4043,12,-2731).lua29
-rw-r--r--Tyard/nodes/(-4047,12,-2655).lua29
-rw-r--r--Tyard/nodes/(-4047,12,-2731).lua29
-rw-r--r--Tyard/nodes/(-4051,12,-2655).lua29
-rw-r--r--Tyard/nodes/(-4051,12,-2731).lua29
-rw-r--r--Tyard/nodes/(-4055,12,-2655).lua29
-rw-r--r--Tyard/nodes/(-4055,12,-2731).lua29
-rw-r--r--Tyard/nodes/(-4100,12,-2742).lua23
18 files changed, 484 insertions, 62 deletions
diff --git a/Tyard/nodes/(-4012,12,-2646).lua b/Tyard/nodes/(-4012,12,-2646).lua
index aa2cbfe..670bb6c 100644
--- a/Tyard/nodes/(-4012,12,-2646).lua
+++ b/Tyard/nodes/(-4012,12,-2646).lua
@@ -13,11 +13,23 @@ end
if event.train then
if not atc_arrow then --train has entered headshunt from yard. bounce or depart
- if not F.has_rc("TY_DEPART") then --if has TY_DEPART then another controller closer to the signal will remove to ensure signal engages the RC
- schedule_in(";01",atc_id)
- atc_set_ars_disable(true)
- return
- end
+ atc_set_ars_disable(true)
+ F.remove_rc({"TY_HEADSHUNT"})
+ if not F.has_rc("TY_FINAL_COLLECT") then
+ if not F.has_rc("TY_DEPART") then
+ schedule_in(";01",atc_id)
+ return
+ else
+ local collect = F.get_rc_safe():match("TY_COLLECT_(%S+)")
+ if collect then --train needs to collect a rake from the yard before departing
+ F.add_rc({"TY_FINAL_COLLECT","TY_CLASS_"..collect})
+ schedule_in(";01",atc_id)
+ return
+ end
+ end
+
+ --else let train proceed forward to the exit controller without a rake
+ end --else train has already collected rake. let it exit yard
else --train has bounced
if F.has_rc("TY_AROUND") then
if this_dir == F.dir() then --send train to Classification
@@ -28,7 +40,6 @@ if event.train then
end --if at wrong end, do nothing. train will follow TY_AROUND ARS to relevant headshunt
end -- if doesn't have TY_AROUND then let ARS classify the train
- F.remove_rc({"TY_HEADSHUNT"})
atc_set_ars_disable(false)
end
return
diff --git a/Tyard/nodes/(-4027,12,-2655).lua b/Tyard/nodes/(-4027,12,-2655).lua
index 5634403..b7ed9c7 100644
--- a/Tyard/nodes/(-4027,12,-2655).lua
+++ b/Tyard/nodes/(-4027,12,-2655).lua
@@ -4,40 +4,51 @@ local this_dir = true
if F.yard_active() then
if atc_arrow then -- loco is at working end
F.remove_rc({"TY_PICKUP"})
- if F.has_rc("TY_ARRIVE") then --first pass, prep train for working
+ if F.has_rc("TY_ARRIVE") and F.dir() == this_dir then --first pass, prep train for working
F.remove_rc({"TY_AROUND"})
+ if not F.get_rc_safe():match("TY_LOCOS_%d+") or not F.get_rc_safe():match("TY_WAGONS_%d+") then
+ local full_length = train_length()
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_HEADSHUNT"}) -- train will end up going through headshunt no matter what. there shouldn't be any trains entering that pass straight through.
+ if train_length() == full_length then --train is either only here for collection or there's no FC's in the wagons. can't differentiate
+ local lane = F.get_rc_safe():match("TY_COLLECT_(%S+)") or ""
+ F.add_rc({"TY_LAST_CLASS","TY_CLASS_"..lane}) -- direct train to correct lane for collection
+ else --identify and save loco:wagon ratio, then bounce back from headshunt. it's easier than trying to reconnect
+ F.add_rc({"TY_LOCOS_"..train_length(), "TY_WAGONS_"..(full_length-train_length()),"TY_PICKUP"})
+ end
+ return -- train has departed for headshunt
+ end
if F.has_rc("TY_RTS") then
F.dir(not F.dir())
F.remove_rc({"TY_RTS"})
F.add_rc({"TY_HEADSHUNT","TY_AROUND"}) -- send loco around to the other end
split_off_locomotive("A0B0")
atc_set_ars_disable(false)
- return
+ return -- train has departed for RTS loop
end
F.remove_rc({"TY_ARRIVE"})
step_fc()
end
if this_dir == F.dir() then --train has bounced and is ready to classify wagon(s)
- local t_len = train_length()
- local lane = split_at_fc("A0B0",3)
- if t_len ~= train_length() then -- train still has wagons to classify
- F.add_rc({"TY_CLASS_"..lane}) -- to be pattern matched when leaving lane
- else -- train_length is the same as it was before it tried to split_at_fc, hence it's just the loco
- if not F.has_rc("TY_LAST_CLASS") then
- F.add_rc({"TY_CLASS_"..lane,"TY_LAST_CLASS"})
- else
- local collect = F.get_rc_safe():match("TY_COLLECT_(%S+)")
- if not collect then
- F.add_rc({"TY_DEPART"}) -- run engines-light to the exit, we're not collecting anything
- else
- F.add_rc({"TY_FINAL_COLLECT","TY_CLASS_"..collect}) --loco is to collect lane before departing. TY_DEPART to be set by EOL
- end
- end
+ -- local pre_split = train_length()
+ local lane = split_at_fc("A0B0",3) -- where to classify this rake
+ local locos = tonumber(F.get_rc_safe():match("TY_LOCOS_(%d+)")) or 1 --saved loco count
+ local wagons = tonumber(F.get_rc_safe():match("TY_WAGONS_(%d+)")) or 0 -- wagon_count from last classification split
+ local this_rake = train_length() - locos-- subtract these wagons from the overall wagon count
+ if this_rake == wagons then -- mark for last_classification
+ F.add_rc({"TY_LAST_CLASS"})
+ end
+ if lane ~= "" then
+ F.add_rc({"TY_CLASS_"..lane})
+ end
+ for v in F.get_rc_safe():gmatch("(TY_WAGONS_%d+)") do
+ F.remove_rc({v})
end
- F.add_rc({"TY_HEADSHUNT"})
+ F.add_rc({"TY_HEADSHUNT","TY_WAGONS_"..wagons-this_rake})
atc_set_ars_disable(false)
set_autocouple()
else --bounce train back towards working end
+ atc_set_ars_disable(true)
atc_send("S0WRD1S3")
unset_autocouple()
end
diff --git a/Tyard/nodes/(-4027,12,-2731).lua b/Tyard/nodes/(-4027,12,-2731).lua
index e703257..836ebf8 100644
--- a/Tyard/nodes/(-4027,12,-2731).lua
+++ b/Tyard/nodes/(-4027,12,-2731).lua
@@ -4,40 +4,51 @@ local this_dir = false
if F.yard_active() then
if atc_arrow then -- loco is at working end
F.remove_rc({"TY_PICKUP"})
- if F.has_rc("TY_ARRIVE") then --first pass, prep train for working
+ if F.has_rc("TY_ARRIVE") and F.dir() == this_dir then --first pass, prep train for working
F.remove_rc({"TY_AROUND"})
+ if not F.get_rc_safe():match("TY_LOCOS_%d+") or not F.get_rc_safe():match("TY_WAGONS_%d+") then
+ local full_length = train_length()
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_HEADSHUNT"}) -- train will end up going through headshunt no matter what. there shouldn't be any trains entering that pass straight through.
+ if train_length() == full_length then --train is either only here for collection or there's no FC's in the wagons. can't differentiate
+ local lane = F.get_rc_safe():match("TY_COLLECT_(%S+)") or ""
+ F.add_rc({"TY_LAST_CLASS","TY_CLASS_"..lane}) -- direct train to correct lane for collection
+ else --identify and save loco:wagon ratio, then bounce back from headshunt. it's easier than trying to reconnect
+ F.add_rc({"TY_LOCOS_"..train_length(), "TY_WAGONS_"..(full_length-train_length()),"TY_PICKUP"})
+ end
+ return -- train has departed for headshunt
+ end
if F.has_rc("TY_RTS") then
F.dir(not F.dir())
F.remove_rc({"TY_RTS"})
F.add_rc({"TY_HEADSHUNT","TY_AROUND"}) -- send loco around to the other end
split_off_locomotive("A0B0")
atc_set_ars_disable(false)
- return
+ return -- train has departed for RTS loop
end
F.remove_rc({"TY_ARRIVE"})
step_fc()
end
if this_dir == F.dir() then --train has bounced and is ready to classify wagon(s)
- local t_len = train_length()
- local lane = split_at_fc("A0B0",3)
- if t_len ~= train_length() then -- train still has wagons to classify
- F.add_rc({"TY_CLASS_"..lane}) -- to be pattern matched when leaving lane
- else -- train_length is the same as it was before it tried to split_at_fc, hence it's just the loco
- if not F.has_rc("TY_LAST_CLASS") then
- F.add_rc({"TY_CLASS_"..lane,"TY_LAST_CLASS"})
- else
- local collect = F.get_rc_safe():match("TY_COLLECT_(%S+)")
- if not collect then
- F.add_rc({"TY_DEPART"}) -- run engines-light to the exit, we're not collecting anything
- else
- F.add_rc({"TY_FINAL_COLLECT","TY_CLASS_"..collect}) --loco is to collect lane before departing. TY_DEPART to be set by EOL
- end
- end
+ -- local pre_split = train_length()
+ local lane = split_at_fc("A0B0",3) -- where to classify this rake
+ local locos = tonumber(F.get_rc_safe():match("TY_LOCOS_(%d+)")) or 1 --saved loco count
+ local wagons = tonumber(F.get_rc_safe():match("TY_WAGONS_(%d+)")) or 0 -- wagon_count from last classification split
+ local this_rake = train_length() - locos-- subtract these wagons from the overall wagon count
+ if this_rake == wagons then -- mark for last_classification
+ F.add_rc({"TY_LAST_CLASS"})
+ end
+ if lane ~= "" then
+ F.add_rc({"TY_CLASS_"..lane})
+ end
+ for v in F.get_rc_safe():gmatch("(TY_WAGONS_%d+)") do
+ F.remove_rc({v})
end
- F.add_rc({"TY_HEADSHUNT"})
+ F.add_rc({"TY_HEADSHUNT","TY_WAGONS_"..wagons-this_rake})
atc_set_ars_disable(false)
set_autocouple()
else --bounce train back towards working end
+ atc_set_ars_disable(true)
atc_send("S0WRD1S3")
unset_autocouple()
end
diff --git a/Tyard/nodes/(-4031,12,-2655).lua b/Tyard/nodes/(-4031,12,-2655).lua
index 747fb3d..f08c2fe 100644
--- a/Tyard/nodes/(-4031,12,-2655).lua
+++ b/Tyard/nodes/(-4031,12,-2655).lua
@@ -1 +1,28 @@
-F.EOL(true) \ No newline at end of file
+--EOL code
+local this_dir = true -- true = F.dir arrow points north
+
+if not F.yard_active() then return end
+if atc_arrow then
+ if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
+ if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
+ F.remove_rc({"TY_LAST_CLASS"})
+ F.add_rc({"TY_DEPART"})
+ split_off_locomotive("A0B0")
+ elseif not F.has_rc("TY_FINAL_COLLECT") then
+ -- disconnect loco and return to pickup
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_PICKUP"})
+ end --if has FINAL_COLLECT then don't split off the loco. take the full rake
+ F.add_rc({"TY_HEADSHUNT"})
+ else --train needs to bounce
+ atc_send("B0WRD1S4")
+ end
+else
+ if F.dir() == this_dir then
+ --train is clasifying wagons, let it pass and couple to the rest of the rake
+ F.remove_rc_match("TY_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
+ F.error(true)
+ end
+end \ No newline at end of file
diff --git a/Tyard/nodes/(-4031,12,-2731).lua b/Tyard/nodes/(-4031,12,-2731).lua
index b8358f2..aad7649 100644
--- a/Tyard/nodes/(-4031,12,-2731).lua
+++ b/Tyard/nodes/(-4031,12,-2731).lua
@@ -1 +1,28 @@
-F.EOL(false) \ No newline at end of file
+--EOL code
+local this_dir = false -- true = F.dir arrow points north
+
+if not F.yard_active() then return end
+if atc_arrow then
+ if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
+ if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
+ F.remove_rc({"TY_LAST_CLASS"})
+ F.add_rc({"TY_DEPART"})
+ split_off_locomotive("A0B0")
+ elseif not F.has_rc("TY_FINAL_COLLECT") then
+ -- disconnect loco and return to pickup
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_PICKUP"})
+ end --if has FINAL_COLLECT then don't split off the loco. take the full rake
+ F.add_rc({"TY_HEADSHUNT"})
+ else --train needs to bounce
+ atc_send("B0WRD1S4")
+ end
+else
+ if F.dir() == this_dir then
+ --train is clasifying wagons, let it pass and couple to the rest of the rake
+ F.remove_rc_match("TY_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
+ F.error(true)
+ end
+end \ No newline at end of file
diff --git a/Tyard/nodes/(-4035,12,-2655).lua b/Tyard/nodes/(-4035,12,-2655).lua
index 747fb3d..f08c2fe 100644
--- a/Tyard/nodes/(-4035,12,-2655).lua
+++ b/Tyard/nodes/(-4035,12,-2655).lua
@@ -1 +1,28 @@
-F.EOL(true) \ No newline at end of file
+--EOL code
+local this_dir = true -- true = F.dir arrow points north
+
+if not F.yard_active() then return end
+if atc_arrow then
+ if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
+ if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
+ F.remove_rc({"TY_LAST_CLASS"})
+ F.add_rc({"TY_DEPART"})
+ split_off_locomotive("A0B0")
+ elseif not F.has_rc("TY_FINAL_COLLECT") then
+ -- disconnect loco and return to pickup
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_PICKUP"})
+ end --if has FINAL_COLLECT then don't split off the loco. take the full rake
+ F.add_rc({"TY_HEADSHUNT"})
+ else --train needs to bounce
+ atc_send("B0WRD1S4")
+ end
+else
+ if F.dir() == this_dir then
+ --train is clasifying wagons, let it pass and couple to the rest of the rake
+ F.remove_rc_match("TY_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
+ F.error(true)
+ end
+end \ No newline at end of file
diff --git a/Tyard/nodes/(-4035,12,-2731).lua b/Tyard/nodes/(-4035,12,-2731).lua
index b8358f2..aad7649 100644
--- a/Tyard/nodes/(-4035,12,-2731).lua
+++ b/Tyard/nodes/(-4035,12,-2731).lua
@@ -1 +1,28 @@
-F.EOL(false) \ No newline at end of file
+--EOL code
+local this_dir = false -- true = F.dir arrow points north
+
+if not F.yard_active() then return end
+if atc_arrow then
+ if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
+ if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
+ F.remove_rc({"TY_LAST_CLASS"})
+ F.add_rc({"TY_DEPART"})
+ split_off_locomotive("A0B0")
+ elseif not F.has_rc("TY_FINAL_COLLECT") then
+ -- disconnect loco and return to pickup
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_PICKUP"})
+ end --if has FINAL_COLLECT then don't split off the loco. take the full rake
+ F.add_rc({"TY_HEADSHUNT"})
+ else --train needs to bounce
+ atc_send("B0WRD1S4")
+ end
+else
+ if F.dir() == this_dir then
+ --train is clasifying wagons, let it pass and couple to the rest of the rake
+ F.remove_rc_match("TY_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
+ F.error(true)
+ end
+end \ No newline at end of file
diff --git a/Tyard/nodes/(-4039,12,-2655).lua b/Tyard/nodes/(-4039,12,-2655).lua
index 747fb3d..f08c2fe 100644
--- a/Tyard/nodes/(-4039,12,-2655).lua
+++ b/Tyard/nodes/(-4039,12,-2655).lua
@@ -1 +1,28 @@
-F.EOL(true) \ No newline at end of file
+--EOL code
+local this_dir = true -- true = F.dir arrow points north
+
+if not F.yard_active() then return end
+if atc_arrow then
+ if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
+ if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
+ F.remove_rc({"TY_LAST_CLASS"})
+ F.add_rc({"TY_DEPART"})
+ split_off_locomotive("A0B0")
+ elseif not F.has_rc("TY_FINAL_COLLECT") then
+ -- disconnect loco and return to pickup
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_PICKUP"})
+ end --if has FINAL_COLLECT then don't split off the loco. take the full rake
+ F.add_rc({"TY_HEADSHUNT"})
+ else --train needs to bounce
+ atc_send("B0WRD1S4")
+ end
+else
+ if F.dir() == this_dir then
+ --train is clasifying wagons, let it pass and couple to the rest of the rake
+ F.remove_rc_match("TY_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
+ F.error(true)
+ end
+end \ No newline at end of file
diff --git a/Tyard/nodes/(-4039,12,-2731).lua b/Tyard/nodes/(-4039,12,-2731).lua
index b8358f2..aad7649 100644
--- a/Tyard/nodes/(-4039,12,-2731).lua
+++ b/Tyard/nodes/(-4039,12,-2731).lua
@@ -1 +1,28 @@
-F.EOL(false) \ No newline at end of file
+--EOL code
+local this_dir = false -- true = F.dir arrow points north
+
+if not F.yard_active() then return end
+if atc_arrow then
+ if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
+ if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
+ F.remove_rc({"TY_LAST_CLASS"})
+ F.add_rc({"TY_DEPART"})
+ split_off_locomotive("A0B0")
+ elseif not F.has_rc("TY_FINAL_COLLECT") then
+ -- disconnect loco and return to pickup
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_PICKUP"})
+ end --if has FINAL_COLLECT then don't split off the loco. take the full rake
+ F.add_rc({"TY_HEADSHUNT"})
+ else --train needs to bounce
+ atc_send("B0WRD1S4")
+ end
+else
+ if F.dir() == this_dir then
+ --train is clasifying wagons, let it pass and couple to the rest of the rake
+ F.remove_rc_match("TY_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
+ F.error(true)
+ end
+end \ No newline at end of file
diff --git a/Tyard/nodes/(-4043,12,-2655).lua b/Tyard/nodes/(-4043,12,-2655).lua
index 747fb3d..f08c2fe 100644
--- a/Tyard/nodes/(-4043,12,-2655).lua
+++ b/Tyard/nodes/(-4043,12,-2655).lua
@@ -1 +1,28 @@
-F.EOL(true) \ No newline at end of file
+--EOL code
+local this_dir = true -- true = F.dir arrow points north
+
+if not F.yard_active() then return end
+if atc_arrow then
+ if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
+ if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
+ F.remove_rc({"TY_LAST_CLASS"})
+ F.add_rc({"TY_DEPART"})
+ split_off_locomotive("A0B0")
+ elseif not F.has_rc("TY_FINAL_COLLECT") then
+ -- disconnect loco and return to pickup
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_PICKUP"})
+ end --if has FINAL_COLLECT then don't split off the loco. take the full rake
+ F.add_rc({"TY_HEADSHUNT"})
+ else --train needs to bounce
+ atc_send("B0WRD1S4")
+ end
+else
+ if F.dir() == this_dir then
+ --train is clasifying wagons, let it pass and couple to the rest of the rake
+ F.remove_rc_match("TY_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
+ F.error(true)
+ end
+end \ No newline at end of file
diff --git a/Tyard/nodes/(-4043,12,-2731).lua b/Tyard/nodes/(-4043,12,-2731).lua
index b8358f2..aad7649 100644
--- a/Tyard/nodes/(-4043,12,-2731).lua
+++ b/Tyard/nodes/(-4043,12,-2731).lua
@@ -1 +1,28 @@
-F.EOL(false) \ No newline at end of file
+--EOL code
+local this_dir = false -- true = F.dir arrow points north
+
+if not F.yard_active() then return end
+if atc_arrow then
+ if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
+ if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
+ F.remove_rc({"TY_LAST_CLASS"})
+ F.add_rc({"TY_DEPART"})
+ split_off_locomotive("A0B0")
+ elseif not F.has_rc("TY_FINAL_COLLECT") then
+ -- disconnect loco and return to pickup
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_PICKUP"})
+ end --if has FINAL_COLLECT then don't split off the loco. take the full rake
+ F.add_rc({"TY_HEADSHUNT"})
+ else --train needs to bounce
+ atc_send("B0WRD1S4")
+ end
+else
+ if F.dir() == this_dir then
+ --train is clasifying wagons, let it pass and couple to the rest of the rake
+ F.remove_rc_match("TY_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
+ F.error(true)
+ end
+end \ No newline at end of file
diff --git a/Tyard/nodes/(-4047,12,-2655).lua b/Tyard/nodes/(-4047,12,-2655).lua
index 747fb3d..f08c2fe 100644
--- a/Tyard/nodes/(-4047,12,-2655).lua
+++ b/Tyard/nodes/(-4047,12,-2655).lua
@@ -1 +1,28 @@
-F.EOL(true) \ No newline at end of file
+--EOL code
+local this_dir = true -- true = F.dir arrow points north
+
+if not F.yard_active() then return end
+if atc_arrow then
+ if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
+ if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
+ F.remove_rc({"TY_LAST_CLASS"})
+ F.add_rc({"TY_DEPART"})
+ split_off_locomotive("A0B0")
+ elseif not F.has_rc("TY_FINAL_COLLECT") then
+ -- disconnect loco and return to pickup
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_PICKUP"})
+ end --if has FINAL_COLLECT then don't split off the loco. take the full rake
+ F.add_rc({"TY_HEADSHUNT"})
+ else --train needs to bounce
+ atc_send("B0WRD1S4")
+ end
+else
+ if F.dir() == this_dir then
+ --train is clasifying wagons, let it pass and couple to the rest of the rake
+ F.remove_rc_match("TY_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
+ F.error(true)
+ end
+end \ No newline at end of file
diff --git a/Tyard/nodes/(-4047,12,-2731).lua b/Tyard/nodes/(-4047,12,-2731).lua
index b8358f2..aad7649 100644
--- a/Tyard/nodes/(-4047,12,-2731).lua
+++ b/Tyard/nodes/(-4047,12,-2731).lua
@@ -1 +1,28 @@
-F.EOL(false) \ No newline at end of file
+--EOL code
+local this_dir = false -- true = F.dir arrow points north
+
+if not F.yard_active() then return end
+if atc_arrow then
+ if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
+ if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
+ F.remove_rc({"TY_LAST_CLASS"})
+ F.add_rc({"TY_DEPART"})
+ split_off_locomotive("A0B0")
+ elseif not F.has_rc("TY_FINAL_COLLECT") then
+ -- disconnect loco and return to pickup
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_PICKUP"})
+ end --if has FINAL_COLLECT then don't split off the loco. take the full rake
+ F.add_rc({"TY_HEADSHUNT"})
+ else --train needs to bounce
+ atc_send("B0WRD1S4")
+ end
+else
+ if F.dir() == this_dir then
+ --train is clasifying wagons, let it pass and couple to the rest of the rake
+ F.remove_rc_match("TY_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
+ F.error(true)
+ end
+end \ No newline at end of file
diff --git a/Tyard/nodes/(-4051,12,-2655).lua b/Tyard/nodes/(-4051,12,-2655).lua
index 747fb3d..f08c2fe 100644
--- a/Tyard/nodes/(-4051,12,-2655).lua
+++ b/Tyard/nodes/(-4051,12,-2655).lua
@@ -1 +1,28 @@
-F.EOL(true) \ No newline at end of file
+--EOL code
+local this_dir = true -- true = F.dir arrow points north
+
+if not F.yard_active() then return end
+if atc_arrow then
+ if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
+ if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
+ F.remove_rc({"TY_LAST_CLASS"})
+ F.add_rc({"TY_DEPART"})
+ split_off_locomotive("A0B0")
+ elseif not F.has_rc("TY_FINAL_COLLECT") then
+ -- disconnect loco and return to pickup
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_PICKUP"})
+ end --if has FINAL_COLLECT then don't split off the loco. take the full rake
+ F.add_rc({"TY_HEADSHUNT"})
+ else --train needs to bounce
+ atc_send("B0WRD1S4")
+ end
+else
+ if F.dir() == this_dir then
+ --train is clasifying wagons, let it pass and couple to the rest of the rake
+ F.remove_rc_match("TY_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
+ F.error(true)
+ end
+end \ No newline at end of file
diff --git a/Tyard/nodes/(-4051,12,-2731).lua b/Tyard/nodes/(-4051,12,-2731).lua
index b8358f2..aad7649 100644
--- a/Tyard/nodes/(-4051,12,-2731).lua
+++ b/Tyard/nodes/(-4051,12,-2731).lua
@@ -1 +1,28 @@
-F.EOL(false) \ No newline at end of file
+--EOL code
+local this_dir = false -- true = F.dir arrow points north
+
+if not F.yard_active() then return end
+if atc_arrow then
+ if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
+ if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
+ F.remove_rc({"TY_LAST_CLASS"})
+ F.add_rc({"TY_DEPART"})
+ split_off_locomotive("A0B0")
+ elseif not F.has_rc("TY_FINAL_COLLECT") then
+ -- disconnect loco and return to pickup
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_PICKUP"})
+ end --if has FINAL_COLLECT then don't split off the loco. take the full rake
+ F.add_rc({"TY_HEADSHUNT"})
+ else --train needs to bounce
+ atc_send("B0WRD1S4")
+ end
+else
+ if F.dir() == this_dir then
+ --train is clasifying wagons, let it pass and couple to the rest of the rake
+ F.remove_rc_match("TY_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
+ F.error(true)
+ end
+end \ No newline at end of file
diff --git a/Tyard/nodes/(-4055,12,-2655).lua b/Tyard/nodes/(-4055,12,-2655).lua
index 747fb3d..f08c2fe 100644
--- a/Tyard/nodes/(-4055,12,-2655).lua
+++ b/Tyard/nodes/(-4055,12,-2655).lua
@@ -1 +1,28 @@
-F.EOL(true) \ No newline at end of file
+--EOL code
+local this_dir = true -- true = F.dir arrow points north
+
+if not F.yard_active() then return end
+if atc_arrow then
+ if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
+ if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
+ F.remove_rc({"TY_LAST_CLASS"})
+ F.add_rc({"TY_DEPART"})
+ split_off_locomotive("A0B0")
+ elseif not F.has_rc("TY_FINAL_COLLECT") then
+ -- disconnect loco and return to pickup
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_PICKUP"})
+ end --if has FINAL_COLLECT then don't split off the loco. take the full rake
+ F.add_rc({"TY_HEADSHUNT"})
+ else --train needs to bounce
+ atc_send("B0WRD1S4")
+ end
+else
+ if F.dir() == this_dir then
+ --train is clasifying wagons, let it pass and couple to the rest of the rake
+ F.remove_rc_match("TY_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
+ F.error(true)
+ end
+end \ No newline at end of file
diff --git a/Tyard/nodes/(-4055,12,-2731).lua b/Tyard/nodes/(-4055,12,-2731).lua
index b8358f2..aad7649 100644
--- a/Tyard/nodes/(-4055,12,-2731).lua
+++ b/Tyard/nodes/(-4055,12,-2731).lua
@@ -1 +1,28 @@
-F.EOL(false) \ No newline at end of file
+--EOL code
+local this_dir = false -- true = F.dir arrow points north
+
+if not F.yard_active() then return end
+if atc_arrow then
+ if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
+ if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
+ F.remove_rc({"TY_LAST_CLASS"})
+ F.add_rc({"TY_DEPART"})
+ split_off_locomotive("A0B0")
+ elseif not F.has_rc("TY_FINAL_COLLECT") then
+ -- disconnect loco and return to pickup
+ split_off_locomotive("A0B0")
+ F.add_rc({"TY_PICKUP"})
+ end --if has FINAL_COLLECT then don't split off the loco. take the full rake
+ F.add_rc({"TY_HEADSHUNT"})
+ else --train needs to bounce
+ atc_send("B0WRD1S4")
+ end
+else
+ if F.dir() == this_dir then
+ --train is clasifying wagons, let it pass and couple to the rest of the rake
+ F.remove_rc_match("TY_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
+ F.error(true)
+ end
+end \ No newline at end of file
diff --git a/Tyard/nodes/(-4100,12,-2742).lua b/Tyard/nodes/(-4100,12,-2742).lua
index 1fc57ae..37b303a 100644
--- a/Tyard/nodes/(-4100,12,-2742).lua
+++ b/Tyard/nodes/(-4100,12,-2742).lua
@@ -13,11 +13,23 @@ end
if event.train then
if not atc_arrow then --train has entered headshunt from yard. bounce or depart
- if not F.has_rc("TY_DEPART") then --if has TY_DEPART then another controller closer to the signal will remove to ensure signal engages the RC
- schedule_in(";01",atc_id)
- atc_set_ars_disable(true)
- return
- end
+ atc_set_ars_disable(true)
+ F.remove_rc({"TY_HEADSHUNT"})
+ if not F.has_rc("TY_FINAL_COLLECT") then
+ if not F.has_rc("TY_DEPART") then
+ schedule_in(";01",atc_id)
+ return
+ else
+ local collect = F.get_rc_safe():match("TY_COLLECT_(%S+)")
+ if collect then --train needs to collect a rake from the yard before departing
+ F.add_rc({"TY_FINAL_COLLECT","TY_CLASS_"..collect})
+ schedule_in(";01",atc_id)
+ return
+ end
+ end
+
+ --else let train proceed forward to the exit controller without a rake
+ end --else train has already collected rake. let it exit yard
else --train has bounced
if F.has_rc("TY_AROUND") then
if this_dir == F.dir() then --send train to Classification
@@ -28,7 +40,6 @@ if event.train then
end --if at wrong end, do nothing. train will follow TY_AROUND ARS to relevant headshunt
end -- if doesn't have TY_AROUND then let ARS classify the train
- F.remove_rc({"TY_HEADSHUNT"})
atc_set_ars_disable(false)
end
return