diff options
Diffstat (limited to 'Tyard')
23 files changed, 108 insertions, 465 deletions
diff --git a/Tyard/init_code.lua b/Tyard/init_code.lua index 9199f26..9b21432 100644 --- a/Tyard/init_code.lua +++ b/Tyard/init_code.lua @@ -72,4 +72,37 @@ F.add_rc = function(rc_list) -- rc_list eg {"rc1","rc2"} OR "rc1 rc2" end set_rc(F.get_rc_safe().." "..rc_list) return true -end
\ No newline at end of file +end + +-- EOL function +F.EOL = function(this_dir) + -- this_dir == true for north end, false for south end + 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_FINAL_COLLECT") then -- take the whole rake to the exit + F.remove({"TY_FINAL_COLLECT"}) + F.add_rc({"TY_DEPART"}) + else -- disconnect loco and return to pickup + split_off_locomotive("A0B0") + F.add_rc({"TY_PICKUP"}) + end + 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 + local rm = {} + for v in F.get_rc_safe():gmatch("(TY_CLASS_%S-)") do + table.insert(rm,v) + end + F.remove_rc(rm) + 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 +end + diff --git a/Tyard/nodes/(-3967,12,-2646).lua b/Tyard/nodes/(-3967,12,-2646).lua index 828ca13..06da983 100644 --- a/Tyard/nodes/(-3967,12,-2646).lua +++ b/Tyard/nodes/(-3967,12,-2646).lua @@ -1,5 +1,6 @@ -- Headshunt Exit Controller -local exit_signal = POS(-3962,14,-2645) +local exit_signal = POS(-4178,15,-2742) --customise to yard specs +if not F.yard_active() then return end __approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) @@ -17,7 +18,9 @@ if event.train then -- set_route(exit_signal,"Exit Yard") atc_send("S6D10SM") -- schedule_in(";05","deactivate_check") + print(F.get_rc_safe()) return + end else atc_send("BBOL") F.error(true) diff --git a/Tyard/nodes/(-4011,12,-2642).lua b/Tyard/nodes/(-4011,12,-2642).lua index 56b9414..6c9932d 100644 --- a/Tyard/nodes/(-4011,12,-2642).lua +++ b/Tyard/nodes/(-4011,12,-2642).lua @@ -3,6 +3,7 @@ local function enter_yard() F.dir(false) F.yard_active(true) + F.add_rc({"TY_ARRIVE"}) atc_set_ars_disable(false) atc_send("S6") return @@ -11,7 +12,7 @@ end __approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) - atc_set_lzb_trs(1) + atc_set_lzb_tsr(1) return end diff --git a/Tyard/nodes/(-4012,12,-2646).lua b/Tyard/nodes/(-4012,12,-2646).lua index b312753..aa2cbfe 100644 --- a/Tyard/nodes/(-4012,12,-2646).lua +++ b/Tyard/nodes/(-4012,12,-2646).lua @@ -2,6 +2,8 @@ -- Note: may need customising due to track layout local this_dir = true -- true = F.dir arrow points north. atc_arrow points towards yard +if not F.yard_active() then return end + __approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) @@ -11,7 +13,6 @@ end if event.train then if not atc_arrow then --train has entered headshunt from yard. bounce or depart - F.remove_rc({"TY_HEADSHUNT"}) 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) @@ -19,20 +20,23 @@ if event.train then end else --train has bounced if F.has_rc("TY_AROUND") then - if this_dir = F.dir() then --send train to Classification + if this_dir == F.dir() then --send train to Classification F.remove_rc({"TY_AROUND"}) F.add_rc({"TY_PICKUP"}) atc_set_ars_disable(false) return 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 end if event.schedule then if not atc_id then --bounce the train that just passed - atc_send_to_train(event.msg,"S0WRD1S3") + atc_send_to_train(event.msg,"S0WRD1S3A1") else if atc_id == event.msg then --train hasn't fully passed yet, wait a bit longer schedule_in(";01",atc_id) diff --git a/Tyard/nodes/(-4027,12,-2655).lua b/Tyard/nodes/(-4027,12,-2655).lua index d6aac1f..5634403 100644 --- a/Tyard/nodes/(-4027,12,-2655).lua +++ b/Tyard/nodes/(-4027,12,-2655).lua @@ -1,13 +1,15 @@ -- Classification track -local this_dir = true -- F.dir arrow points north then this is true +local this_dir = true +-- this_dir == true for north end, false for south end 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 + F.remove_rc({"TY_AROUND"}) if F.has_rc("TY_RTS") then F.dir(not F.dir()) F.remove_rc({"TY_RTS"}) - F.add_rc({"TY_AROUND"}) -- send loco around to the other end + F.add_rc({"TY_HEADSHUNT","TY_AROUND"}) -- send loco around to the other end split_off_locomotive("A0B0") atc_set_ars_disable(false) return @@ -15,23 +17,28 @@ if F.yard_active() then F.remove_rc({"TY_ARRIVE"}) step_fc() end - if this_dir = F.dir() then --train has bounced and is ready to classify wagon(s) + 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 - 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 + if not F.has_rc("TY_LAST_CLASS") then + F.add_rc({"TY_CLASS_"..lane,"TY_LAST_CLASS"}) else - F.add_rc({"TY_FINAL_COLLECT","TY_CLASS_"..collect}) --loco is to collect lane before departing. TY_DEPART to be set by EOL + 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 end F.add_rc({"TY_HEADSHUNT"}) atc_set_ars_disable(false) + set_autocouple() else --bounce train back towards working end - atc_send("S0WRD1S3A1") + atc_send("S0WRD1S3") unset_autocouple() end else -- train entering from the far end. set autocouple so it pushes all the way through to the bounce diff --git a/Tyard/nodes/(-4027,12,-2731).lua b/Tyard/nodes/(-4027,12,-2731).lua index 9968850..e703257 100644 --- a/Tyard/nodes/(-4027,12,-2731).lua +++ b/Tyard/nodes/(-4027,12,-2731).lua @@ -1,13 +1,15 @@ -- Classification track -local this_dir = false -- F.dir arrow points north then this is true +local this_dir = false +-- this_dir == true for north end, false for south end 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 + F.remove_rc({"TY_AROUND"}) if F.has_rc("TY_RTS") then F.dir(not F.dir()) F.remove_rc({"TY_RTS"}) - F.add_rc({"TY_AROUND"}) -- send loco around to the other end + F.add_rc({"TY_HEADSHUNT","TY_AROUND"}) -- send loco around to the other end split_off_locomotive("A0B0") atc_set_ars_disable(false) return @@ -15,23 +17,28 @@ if F.yard_active() then F.remove_rc({"TY_ARRIVE"}) step_fc() end - if this_dir = F.dir() then --train has bounced and is ready to classify wagon(s) + 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 - 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 + if not F.has_rc("TY_LAST_CLASS") then + F.add_rc({"TY_CLASS_"..lane,"TY_LAST_CLASS"}) else - F.add_rc({"TY_FINAL_COLLECT","TY_CLASS_"..collect}) --loco is to collect lane before departing. TY_DEPART to be set by EOL + 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 end F.add_rc({"TY_HEADSHUNT"}) atc_set_ars_disable(false) + set_autocouple() else --bounce train back towards working end - atc_send("S0WRD1S3A1") + atc_send("S0WRD1S3") unset_autocouple() end else -- train entering from the far end. set autocouple so it pushes all the way through to the bounce diff --git a/Tyard/nodes/(-4031,12,-2655).lua b/Tyard/nodes/(-4031,12,-2655).lua index 91291bf..747fb3d 100644 --- a/Tyard/nodes/(-4031,12,-2655).lua +++ b/Tyard/nodes/(-4031,12,-2655).lua @@ -1,31 +1 @@ ---EOL code -local this_dir = true -- true = F.dir arrow points north - -if F.yard_active() then - 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_FINAL_COLLECT") then -- take the whole rake to the exit - F.remove({"TY_FINAL_COLLECT") - F.add_rc({"TY_DEPART"}) - else -- disconnect loco and return to pickup - split_off_locomotive("A0B0") - F.add_rc({"TY_PICKUP"}) - end - 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 - local rm = {} - for v in F.get_rc_safe():gmatch("(TY_CLASS_%S+)") do - table.insert(rm,v) - end - F.remove_rc(rm) - 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 -end
\ No newline at end of file +F.EOL(true)
\ No newline at end of file diff --git a/Tyard/nodes/(-4031,12,-2731).lua b/Tyard/nodes/(-4031,12,-2731).lua index 5c809b6..b8358f2 100644 --- a/Tyard/nodes/(-4031,12,-2731).lua +++ b/Tyard/nodes/(-4031,12,-2731).lua @@ -1,31 +1 @@ ---EOL code -local this_dir = false -- true = F.dir arrow points north - -if F.yard_active() then - 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_FINAL_COLLECT") then -- take the whole rake to the exit - F.remove({"TY_FINAL_COLLECT") - F.add_rc({"TY_DEPART"}) - else -- disconnect loco and return to pickup - split_off_locomotive("A0B0") - F.add_rc({"TY_PICKUP"}) - end - 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 - local rm = {} - for v in F.get_rc_safe():gmatch("(TY_CLASS_%S+)") do - table.insert(rm,v) - end - F.remove_rc(rm) - 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 -end
\ No newline at end of file +F.EOL(false)
\ No newline at end of file diff --git a/Tyard/nodes/(-4035,12,-2655).lua b/Tyard/nodes/(-4035,12,-2655).lua index 91291bf..747fb3d 100644 --- a/Tyard/nodes/(-4035,12,-2655).lua +++ b/Tyard/nodes/(-4035,12,-2655).lua @@ -1,31 +1 @@ ---EOL code -local this_dir = true -- true = F.dir arrow points north - -if F.yard_active() then - 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_FINAL_COLLECT") then -- take the whole rake to the exit - F.remove({"TY_FINAL_COLLECT") - F.add_rc({"TY_DEPART"}) - else -- disconnect loco and return to pickup - split_off_locomotive("A0B0") - F.add_rc({"TY_PICKUP"}) - end - 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 - local rm = {} - for v in F.get_rc_safe():gmatch("(TY_CLASS_%S+)") do - table.insert(rm,v) - end - F.remove_rc(rm) - 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 -end
\ No newline at end of file +F.EOL(true)
\ No newline at end of file diff --git a/Tyard/nodes/(-4035,12,-2731).lua b/Tyard/nodes/(-4035,12,-2731).lua index 5c809b6..b8358f2 100644 --- a/Tyard/nodes/(-4035,12,-2731).lua +++ b/Tyard/nodes/(-4035,12,-2731).lua @@ -1,31 +1 @@ ---EOL code -local this_dir = false -- true = F.dir arrow points north - -if F.yard_active() then - 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_FINAL_COLLECT") then -- take the whole rake to the exit - F.remove({"TY_FINAL_COLLECT") - F.add_rc({"TY_DEPART"}) - else -- disconnect loco and return to pickup - split_off_locomotive("A0B0") - F.add_rc({"TY_PICKUP"}) - end - 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 - local rm = {} - for v in F.get_rc_safe():gmatch("(TY_CLASS_%S+)") do - table.insert(rm,v) - end - F.remove_rc(rm) - 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 -end
\ No newline at end of file +F.EOL(false)
\ No newline at end of file diff --git a/Tyard/nodes/(-4039,12,-2655).lua b/Tyard/nodes/(-4039,12,-2655).lua index 91291bf..747fb3d 100644 --- a/Tyard/nodes/(-4039,12,-2655).lua +++ b/Tyard/nodes/(-4039,12,-2655).lua @@ -1,31 +1 @@ ---EOL code -local this_dir = true -- true = F.dir arrow points north - -if F.yard_active() then - 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_FINAL_COLLECT") then -- take the whole rake to the exit - F.remove({"TY_FINAL_COLLECT") - F.add_rc({"TY_DEPART"}) - else -- disconnect loco and return to pickup - split_off_locomotive("A0B0") - F.add_rc({"TY_PICKUP"}) - end - 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 - local rm = {} - for v in F.get_rc_safe():gmatch("(TY_CLASS_%S+)") do - table.insert(rm,v) - end - F.remove_rc(rm) - 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 -end
\ No newline at end of file +F.EOL(true)
\ No newline at end of file diff --git a/Tyard/nodes/(-4039,12,-2731).lua b/Tyard/nodes/(-4039,12,-2731).lua index 5c809b6..b8358f2 100644 --- a/Tyard/nodes/(-4039,12,-2731).lua +++ b/Tyard/nodes/(-4039,12,-2731).lua @@ -1,31 +1 @@ ---EOL code -local this_dir = false -- true = F.dir arrow points north - -if F.yard_active() then - 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_FINAL_COLLECT") then -- take the whole rake to the exit - F.remove({"TY_FINAL_COLLECT") - F.add_rc({"TY_DEPART"}) - else -- disconnect loco and return to pickup - split_off_locomotive("A0B0") - F.add_rc({"TY_PICKUP"}) - end - 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 - local rm = {} - for v in F.get_rc_safe():gmatch("(TY_CLASS_%S+)") do - table.insert(rm,v) - end - F.remove_rc(rm) - 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 -end
\ No newline at end of file +F.EOL(false)
\ No newline at end of file diff --git a/Tyard/nodes/(-4043,12,-2655).lua b/Tyard/nodes/(-4043,12,-2655).lua index 91291bf..747fb3d 100644 --- a/Tyard/nodes/(-4043,12,-2655).lua +++ b/Tyard/nodes/(-4043,12,-2655).lua @@ -1,31 +1 @@ ---EOL code -local this_dir = true -- true = F.dir arrow points north - -if F.yard_active() then - 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_FINAL_COLLECT") then -- take the whole rake to the exit - F.remove({"TY_FINAL_COLLECT") - F.add_rc({"TY_DEPART"}) - else -- disconnect loco and return to pickup - split_off_locomotive("A0B0") - F.add_rc({"TY_PICKUP"}) - end - 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 - local rm = {} - for v in F.get_rc_safe():gmatch("(TY_CLASS_%S+)") do - table.insert(rm,v) - end - F.remove_rc(rm) - 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 -end
\ No newline at end of file +F.EOL(true)
\ No newline at end of file diff --git a/Tyard/nodes/(-4043,12,-2731).lua b/Tyard/nodes/(-4043,12,-2731).lua index 5c809b6..b8358f2 100644 --- a/Tyard/nodes/(-4043,12,-2731).lua +++ b/Tyard/nodes/(-4043,12,-2731).lua @@ -1,31 +1 @@ ---EOL code -local this_dir = false -- true = F.dir arrow points north - -if F.yard_active() then - 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_FINAL_COLLECT") then -- take the whole rake to the exit - F.remove({"TY_FINAL_COLLECT") - F.add_rc({"TY_DEPART"}) - else -- disconnect loco and return to pickup - split_off_locomotive("A0B0") - F.add_rc({"TY_PICKUP"}) - end - 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 - local rm = {} - for v in F.get_rc_safe():gmatch("(TY_CLASS_%S+)") do - table.insert(rm,v) - end - F.remove_rc(rm) - 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 -end
\ No newline at end of file +F.EOL(false)
\ No newline at end of file diff --git a/Tyard/nodes/(-4047,12,-2655).lua b/Tyard/nodes/(-4047,12,-2655).lua index 91291bf..747fb3d 100644 --- a/Tyard/nodes/(-4047,12,-2655).lua +++ b/Tyard/nodes/(-4047,12,-2655).lua @@ -1,31 +1 @@ ---EOL code -local this_dir = true -- true = F.dir arrow points north - -if F.yard_active() then - 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_FINAL_COLLECT") then -- take the whole rake to the exit - F.remove({"TY_FINAL_COLLECT") - F.add_rc({"TY_DEPART"}) - else -- disconnect loco and return to pickup - split_off_locomotive("A0B0") - F.add_rc({"TY_PICKUP"}) - end - 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 - local rm = {} - for v in F.get_rc_safe():gmatch("(TY_CLASS_%S+)") do - table.insert(rm,v) - end - F.remove_rc(rm) - 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 -end
\ No newline at end of file +F.EOL(true)
\ No newline at end of file diff --git a/Tyard/nodes/(-4047,12,-2731).lua b/Tyard/nodes/(-4047,12,-2731).lua index 5c809b6..b8358f2 100644 --- a/Tyard/nodes/(-4047,12,-2731).lua +++ b/Tyard/nodes/(-4047,12,-2731).lua @@ -1,31 +1 @@ ---EOL code -local this_dir = false -- true = F.dir arrow points north - -if F.yard_active() then - 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_FINAL_COLLECT") then -- take the whole rake to the exit - F.remove({"TY_FINAL_COLLECT") - F.add_rc({"TY_DEPART"}) - else -- disconnect loco and return to pickup - split_off_locomotive("A0B0") - F.add_rc({"TY_PICKUP"}) - end - 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 - local rm = {} - for v in F.get_rc_safe():gmatch("(TY_CLASS_%S+)") do - table.insert(rm,v) - end - F.remove_rc(rm) - 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 -end
\ No newline at end of file +F.EOL(false)
\ No newline at end of file diff --git a/Tyard/nodes/(-4051,12,-2655).lua b/Tyard/nodes/(-4051,12,-2655).lua index 91291bf..747fb3d 100644 --- a/Tyard/nodes/(-4051,12,-2655).lua +++ b/Tyard/nodes/(-4051,12,-2655).lua @@ -1,31 +1 @@ ---EOL code -local this_dir = true -- true = F.dir arrow points north - -if F.yard_active() then - 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_FINAL_COLLECT") then -- take the whole rake to the exit - F.remove({"TY_FINAL_COLLECT") - F.add_rc({"TY_DEPART"}) - else -- disconnect loco and return to pickup - split_off_locomotive("A0B0") - F.add_rc({"TY_PICKUP"}) - end - 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 - local rm = {} - for v in F.get_rc_safe():gmatch("(TY_CLASS_%S+)") do - table.insert(rm,v) - end - F.remove_rc(rm) - 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 -end
\ No newline at end of file +F.EOL(true)
\ No newline at end of file diff --git a/Tyard/nodes/(-4051,12,-2731).lua b/Tyard/nodes/(-4051,12,-2731).lua index 5c809b6..b8358f2 100644 --- a/Tyard/nodes/(-4051,12,-2731).lua +++ b/Tyard/nodes/(-4051,12,-2731).lua @@ -1,31 +1 @@ ---EOL code -local this_dir = false -- true = F.dir arrow points north - -if F.yard_active() then - 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_FINAL_COLLECT") then -- take the whole rake to the exit - F.remove({"TY_FINAL_COLLECT") - F.add_rc({"TY_DEPART"}) - else -- disconnect loco and return to pickup - split_off_locomotive("A0B0") - F.add_rc({"TY_PICKUP"}) - end - 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 - local rm = {} - for v in F.get_rc_safe():gmatch("(TY_CLASS_%S+)") do - table.insert(rm,v) - end - F.remove_rc(rm) - 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 -end
\ No newline at end of file +F.EOL(false)
\ No newline at end of file diff --git a/Tyard/nodes/(-4055,12,-2655).lua b/Tyard/nodes/(-4055,12,-2655).lua index 91291bf..747fb3d 100644 --- a/Tyard/nodes/(-4055,12,-2655).lua +++ b/Tyard/nodes/(-4055,12,-2655).lua @@ -1,31 +1 @@ ---EOL code -local this_dir = true -- true = F.dir arrow points north - -if F.yard_active() then - 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_FINAL_COLLECT") then -- take the whole rake to the exit - F.remove({"TY_FINAL_COLLECT") - F.add_rc({"TY_DEPART"}) - else -- disconnect loco and return to pickup - split_off_locomotive("A0B0") - F.add_rc({"TY_PICKUP"}) - end - 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 - local rm = {} - for v in F.get_rc_safe():gmatch("(TY_CLASS_%S+)") do - table.insert(rm,v) - end - F.remove_rc(rm) - 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 -end
\ No newline at end of file +F.EOL(true)
\ No newline at end of file diff --git a/Tyard/nodes/(-4055,12,-2731).lua b/Tyard/nodes/(-4055,12,-2731).lua index 5c809b6..b8358f2 100644 --- a/Tyard/nodes/(-4055,12,-2731).lua +++ b/Tyard/nodes/(-4055,12,-2731).lua @@ -1,31 +1 @@ ---EOL code -local this_dir = false -- true = F.dir arrow points north - -if F.yard_active() then - 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_FINAL_COLLECT") then -- take the whole rake to the exit - F.remove({"TY_FINAL_COLLECT") - F.add_rc({"TY_DEPART"}) - else -- disconnect loco and return to pickup - split_off_locomotive("A0B0") - F.add_rc({"TY_PICKUP"}) - end - 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 - local rm = {} - for v in F.get_rc_safe():gmatch("(TY_CLASS_%S+)") do - table.insert(rm,v) - end - F.remove_rc(rm) - 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 -end
\ No newline at end of file +F.EOL(false)
\ No newline at end of file diff --git a/Tyard/nodes/(-4100,12,-2742).lua b/Tyard/nodes/(-4100,12,-2742).lua index ecc670f..1fc57ae 100644 --- a/Tyard/nodes/(-4100,12,-2742).lua +++ b/Tyard/nodes/(-4100,12,-2742).lua @@ -2,6 +2,8 @@ -- Note: may need customising due to track layout local this_dir = false -- true = F.dir arrow points north. atc_arrow points towards yard +if not F.yard_active() then return end + __approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) @@ -11,7 +13,6 @@ end if event.train then if not atc_arrow then --train has entered headshunt from yard. bounce or depart - F.remove_rc({"TY_HEADSHUNT"}) 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) @@ -19,20 +20,23 @@ if event.train then end else --train has bounced if F.has_rc("TY_AROUND") then - if this_dir = F.dir() then --send train to Classification + if this_dir == F.dir() then --send train to Classification F.remove_rc({"TY_AROUND"}) F.add_rc({"TY_PICKUP"}) atc_set_ars_disable(false) return 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 end if event.schedule then if not atc_id then --bounce the train that just passed - atc_send_to_train(event.msg,"S0WRD1S3") + atc_send_to_train(event.msg,"S0WRD1S3A1") else if atc_id == event.msg then --train hasn't fully passed yet, wait a bit longer schedule_in(";01",atc_id) diff --git a/Tyard/nodes/(-4100,12,-2745).lua b/Tyard/nodes/(-4100,12,-2745).lua index 16007e9..bd4ff7e 100644 --- a/Tyard/nodes/(-4100,12,-2745).lua +++ b/Tyard/nodes/(-4100,12,-2745).lua @@ -1,7 +1,9 @@ -- Yard arrival checker +-- F.dir = true if entering from south local function enter_yard() F.dir(true) F.yard_active(true) + F.add_rc({"TY_ARRIVE"}) atc_set_ars_disable(false) atc_send("S6") return @@ -10,7 +12,7 @@ end __approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) - atc_set_lzb_trs(1) + atc_set_lzb_tsr(1) return end diff --git a/Tyard/nodes/(-4167,12,-2742).lua b/Tyard/nodes/(-4167,12,-2742).lua index a1ad270..06da983 100644 --- a/Tyard/nodes/(-4167,12,-2742).lua +++ b/Tyard/nodes/(-4167,12,-2742).lua @@ -1,5 +1,6 @@ -- Headshunt Exit Controller -local exit_signal = POS(-4178,15,-2742) +local exit_signal = POS(-4178,15,-2742) --customise to yard specs +if not F.yard_active() then return end __approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) @@ -11,14 +12,15 @@ if event.train then if atc_arrow then if F.has_rc("TY_DEPART") then print("Train departs yard to mainline at full speed") - --[[ + F.remove_rc({"TY_DEPART"}) atc_set_ars_disable(false) - set_route(exit_signal,"Exit Yard") + -- set_route(exit_signal,"Exit Yard") atc_send("S6D10SM") - schedule_in(";05","deactivate_check") + -- schedule_in(";05","deactivate_check") + print(F.get_rc_safe()) return - ]]-- + end else atc_send("BBOL") F.error(true) |