diff options
Diffstat (limited to 'Tyard/nodes')
36 files changed, 168 insertions, 17 deletions
diff --git a/Tyard/nodes/(-4011,12,-2642).lua b/Tyard/nodes/(-4011,12,-2642).lua index 81a963d..d263812 100644 --- a/Tyard/nodes/(-4011,12,-2642).lua +++ b/Tyard/nodes/(-4011,12,-2642).lua @@ -1 +1,33 @@ -if S.yard_active and atc_arrow then set_autocouple() end
\ No newline at end of file +-- Yard arrival checker +local function enter_yard() + F.dir(false) + F.yard_active(true) + atc_set_ars_disable(false) + atc_send("S6") + return +end + +__approach_callback_mode = 1 +if event.approach and not event.has_entered then + atc_set_ars_disable(true) + atc_set_lzb_trs(1) + return +end + +if event.train then + if F.yard_active() then + schedule_in(";10","recheck") + return + else + enter_yard() + end +end + +if event.schedule then + if F.yard_active() then + schedule_in(";10","recheck") + return + else + enter_yard() + end +end
\ No newline at end of file diff --git a/Tyard/nodes/(-4011,12,-2647).lua b/Tyard/nodes/(-4011,12,-2647).lua new file mode 100644 index 0000000..3c9efc3 --- /dev/null +++ b/Tyard/nodes/(-4011,12,-2647).lua @@ -0,0 +1 @@ +--arrow points into yard
-- config'd for Southbound entrance (North end of yard)
local dir = "N"
local entrance_signal = "Tyard_Enter_"..dir
-- train enters from mainline. stop at signal to be safe
if event.train and atc_arrow then atc_send("B0") end
if atc_arrow then
local rc = get_rc() or ""
-- allow for manual working
if rc:match("TYARD_NOSHUNT") then return end
if S.yard_active then -- send train to "waiting"
if can_set_route(entrance_signal,"WAITING") then
set_route(entrance_signal,"WAITING")
atc_set_text_outside("Waiting for yard to clear")
atc_send("S6")
else
interrupt(5,"recheck")
end
else -- send train to "pickup"
S.yard_active = true
step_fc()
local rc = get_rc() or ""
S.rc = rc
--check for RTS
if S.single_dir == true or S.rc:match("TY_RTS") then
S.dir = dir
--working end = entrance dir
S.RTS = true
set_rc("AROUND_"..S.dir)
else
--invert S.dir
--working end ~= entrance end
if dir == "N" then
S.dir = "S"
else
S.dir = "N"
end
end
set_route(entrance_signal,"PICKUP")
atc_set_text_outside("Proceeding to Classification Yard")
atc_send("S4")
end
else -- train exiting
set_rc(S.rc)
S.yard_active = nil
S.rc = nil
S.dir = nil
unset_autocouple()
atc_send("SM")
end
\ No newline at end of file diff --git a/Tyard/nodes/(-4012,12,-2646).lua b/Tyard/nodes/(-4012,12,-2646).lua new file mode 100644 index 0000000..5199847 --- /dev/null +++ b/Tyard/nodes/(-4012,12,-2646).lua @@ -0,0 +1 @@ +-- Headshunt / Exit controller
\ No newline at end of file diff --git a/Tyard/nodes/(-4027,12,-2655).lua b/Tyard/nodes/(-4027,12,-2655).lua index 39f9b81..136f70b 100644 --- a/Tyard/nodes/(-4027,12,-2655).lua +++ b/Tyard/nodes/(-4027,12,-2655).lua @@ -1 +1,35 @@ ---North pickup splitter
local dir = "N"
local lane = 0
--nothing below this line should indicate a hard direction
--should be able to convert to function using only above args
--------------------------------------------------
if S.yard_active then
if atc_arrow then
if S.dir == dir then
set_route("TY"..dir.."_"..lane, "HEADSHUNT")
local plen = train_length()
local rc = split_at_fc("B0")
local trc = "TY"..dir.."_"..rc
if plen == train_length() and (rc == "" or S.rc:match(trc)) then
S.exiting = true
end
if rc and rc ~= "" then
set_rc("TY"..dir.."_"..rc)
else
set_rc(S.rc)
S.exiting = true
end
else -- if S.dir ~= dir
if S.RTS then -- loop around to other HS
S.RTS = nil
set_route("TY"..dir.."_"..lane,"AROUND")
split_off_locomotive("B0")
set_rc("AROUND_"..S.dir)
return
else
atc_send("B0WRS4")
end
end
end -- nothing to do if train goes against arrow
end
\ No newline at end of file +-- Classification track +local this_dir = true -- true = F.dir arrow points north +if F.yard_active() then + if atc_arrow then -- train is at working end + if F.has_rc("TY_arrive") then --first pass + if F.has_rc("TY_RTS") then + F.dir(not F.dir()) + F.remove_rc({"TY_RTS"}) + F.add_rc({"TY_AROUND","TY_WYE"}) --need to add direction selection in the southern headshunt controller + split_off_locomotive("A0B0") + atc_set_ars_disable(false) + return + 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 --> local remove = {} for v in F.get_rc_safe():gmatch("(TY_CLASS_*)") do table.insert(remove,v) end F.remove_rc(remove) + atc_set_ars_disable(false) + else + F.add_rc({"TY_DEPART"}) + atc_set_ars_disable(false) + --send train to collect relevant wagon group and depart + end + else --bounce train back towards working end + 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 + set_autocouple() + end +end
\ No newline at end of file diff --git a/Tyard/nodes/(-4027,12,-2731).lua b/Tyard/nodes/(-4027,12,-2731).lua index b04ffad..2b91223 100644 --- a/Tyard/nodes/(-4027,12,-2731).lua +++ b/Tyard/nodes/(-4027,12,-2731).lua @@ -1 +1,35 @@ ---South pickup splitter
local dir = "S"
local lane = 0
--nothing below this line should indicate a hard direction
--should be able to convert to function using only above args
--------------------------------------------------
if S.yard_active then
if atc_arrow then
if S.dir == dir then
set_route("TY"..dir.."_"..lane, "HEADSHUNT")
local plen = train_length()
local rc = split_at_fc("B0")
local trc = "TY"..dir.."_"..rc
if plen == train_length() and (rc == "" or S.rc:match(trc)) then
S.exiting = true
end
if rc and rc ~= "" then
set_rc("TY"..dir.."_"..rc)
else
set_rc(S.rc)
S.exiting = true
end
else -- if S.dir ~= dir
if S.RTS then -- loop around to other HS
S.RTS = nil
set_route("TY"..dir.."_"..lane,"AROUND")
split_off_locomotive("B0")
set_rc("AROUND_"..S.dir)
return
else
atc_send("B0WRS4")
end
end
end -- nothing to do if train goes against arrow
end
\ No newline at end of file +-- Classification track +local this_dir = false -- true = F.dir arrow points north +if F.yard_active() then + if atc_arrow then -- train is at working end + if F.has_rc("TY_arrive") then --first pass + if F.has_rc("TY_RTS") then + F.dir(not F.dir()) + F.remove_rc({"TY_RTS"}) + F.add_rc({"TY_AROUND","TY_WYE"}) --need to add direction selection in the southern headshunt controller + split_off_locomotive("A0B0") + atc_set_ars_disable(false) + return + 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 --> local remove = {} for v in F.get_rc_safe():gmatch("(TY_CLASS_*)") do table.insert(remove,v) end F.remove_rc(remove) + atc_set_ars_disable(false) + else + F.add_rc({"TY_DEPART"}) + atc_set_ars_disable(false) + --send train to collect relevant wagon group and depart + end + else --bounce train back towards working end + 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 + set_autocouple() + end +end
\ No newline at end of file diff --git a/Tyard/nodes/(-4028,12,-2655).lua b/Tyard/nodes/(-4028,12,-2655).lua new file mode 100644 index 0000000..39f9b81 --- /dev/null +++ b/Tyard/nodes/(-4028,12,-2655).lua @@ -0,0 +1 @@ +--North pickup splitter
local dir = "N"
local lane = 0
--nothing below this line should indicate a hard direction
--should be able to convert to function using only above args
--------------------------------------------------
if S.yard_active then
if atc_arrow then
if S.dir == dir then
set_route("TY"..dir.."_"..lane, "HEADSHUNT")
local plen = train_length()
local rc = split_at_fc("B0")
local trc = "TY"..dir.."_"..rc
if plen == train_length() and (rc == "" or S.rc:match(trc)) then
S.exiting = true
end
if rc and rc ~= "" then
set_rc("TY"..dir.."_"..rc)
else
set_rc(S.rc)
S.exiting = true
end
else -- if S.dir ~= dir
if S.RTS then -- loop around to other HS
S.RTS = nil
set_route("TY"..dir.."_"..lane,"AROUND")
split_off_locomotive("B0")
set_rc("AROUND_"..S.dir)
return
else
atc_send("B0WRS4")
end
end
end -- nothing to do if train goes against arrow
end
\ No newline at end of file diff --git a/Tyard/nodes/(-4028,12,-2731).lua b/Tyard/nodes/(-4028,12,-2731).lua new file mode 100644 index 0000000..b04ffad --- /dev/null +++ b/Tyard/nodes/(-4028,12,-2731).lua @@ -0,0 +1 @@ +--South pickup splitter
local dir = "S"
local lane = 0
--nothing below this line should indicate a hard direction
--should be able to convert to function using only above args
--------------------------------------------------
if S.yard_active then
if atc_arrow then
if S.dir == dir then
set_route("TY"..dir.."_"..lane, "HEADSHUNT")
local plen = train_length()
local rc = split_at_fc("B0")
local trc = "TY"..dir.."_"..rc
if plen == train_length() and (rc == "" or S.rc:match(trc)) then
S.exiting = true
end
if rc and rc ~= "" then
set_rc("TY"..dir.."_"..rc)
else
set_rc(S.rc)
S.exiting = true
end
else -- if S.dir ~= dir
if S.RTS then -- loop around to other HS
S.RTS = nil
set_route("TY"..dir.."_"..lane,"AROUND")
split_off_locomotive("B0")
set_rc("AROUND_"..S.dir)
return
else
atc_send("B0WRS4")
end
end
end -- nothing to do if train goes against arrow
end
\ No newline at end of file diff --git a/Tyard/nodes/(-4031,12,-2655).lua b/Tyard/nodes/(-4031,12,-2655).lua index b6c6d60..7489acc 100644 --- a/Tyard/nodes/(-4031,12,-2655).lua +++ b/Tyard/nodes/(-4031,12,-2655).lua @@ -1 +1 @@ -F.EOL("N",1)
\ No newline at end of file +--
\ No newline at end of file diff --git a/Tyard/nodes/(-4031,12,-2731).lua b/Tyard/nodes/(-4031,12,-2731).lua index c4c1959..7489acc 100644 --- a/Tyard/nodes/(-4031,12,-2731).lua +++ b/Tyard/nodes/(-4031,12,-2731).lua @@ -1 +1 @@ -F.EOL("S",1)
\ No newline at end of file +--
\ No newline at end of file diff --git a/Tyard/nodes/(-4032,12,-2655).lua b/Tyard/nodes/(-4032,12,-2655).lua new file mode 100644 index 0000000..b6c6d60 --- /dev/null +++ b/Tyard/nodes/(-4032,12,-2655).lua @@ -0,0 +1 @@ +F.EOL("N",1)
\ No newline at end of file diff --git a/Tyard/nodes/(-4032,12,-2731).lua b/Tyard/nodes/(-4032,12,-2731).lua new file mode 100644 index 0000000..c4c1959 --- /dev/null +++ b/Tyard/nodes/(-4032,12,-2731).lua @@ -0,0 +1 @@ +F.EOL("S",1)
\ No newline at end of file diff --git a/Tyard/nodes/(-4035,12,-2655).lua b/Tyard/nodes/(-4035,12,-2655).lua index 3fd7dcb..7489acc 100644 --- a/Tyard/nodes/(-4035,12,-2655).lua +++ b/Tyard/nodes/(-4035,12,-2655).lua @@ -1 +1 @@ -F.EOL("N",2)
\ No newline at end of file +--
\ No newline at end of file diff --git a/Tyard/nodes/(-4035,12,-2731).lua b/Tyard/nodes/(-4035,12,-2731).lua index f15a717..7489acc 100644 --- a/Tyard/nodes/(-4035,12,-2731).lua +++ b/Tyard/nodes/(-4035,12,-2731).lua @@ -1 +1 @@ -F.EOL("S",2)
\ No newline at end of file +--
\ No newline at end of file diff --git a/Tyard/nodes/(-4036,12,-2655).lua b/Tyard/nodes/(-4036,12,-2655).lua new file mode 100644 index 0000000..3fd7dcb --- /dev/null +++ b/Tyard/nodes/(-4036,12,-2655).lua @@ -0,0 +1 @@ +F.EOL("N",2)
\ No newline at end of file diff --git a/Tyard/nodes/(-4036,12,-2731).lua b/Tyard/nodes/(-4036,12,-2731).lua new file mode 100644 index 0000000..f15a717 --- /dev/null +++ b/Tyard/nodes/(-4036,12,-2731).lua @@ -0,0 +1 @@ +F.EOL("S",2)
\ No newline at end of file diff --git a/Tyard/nodes/(-4039,12,-2655).lua b/Tyard/nodes/(-4039,12,-2655).lua index 592871f..7489acc 100644 --- a/Tyard/nodes/(-4039,12,-2655).lua +++ b/Tyard/nodes/(-4039,12,-2655).lua @@ -1 +1 @@ -F.EOL("N",3)
\ No newline at end of file +--
\ No newline at end of file diff --git a/Tyard/nodes/(-4039,12,-2731).lua b/Tyard/nodes/(-4039,12,-2731).lua index af4c22e..7489acc 100644 --- a/Tyard/nodes/(-4039,12,-2731).lua +++ b/Tyard/nodes/(-4039,12,-2731).lua @@ -1 +1 @@ -F.EOL("S",3)
\ No newline at end of file +--
\ No newline at end of file diff --git a/Tyard/nodes/(-4040,12,-2655).lua b/Tyard/nodes/(-4040,12,-2655).lua new file mode 100644 index 0000000..592871f --- /dev/null +++ b/Tyard/nodes/(-4040,12,-2655).lua @@ -0,0 +1 @@ +F.EOL("N",3)
\ No newline at end of file diff --git a/Tyard/nodes/(-4040,12,-2731).lua b/Tyard/nodes/(-4040,12,-2731).lua new file mode 100644 index 0000000..af4c22e --- /dev/null +++ b/Tyard/nodes/(-4040,12,-2731).lua @@ -0,0 +1 @@ +F.EOL("S",3)
\ No newline at end of file diff --git a/Tyard/nodes/(-4043,12,-2655).lua b/Tyard/nodes/(-4043,12,-2655).lua index c86923a..7489acc 100644 --- a/Tyard/nodes/(-4043,12,-2655).lua +++ b/Tyard/nodes/(-4043,12,-2655).lua @@ -1 +1 @@ -F.EOL("N",4)
\ No newline at end of file +--
\ No newline at end of file diff --git a/Tyard/nodes/(-4043,12,-2731).lua b/Tyard/nodes/(-4043,12,-2731).lua index 9227db4..7489acc 100644 --- a/Tyard/nodes/(-4043,12,-2731).lua +++ b/Tyard/nodes/(-4043,12,-2731).lua @@ -1 +1 @@ -F.EOL("S",4)
\ No newline at end of file +--
\ No newline at end of file diff --git a/Tyard/nodes/(-4044,12,-2655).lua b/Tyard/nodes/(-4044,12,-2655).lua new file mode 100644 index 0000000..c86923a --- /dev/null +++ b/Tyard/nodes/(-4044,12,-2655).lua @@ -0,0 +1 @@ +F.EOL("N",4)
\ No newline at end of file diff --git a/Tyard/nodes/(-4044,12,-2731).lua b/Tyard/nodes/(-4044,12,-2731).lua new file mode 100644 index 0000000..9227db4 --- /dev/null +++ b/Tyard/nodes/(-4044,12,-2731).lua @@ -0,0 +1 @@ +F.EOL("S",4)
\ No newline at end of file diff --git a/Tyard/nodes/(-4047,12,-2655).lua b/Tyard/nodes/(-4047,12,-2655).lua index 3ce2888..7489acc 100644 --- a/Tyard/nodes/(-4047,12,-2655).lua +++ b/Tyard/nodes/(-4047,12,-2655).lua @@ -1 +1 @@ -F.EOL("N",5)
\ No newline at end of file +--
\ No newline at end of file diff --git a/Tyard/nodes/(-4047,12,-2731).lua b/Tyard/nodes/(-4047,12,-2731).lua index e953f0e..7489acc 100644 --- a/Tyard/nodes/(-4047,12,-2731).lua +++ b/Tyard/nodes/(-4047,12,-2731).lua @@ -1 +1 @@ -F.EOL("S",5)
\ No newline at end of file +--
\ No newline at end of file diff --git a/Tyard/nodes/(-4048,12,-2655).lua b/Tyard/nodes/(-4048,12,-2655).lua new file mode 100644 index 0000000..3ce2888 --- /dev/null +++ b/Tyard/nodes/(-4048,12,-2655).lua @@ -0,0 +1 @@ +F.EOL("N",5)
\ No newline at end of file diff --git a/Tyard/nodes/(-4048,12,-2731).lua b/Tyard/nodes/(-4048,12,-2731).lua new file mode 100644 index 0000000..e953f0e --- /dev/null +++ b/Tyard/nodes/(-4048,12,-2731).lua @@ -0,0 +1 @@ +F.EOL("S",5)
\ No newline at end of file diff --git a/Tyard/nodes/(-4051,12,-2655).lua b/Tyard/nodes/(-4051,12,-2655).lua index 9e4298b..7489acc 100644 --- a/Tyard/nodes/(-4051,12,-2655).lua +++ b/Tyard/nodes/(-4051,12,-2655).lua @@ -1 +1 @@ -F.EOL("N",6)
\ No newline at end of file +--
\ No newline at end of file diff --git a/Tyard/nodes/(-4051,12,-2731).lua b/Tyard/nodes/(-4051,12,-2731).lua index 2fc4fc5..7489acc 100644 --- a/Tyard/nodes/(-4051,12,-2731).lua +++ b/Tyard/nodes/(-4051,12,-2731).lua @@ -1 +1 @@ -F.EOL("S",6)
\ No newline at end of file +--
\ No newline at end of file diff --git a/Tyard/nodes/(-4052,12,-2655).lua b/Tyard/nodes/(-4052,12,-2655).lua new file mode 100644 index 0000000..9e4298b --- /dev/null +++ b/Tyard/nodes/(-4052,12,-2655).lua @@ -0,0 +1 @@ +F.EOL("N",6)
\ No newline at end of file diff --git a/Tyard/nodes/(-4052,12,-2731).lua b/Tyard/nodes/(-4052,12,-2731).lua new file mode 100644 index 0000000..2fc4fc5 --- /dev/null +++ b/Tyard/nodes/(-4052,12,-2731).lua @@ -0,0 +1 @@ +F.EOL("S",6)
\ No newline at end of file diff --git a/Tyard/nodes/(-4055,12,-2655).lua b/Tyard/nodes/(-4055,12,-2655).lua index 4113ece..7489acc 100644 --- a/Tyard/nodes/(-4055,12,-2655).lua +++ b/Tyard/nodes/(-4055,12,-2655).lua @@ -1 +1 @@ -F.EOL("N",7)
\ No newline at end of file +--
\ No newline at end of file diff --git a/Tyard/nodes/(-4055,12,-2731).lua b/Tyard/nodes/(-4055,12,-2731).lua index edb2ef8..7489acc 100644 --- a/Tyard/nodes/(-4055,12,-2731).lua +++ b/Tyard/nodes/(-4055,12,-2731).lua @@ -1 +1 @@ -F.EOL("S",7)
\ No newline at end of file +--
\ No newline at end of file diff --git a/Tyard/nodes/(-4056,12,-2655).lua b/Tyard/nodes/(-4056,12,-2655).lua new file mode 100644 index 0000000..4113ece --- /dev/null +++ b/Tyard/nodes/(-4056,12,-2655).lua @@ -0,0 +1 @@ +F.EOL("N",7)
\ No newline at end of file diff --git a/Tyard/nodes/(-4056,12,-2731).lua b/Tyard/nodes/(-4056,12,-2731).lua new file mode 100644 index 0000000..edb2ef8 --- /dev/null +++ b/Tyard/nodes/(-4056,12,-2731).lua @@ -0,0 +1 @@ +F.EOL("S",7)
\ No newline at end of file diff --git a/Tyard/nodes/(-4100,12,-2745).lua b/Tyard/nodes/(-4100,12,-2745).lua new file mode 100644 index 0000000..16007e9 --- /dev/null +++ b/Tyard/nodes/(-4100,12,-2745).lua @@ -0,0 +1,33 @@ +-- Yard arrival checker +local function enter_yard() + F.dir(true) + F.yard_active(true) + atc_set_ars_disable(false) + atc_send("S6") + return +end + +__approach_callback_mode = 1 +if event.approach and not event.has_entered then + atc_set_ars_disable(true) + atc_set_lzb_trs(1) + return +end + +if event.train then + if F.yard_active() then + schedule_in(";10","recheck") + return + else + enter_yard() + end +end + +if event.schedule then + if F.yard_active() then + schedule_in(";10","recheck") + return + else + enter_yard() + end +end
\ No newline at end of file |