From c21692e0a830e434675014dd7b54736d180ce71d Mon Sep 17 00:00:00 2001 From: autocommitter Date: Mon, 22 Apr 2024 14:52:07 +0200 Subject: State at 2020-06-24 --- durt/init_code.lua | 2 +- durt/nodes/(-1226,13,-2135).lua | 9 +++++++++ durt/nodes/(-1924,13,-1692).lua | 2 +- durt/nodes/(-2084,21,851).lua | 4 ++-- durt/nodes/(-2734,10,-1693).lua | 1 + durt/nodes/(-3820,18,-4730).lua | 7 +++++++ durt/nodes/(-3820,18,-4743).lua | 3 +++ durt/nodes/(-3821,18,-4761).lua | 14 ++++++++++++++ durt/nodes/(-3824,18,-4774).lua | 7 +++++++ durt/nodes/(-4158,12,-2742).lua | 1 + durt/nodes/(180,20,1256).lua | 3 +++ 11 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 durt/nodes/(-1226,13,-2135).lua create mode 100644 durt/nodes/(-2734,10,-1693).lua create mode 100644 durt/nodes/(-3820,18,-4730).lua create mode 100644 durt/nodes/(-3820,18,-4743).lua create mode 100644 durt/nodes/(-3821,18,-4761).lua create mode 100644 durt/nodes/(-3824,18,-4774).lua create mode 100644 durt/nodes/(-4158,12,-2742).lua create mode 100644 durt/nodes/(180,20,1256).lua (limited to 'durt') diff --git a/durt/init_code.lua b/durt/init_code.lua index 2ecf27d..831063c 100644 --- a/durt/init_code.lua +++ b/durt/init_code.lua @@ -1 +1 @@ -S.lines = { S23 = { termini = { N = "Arc", S = "Rew" }, stations = { Rew = { name = "Redwood", doors = "L", next_station = { N = "Thc", S = false }, }, Thc = { name = "Tanh Cliffs", doors = "L", next_station = { N = "Noi", S = "Rew" }, }, Noi = { name = "No Idea", doors = "L", next_station = { N = "Lzf", S = "Thc" }, }, Lzf = { name = "Laza's Field", doors = "L", next_station = { N = "Bbh", S = "Noi" }, }, Bbh = { name = "Bamboo Hills", doors = "L", next_station = { N = "Arc", S = "Lzf" }, }, Arc = { name = "Arcadius", doors = "L", next_station = { N = false, S = "Bbh" }, } }, monitoring = { N = {}, S = {} } }, U21 = { termini = { E = "Tro", W = "Dbl" }, stations = { Dbl = { name = "Dubulti", doors = "R", next_station = { E = "Pav", W = "Ghd" } }, Pav = { name = "Pence Avenue", doors = "L", next_station = { E = "Ghd", W = "Dbl" } }, Ghd = { name = "Greenhat Mountain", doors = "L", next_station = { E = "Acm", W = "Dbl" } }, Acm = { name = "Acacia Mountains", doors = "L", next_station = { E = "Ghb", W = "Ghd" } }, Ghb = { name = "Green Hill Beach", doors = "L", next_station = { E = "Ged", W = "Acm" } }, Ged = { name = "Green Edge", doors = "L", next_station = { E = "Dri", W = "Ghb" } }, Dri = { name = "Dry Island", doors = "L", next_station = { E = "Gcl", W = "Ged" } }, Gcl = { name = "Green Cliffs", doors = "R", next_station = { E ="Sfs", W = "Dri" } }, Sfs = { name = "South Forest", doors = "R", next_station = { E = "Jms", W = "Gcl" } }, Jms = { name = "Jude Milhon Street", doors = "R", next_station = { E = "Bam", W = "Sfs" } }, Bam = { name = "Bamboo Hills", doors = "R", next_station = { E = "Cli", W = "Jms" } }, Cli = { name = "Clown Island", doors = "R", next_station = { E = "Wat", W = "Bam" } }, Wat = { name = "Something in the Water", doors = "L", next_station = { E = "Duf", W = "Cli" } }, Duf = { name = "Duff Rd", doors = "R", next_station = { E = "Tro", W = "Wat" } }, Tro = { name = "Turtle Rock", doors = "L", next_station = { E = false, W = "Duf" }, } }, monitoring = { E = {}, W = {}, S = {}, N = {} } } } --------------------------------------------------------------------- --defining the functions F.arrive = function(stn_code,dir,line) S.lines[line].monitoring[dir][stn_code] = atc_id atc_send("B0 W O"..S.lines[line].stations[stn_code].doors) atc_set_text_inside("Arrived at:\n"..S.lines[line].stations[stn_code].name.."\n \nNext Station:\n"..S.lines[line].stations[S.lines[line].stations[stn_code].next_station[dir]].name) end F.depart = function(stn_code,dir,line) local pos = stn_code..dir local inside_text = "Next Stop:\n"..S.lines[line].stations[S.lines[line].stations[stn_code].next_station[dir]].name if can_set_route(pos,stn_code.."->"..S.lines[line].stations[stn_code].next_station[dir]) then set_route(pos,stn_code.."->"..S.lines[line].stations[stn_code].next_station[dir]) atc_send("OC SM") S.lines[line].monitoring[dir][stn_code] = nil S.lines[line].monitoring[dir][S.lines[line].stations[stn_code].next_station[dir]] = atc_id else -- Wait another 5s before trying again inside_text = inside_text.."\nWaiting to depart..." interrupt(5, "depart") end atc_set_text_inside(inside_text) end F.set_desto = function(dir, line) atc_set_text_outside("LINE " .. line .."\n---> " .. S.lines[line].stations[S.lines[line].termini[dir]].name) end --------------------------------------------------------------------- --LuaATC track functions F.station = function(stn_code,dir,line) -- temp until all SF LuaAtc tracks are changed------------------------- if line == nil or line == "1" then line = "U21" end --------------------------------------------------------------------- if event.train then F.arrive(stn_code,dir,line) interrupt(10,"depart") elseif event.int and event.msg=="depart" then F.depart(stn_code,dir,line) end end F.terminus = function(stn_code, newdir, line) if event.train then S.lines[line].monitoring[newdir][stn_code] = atc_id atc_send("B0 W R O"..S.lines[line].stations[stn_code].doors) atc_set_text_inside("Arrived at:\n"..S.lines[line].stations[stn_code].name.."\n \nNext Station:\n"..S.lines[line].stations[S.lines[line].stations[stn_code].next_station[newdir]].name) atc_set_text_outside("LINE " .. line .."\n---> " .. S.lines[line].stations[S.lines[line].termini[newdir]].name) interrupt(10, "depart") end if event.int and event.msg == "depart" then F.depart(stn_code, newdir,line) end end \ No newline at end of file +S.lines = { S23 = { termini = { N = "Arc", S = "Rew" }, stations = { Rew = { name = "Redwood", doors = "L", next_station = { N = "Thc", S = false }, }, Thc = { name = "Tanh Cliffs", doors = "L", next_station = { N = "Noi", S = "Rew" }, }, Noi = { name = "No Idea", doors = "L", next_station = { N = "Lzf", S = "Thc" }, }, Lzf = { name = "Laza's Field", doors = "L", next_station = { N = "Bbh", S = "Noi" }, }, Bbh = { name = "Bamboo Hills", doors = "L", next_station = { N = "Arc", S = "Lzf" }, }, Arc = { name = "Arcadius", doors = "L", next_station = { N = false, S = "Bbh" }, } }, monitoring = { N = {}, S = {} } }, U21 = { termini = { E = "Tro", W = "Dbl" }, stations = { Dbl = { name = "Dubulti", doors = "R", next_station = { E = "Pav", W = "Ghd" } }, Pav = { name = "Pence Avenue", doors = "L", next_station = { E = "Ghd", W = "Dbl" } }, Ghd = { name = "Greenhat Mountain", doors = "L", next_station = { E = "Acm", W = "Dbl" } }, Acm = { name = "Acacia Mountains", doors = "L", next_station = { E = "Ghb", W = "Ghd" } }, Ghb = { name = "Green Hill Beach", doors = "L", next_station = { E = "Ged", W = "Acm" } }, Ged = { name = "Green Edge", doors = "L", next_station = { E = "Dri", W = "Ghb" } }, Dri = { name = "Dry Island", doors = "L", next_station = { E = "Gcl", W = "Ged" } }, Gcl = { name = "Green Cliffs", doors = "R", next_station = { E ="Sfs", W = "Dri" } }, Sfs = { name = "South Forest", doors = "R", next_station = { E = "Jms", W = "Gcl" } }, Jms = { name = "Jude Milhon Street", doors = "R", next_station = { E = "Bam", W = "Sfs" } }, Bam = { name = "Bamboo Hills", doors = "R", next_station = { E = "Cli", W = "Jms" } }, Cli = { name = "Clown Island", doors = "R", next_station = { E = "Wat", W = "Bam" } }, Wat = { name = "Something in the Water", doors = "L", next_station = { E = "Duf", W = "Cli" } }, Duf = { name = "Duff Rd", doors = "R", next_station = { E = "Tro", W = "Wat" } }, Tro = { name = "Turtle Rock", doors = "L", next_station = { E = false, W = "Duf" }, } }, monitoring = { E = {}, W = {}, S = {}, N = {} } } } S.runarounds = { ["TheStacks"] = {}, ["M27_Quarry_runaround"] = {}, } --------------------------------------------------------------------- --defining the functions F.arrive = function(stn_code,dir,line) S.lines[line].monitoring[dir][stn_code] = atc_id atc_send("B0 W O"..S.lines[line].stations[stn_code].doors) atc_set_text_inside("Arrived at:\n"..S.lines[line].stations[stn_code].name.."\n \nNext Station:\n"..S.lines[line].stations[S.lines[line].stations[stn_code].next_station[dir]].name) end F.depart = function(stn_code,dir,line) local pos = stn_code..dir local inside_text = "Next Stop:\n"..S.lines[line].stations[S.lines[line].stations[stn_code].next_station[dir]].name if can_set_route(pos,stn_code.."->"..S.lines[line].stations[stn_code].next_station[dir]) then set_route(pos,stn_code.."->"..S.lines[line].stations[stn_code].next_station[dir]) atc_send("OC SM") S.lines[line].monitoring[dir][stn_code] = nil S.lines[line].monitoring[dir][S.lines[line].stations[stn_code].next_station[dir]] = atc_id else -- Wait another 5s before trying again inside_text = inside_text.."\nWaiting to depart..." interrupt(5, "depart") end atc_set_text_inside(inside_text) end F.set_desto = function(dir, line) atc_set_text_outside("LINE " .. line .."\n---> " .. S.lines[line].stations[S.lines[line].termini[dir]].name) end --------------------------------------------------------------------- --LuaATC track functions F.station = function(stn_code,dir,line) -- temp until all SF LuaAtc tracks are changed------------------------- if line == nil or line == "1" then line = "U21" end --------------------------------------------------------------------- if event.train then F.arrive(stn_code,dir,line) interrupt(10,"depart") elseif event.int and event.msg=="depart" then F.depart(stn_code,dir,line) end end F.terminus = function(stn_code, newdir, line) if event.train then S.lines[line].monitoring[newdir][stn_code] = atc_id atc_send("B0 W R O"..S.lines[line].stations[stn_code].doors) atc_set_text_inside("Arrived at:\n"..S.lines[line].stations[stn_code].name.."\n \nNext Station:\n"..S.lines[line].stations[S.lines[line].stations[stn_code].next_station[newdir]].name) atc_set_text_outside("LINE " .. line .."\n---> " .. S.lines[line].stations[S.lines[line].termini[newdir]].name) interrupt(10, "depart") end if event.int and event.msg == "depart" then F.depart(stn_code, newdir,line) end end \ No newline at end of file diff --git a/durt/nodes/(-1226,13,-2135).lua b/durt/nodes/(-1226,13,-2135).lua new file mode 100644 index 0000000..ccf5d5d --- /dev/null +++ b/durt/nodes/(-1226,13,-2135).lua @@ -0,0 +1,9 @@ +if get_line() == "S23" or get_line() == "BH" then + if atc_arrow then + atc_set_text_inside("S23 -> Arcadius") + atc_set_text_outside("S23 -> Arcadius") + else + atc_set_text_inside("Terminus: Mom Junction/nChange here for E1, E10 and Mom Express") + atc_set_text_outside("S23") + end +end \ No newline at end of file diff --git a/durt/nodes/(-1924,13,-1692).lua b/durt/nodes/(-1924,13,-1692).lua index 88ad8a6..6b92378 100644 --- a/durt/nodes/(-1924,13,-1692).lua +++ b/durt/nodes/(-1924,13,-1692).lua @@ -1 +1 @@ -signal = "foundry_roads_sorting" if (event.train and atc_arrow) or (event.int and event.message == "check_signal") then if can_set_route(signal,"In Road") then set_route(signal,"In Road") elseif can_set_route(signal,"Out Road") then set_route(signal,"Out Road") else if atc_speed > 0 then atc_send("S0") else atc_send("B0") end interrupt(5,"check_signal") return end atc_send("S1") return end \ No newline at end of file +signal = "foundry_roads_sorting" if (event.train and atc_arrow) or (event.int and event.message == "check_signal") then if can_set_route(signal,"In Road (Fuel In)") then set_route(signal,"In Road (Fuel In)") elseif can_set_route(signal,"Out Road (Loadout)") then set_route(signal,"Out Road (Loadout)") else if atc_speed > 0 then atc_send("S0") else atc_send("B0") end interrupt(5,"check_signal") return end atc_send("S1") return end \ No newline at end of file diff --git a/durt/nodes/(-2084,21,851).lua b/durt/nodes/(-2084,21,851).lua index 18e9eef..555a3ed 100644 --- a/durt/nodes/(-2084,21,851).lua +++ b/durt/nodes/(-2084,21,851).lua @@ -1,7 +1,7 @@ if get_line() == "S23" or get_line() == "BH" then if atc_arrow then - atc_set_text_inside("S23 -> Redwood") - atc_set_text_outside("S23 -> Redwood") + atc_set_text_inside("S23 -> Mom Junction") + atc_set_text_outside("S23 -> Mom Junction") else atc_set_text_inside("Terminus: Arcadius/nChange here for S20") atc_set_text_outside("S23") diff --git a/durt/nodes/(-2734,10,-1693).lua b/durt/nodes/(-2734,10,-1693).lua new file mode 100644 index 0000000..8043b8c --- /dev/null +++ b/durt/nodes/(-2734,10,-1693).lua @@ -0,0 +1 @@ +--Still need to convert to a function rather than trackside local hs_sig = "M27_Quarry_Headshunt" local hs_route = "Headshunt" local exit_sig = "M27_Quarry_Exit" local exit_route = "Exit to Mainline" local siding_id = "M27_Quarry_runaround" local length_prefix = "Loco" if (event.train and atc_arrow) then local rc = get_rc() or " " -- the RC that controls the link to split -- rc value: "" default is single loco -- eg "Loco2" for tenders, "Loco3" for local loco_pos = rc:match(length_prefix.."%d+") or length_prefix.."1" loco_pos = tonumber(loco_pos:match("%d+"))+1 if not S.runarounds[siding_id].shunting then -- train to be split --store info for later re-insertion S.runarounds[siding_id] = { ['shunting'] = true, ['rc'] = rc, ['line'] = get_line() or " " } atc_send("B0S0") interrupt(5,{['cmd'] = "split", ['leng'] = loco_pos}) -- change int time if needed, depends on approach speed slowdown else -- train has rejoined --re-insert info to train if S.runarounds[siding_id].rc then set_rc(S.runarounds[siding_id].rc) end if S.runarounds[siding_id].line then set_line(S.runarounds[siding_id].line) end --depart atc_send("B0WD3RSM") set_route(exit_sig,exit_route) S.runarounds[siding_id].shunting = false end end if event.int then if event.msg.cmd=="split" then cmd = event.msg split_at_index(cmd.leng,"") set_rc(S.runarounds[siding_id].rc .. " shunt_limit") atc_send("S2") set_route(hs_sig,hs_route) end end \ No newline at end of file diff --git a/durt/nodes/(-3820,18,-4730).lua b/durt/nodes/(-3820,18,-4730).lua new file mode 100644 index 0000000..cd90f80 --- /dev/null +++ b/durt/nodes/(-3820,18,-4730).lua @@ -0,0 +1,7 @@ +if (atc_arrow and event.type == "train" and get_rc() == "sfh_shunt") then + setstate("SFH-T1-N", "st") + atc_send("B0") + interrupt(8, "proceed") +elseif (event.type == "interrupt") then + atc_send("R S2") +end \ No newline at end of file diff --git a/durt/nodes/(-3820,18,-4743).lua b/durt/nodes/(-3820,18,-4743).lua new file mode 100644 index 0000000..3f5d585 --- /dev/null +++ b/durt/nodes/(-3820,18,-4743).lua @@ -0,0 +1,3 @@ +if atc_arrow and get_rc() == "sfh_shunt" then + set_rc("sfh_service") +end \ No newline at end of file diff --git a/durt/nodes/(-3821,18,-4761).lua b/durt/nodes/(-3821,18,-4761).lua new file mode 100644 index 0000000..14c0d7c --- /dev/null +++ b/durt/nodes/(-3821,18,-4761).lua @@ -0,0 +1,14 @@ +if atc_arrow then + if (event.type == "train") then + atc_send("B0") + setstate("SFH-T2-S", "cr") + set_rc("sfh_shunt") + interrupt(5, "proceed") + elseif (event.type == "int") then + set_route("sfh-T1-headshunt", "Enter Headshunt") + split_at_index(2, "") + atc_send("S2") + end +else + atc_send("B0WRS1") +end \ No newline at end of file diff --git a/durt/nodes/(-3824,18,-4774).lua b/durt/nodes/(-3824,18,-4774).lua new file mode 100644 index 0000000..5ac8a65 --- /dev/null +++ b/durt/nodes/(-3824,18,-4774).lua @@ -0,0 +1,7 @@ +if ((event.type == "train") and atc_arrow) then + atc_send("B0") + setstate("SFH-T2-S", "st") + interrupt(3, "proceed") +elseif (event.type == "int") then + atc_send("R S4") +end \ No newline at end of file diff --git a/durt/nodes/(-4158,12,-2742).lua b/durt/nodes/(-4158,12,-2742).lua new file mode 100644 index 0000000..b18dc7f --- /dev/null +++ b/durt/nodes/(-4158,12,-2742).lua @@ -0,0 +1 @@ +--Still need to convert to a function rather than trackside local hs_sig = "TheStacks_hs" local hs_route = "Right to Wye" local exit_sig = "TheStacks_exit" local exit_route = "Exit to Mainline" local siding_id = "TheStacks" local length_prefix = "Loco" if (event.train and atc_arrow) then local rc = get_rc() or " " -- the RC that controls the link to split -- rc value: "" default is single loco -- eg "Loco2" for tenders, "Loco3" for local loco_pos = rc:match(length_prefix.."%d+") or length_prefix.."1" loco_pos = tonumber(loco_pos:match("%d+"))+1 if not S.runarounds[siding_id].shunting then -- train to be split --store info for later re-insertion S.runarounds[siding_id] = { ['shunting'] = true, ['rc'] = rc, ['line'] = get_line() or " " } atc_send("B0S0") interrupt(5,{['cmd'] = "split", ['leng'] = loco_pos}) -- change int time if needed, depends on approach speed slowdown else -- train has rejoined --re-insert info to train if S.runarounds[siding_id].rc then set_rc(S.runarounds[siding_id].rc) end if S.runarounds[siding_id].line then set_line(S.runarounds[siding_id].line) end --depart atc_send("B0S0WD1RSM") set_route(exit_sig,exit_route) S.runarounds[siding_id].shunting = false end end if event.int then if event.msg.cmd=="split" then cmd = event.msg split_at_index(cmd.leng,"") atc_send("S2") set_route(hs_sig,hs_route) end end \ No newline at end of file diff --git a/durt/nodes/(180,20,1256).lua b/durt/nodes/(180,20,1256).lua new file mode 100644 index 0000000..e3b6223 --- /dev/null +++ b/durt/nodes/(180,20,1256).lua @@ -0,0 +1,3 @@ +if atc_arrow then + setstate("EWLF-N", "cr") +end \ No newline at end of file -- cgit v1.2.3