summaryrefslogtreecommitdiff
path: root/durt
diff options
context:
space:
mode:
Diffstat (limited to 'durt')
-rw-r--r--durt/init_code.lua2
-rw-r--r--durt/nodes/(-2147,20,777).lua7
-rw-r--r--durt/nodes/(-2153,20,769).lua9
-rw-r--r--durt/nodes/(-3588,8,-2277).lua2
-rw-r--r--durt/nodes/(-541,26,2469).lua1
-rw-r--r--durt/nodes/(-541,26,2472).lua1
-rw-r--r--durt/nodes/(-541,26,2475).lua1
-rw-r--r--durt/nodes/(-549,26,2478).lua1
-rw-r--r--durt/nodes/(-585,26,2478).lua1
-rw-r--r--durt/nodes/(-612,28,2482).lua1
-rw-r--r--durt/nodes/(-621,26,2469).lua1
-rw-r--r--durt/nodes/(-621,26,2472).lua1
-rw-r--r--durt/nodes/(-621,26,2475).lua1
-rw-r--r--durt/nodes/(-638,26,2475).lua1
-rw-r--r--durt/nodes/(-646,26,2469).lua6
-rw-r--r--durt/nodes/(-678,20,2478).lua2
-rw-r--r--durt/nodes/(415,17,19).lua1
-rw-r--r--durt/nodes/(527,-3,-1959).lua2
-rw-r--r--durt/nodes/(529,-3,-1954).lua2
19 files changed, 39 insertions, 4 deletions
diff --git a/durt/init_code.lua b/durt/init_code.lua
index 831063c..b0b017a 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 = {} } } } 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
+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"] = {}, ["M27_Breaker_Factory"] = {}, } --------------------------------------------------------------------- --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/(-2147,20,777).lua b/durt/nodes/(-2147,20,777).lua
new file mode 100644
index 0000000..467f0f9
--- /dev/null
+++ b/durt/nodes/(-2147,20,777).lua
@@ -0,0 +1,7 @@
+if event.type == "train" then
+ rc = get_rc()
+ if rc:find("apprentice_leave") ~= nil then
+ rc = rc:gsub("apprentice_leave", "apprentice_unload")
+ end
+ set_rc(rc)
+end \ No newline at end of file
diff --git a/durt/nodes/(-2153,20,769).lua b/durt/nodes/(-2153,20,769).lua
new file mode 100644
index 0000000..27ed074
--- /dev/null
+++ b/durt/nodes/(-2153,20,769).lua
@@ -0,0 +1,9 @@
+if event.type == "train" then
+ local rc = get_rc()
+ if rc:find("apprentice_unload") ~= nil then
+ rc = rc:gsub("apprentice_unload", "apprentice_load")
+ elseif rc:find("apprentice_load") ~= nil then
+ rc = rc:gsub("apprentice_load", "apprentice_leave")
+ end
+ set_rc(rc)
+end \ No newline at end of file
diff --git a/durt/nodes/(-3588,8,-2277).lua b/durt/nodes/(-3588,8,-2277).lua
index 0858265..4e7fb2e 100644
--- a/durt/nodes/(-3588,8,-2277).lua
+++ b/durt/nodes/(-3588,8,-2277).lua
@@ -1 +1 @@
---train splitter track mainline_line = "Maverick2797_diamonds" mainline_rc = "autorun FREIGHT" text_outside = "DURT Logs to Diamonds Conversion Train" loading_stopper_sig = POS(-3594,9,-2277) split_around = function() if ((atc_speed==0) and can_set_route(loading_stopper_sig,"Shunt Around Via Loop")) then split_at_index(2,"") atc_send("S4") set_route(loading_stopper_sig,"Shunt Around Via Loop") return else interrupt(2,"split_around") return end end if event.train then if not atc_arrow then atc_send("B1S1") return end if get_rc() == "split_around" then atc_send("B0") split_around() return else --rejoined from splitting or arriving train atc_send("B0S0WD2RS1") set_line(mainline_line) set_rc(mainline_rc) atc_set_text_outside(text_outside) atc_set_text_inside("Loading Cargo") return end end if event.type=="int" then if event.message=="split_around" then split_around() return end return end \ No newline at end of file
+--train splitter track mainline_line = "Maverick2797_diamonds" mainline_rc = "autorun FREIGHT" text_outside = "DURT Logs to Diamonds Conversion Train" loading_stopper_sig = POS(-3594,9,-2277) split_around = function() if ((atc_speed==0) and can_set_route(loading_stopper_sig,"Shunt Around Via Loop")) then set_autocouple() split_at_index(2,"S0") atc_send("S4") set_route(loading_stopper_sig,"Shunt Around Via Loop") return else interrupt(2,"split_around") return end end if event.train then if not atc_arrow then atc_send("B1S1") return end if get_rc() == "split_around" then atc_send("B0") split_around() return else --rejoined from splitting or arriving train atc_send("B0S0WD2RS1") set_line(mainline_line) set_rc(mainline_rc) atc_set_text_outside(text_outside) atc_set_text_inside("Loading Cargo") unset_autocouple() return end end if event.type=="int" then if event.message=="split_around" then split_around() return end return end \ No newline at end of file
diff --git a/durt/nodes/(-541,26,2469).lua b/durt/nodes/(-541,26,2469).lua
new file mode 100644
index 0000000..ea080ea
--- /dev/null
+++ b/durt/nodes/(-541,26,2469).lua
@@ -0,0 +1 @@
+-- arrow points towards loco HS for Bounce local lane = 1 if S.yard_active then if atc_arrow and S.exiting then set_rc("EXIT") set_route("CANNERY_W"..lane, "EXIT") atc_send("B0WRD1SM") else atc_send("B0WD1RS4") end end \ No newline at end of file
diff --git a/durt/nodes/(-541,26,2472).lua b/durt/nodes/(-541,26,2472).lua
new file mode 100644
index 0000000..d5d7bd4
--- /dev/null
+++ b/durt/nodes/(-541,26,2472).lua
@@ -0,0 +1 @@
+-- arrow points towards loco HS for Bounce local lane = 2 if S.yard_active then if atc_arrow and S.exiting then set_rc("EXIT") set_route("CANNERY_W"..lane, "EXIT") atc_send("B0WRD1SM") else atc_send("B0WD1RS4") end end \ No newline at end of file
diff --git a/durt/nodes/(-541,26,2475).lua b/durt/nodes/(-541,26,2475).lua
new file mode 100644
index 0000000..58c5e8b
--- /dev/null
+++ b/durt/nodes/(-541,26,2475).lua
@@ -0,0 +1 @@
+-- arrow points towards loco HS for Bounce local lane = 3 if S.yard_active then if atc_arrow and S.exiting then set_rc("EXIT") set_route("CANNERY_W"..lane, "EXIT") atc_send("B0WRD1SM") else atc_send("B0WD1RS4") end end \ No newline at end of file
diff --git a/durt/nodes/(-549,26,2478).lua b/durt/nodes/(-549,26,2478).lua
new file mode 100644
index 0000000..90eb7a9
--- /dev/null
+++ b/durt/nodes/(-549,26,2478).lua
@@ -0,0 +1 @@
+--LOCO SPLITTER local lane = 4 if S.yard_active then if not S.first_pass then S.first_pass = true set_route("CANNERY_E"..lane,"HEADSHUNT") split_off_locomotive("B0") set_rc("AROUND") else -- has collected wagons, now bounce back to sorting splitter atc_send("B0WRD1S4") end end \ No newline at end of file
diff --git a/durt/nodes/(-585,26,2478).lua b/durt/nodes/(-585,26,2478).lua
new file mode 100644
index 0000000..23d349b
--- /dev/null
+++ b/durt/nodes/(-585,26,2478).lua
@@ -0,0 +1 @@
+--arrow points west towards working HS local lane = 4 if S.yard_active == true then if atc_arrow then set_route("CANNERY_W"..lane, "HEADSHUNT") -- turnouts should already be set by the train returning from HS local plen = train_length() local rc = split_at_fc("B0") local trc = "CAN_"..rc if plen == train_length() and (rc == "" or S.rc:match(trc)) then S.exiting = true end if rc and rc ~= "" then set_rc("CAN_"..rc) else set_rc(S.rc) S.exiting = true end end end \ No newline at end of file
diff --git a/durt/nodes/(-612,28,2482).lua b/durt/nodes/(-612,28,2482).lua
new file mode 100644
index 0000000..399a841
--- /dev/null
+++ b/durt/nodes/(-612,28,2482).lua
@@ -0,0 +1 @@
+if event.channel=="ops" or event.punch then digiline_send("lcd","Yard Active:"..tostring(S.yard_active).."\nRC:"..tostring(S.rc).."\nfirst_pass:"..tostring(S.first_pass).."\nexiting:"..tostring(S.exiting)) end \ No newline at end of file
diff --git a/durt/nodes/(-621,26,2469).lua b/durt/nodes/(-621,26,2469).lua
new file mode 100644
index 0000000..80f4e52
--- /dev/null
+++ b/durt/nodes/(-621,26,2469).lua
@@ -0,0 +1 @@
+-- arrow points towards Sorting HS for Bounce local lane = 1 if S.yard_active == true then if (atc_arrow and not S.exiting) then split_off_locomotive("B0WR") set_route("CANNERY_W"..lane,"HEADSHUNT") set_rc("PICKUP") elseif atc_arrow and S.exiting then set_route("CANNERY_W"..lane,"EXIT") end end \ No newline at end of file
diff --git a/durt/nodes/(-621,26,2472).lua b/durt/nodes/(-621,26,2472).lua
new file mode 100644
index 0000000..de4552e
--- /dev/null
+++ b/durt/nodes/(-621,26,2472).lua
@@ -0,0 +1 @@
+-- arrow points towards Sorting HS for Bounce local lane = 2 if S.yard_active == true then if (atc_arrow and not S.exiting) then split_off_locomotive("B0WR") set_route("CANNERY_W"..lane,"HEADSHUNT") set_rc("PICKUP") elseif atc_arrow and S.exiting then set_route("CANNERY_W"..lane,"EXIT") end end \ No newline at end of file
diff --git a/durt/nodes/(-621,26,2475).lua b/durt/nodes/(-621,26,2475).lua
new file mode 100644
index 0000000..35e4773
--- /dev/null
+++ b/durt/nodes/(-621,26,2475).lua
@@ -0,0 +1 @@
+-- arrow points towards Sorting HS for Bounce local lane = 3 if S.yard_active == true then if (atc_arrow and not S.exiting) then split_off_locomotive("B0WR") set_route("CANNERY_W"..lane,"HEADSHUNT") set_rc("PICKUP") elseif atc_arrow and S.exiting then set_route("CANNERY_W"..lane,"EXIT") end end \ No newline at end of file
diff --git a/durt/nodes/(-638,26,2475).lua b/durt/nodes/(-638,26,2475).lua
new file mode 100644
index 0000000..2b808a1
--- /dev/null
+++ b/durt/nodes/(-638,26,2475).lua
@@ -0,0 +1 @@
+--Yard Exit --arrow points away from yard if S.yard_active == true then if atc_arrow then --exiting yard after shunt sequence set_rc(S.rc) S.yard_active = nil S.rc = nil S.first_pass = nil S.exiting = nil unset_autocouple() end end \ No newline at end of file
diff --git a/durt/nodes/(-646,26,2469).lua b/durt/nodes/(-646,26,2469).lua
new file mode 100644
index 0000000..1158ddb
--- /dev/null
+++ b/durt/nodes/(-646,26,2469).lua
@@ -0,0 +1,6 @@
+--
+if S.yard_active then
+ if atc_arrow then
+ set_autocouple()
+ end
+end \ No newline at end of file
diff --git a/durt/nodes/(-678,20,2478).lua b/durt/nodes/(-678,20,2478).lua
new file mode 100644
index 0000000..7b0b847
--- /dev/null
+++ b/durt/nodes/(-678,20,2478).lua
@@ -0,0 +1,2 @@
+-- approach siding atc_send("B0") if S.yard_active then interrupt(10, "recheck") else atc_send("S4") S.rc = get_rc() step_fc() S.yard_active = true set_route("CANNERY_WAITING", "APPROACH YARD")
+set_route("CANNERY_APPROACH","PICKUP") end \ No newline at end of file
diff --git a/durt/nodes/(415,17,19).lua b/durt/nodes/(415,17,19).lua
new file mode 100644
index 0000000..be6f093
--- /dev/null
+++ b/durt/nodes/(415,17,19).lua
@@ -0,0 +1 @@
+if event.punch or (event.channel=="clock" and event.msg=="pulse")then local line = "U21" local info = S.lines[line].monitoring digiline_send("status_update",info) end \ No newline at end of file
diff --git a/durt/nodes/(527,-3,-1959).lua b/durt/nodes/(527,-3,-1959).lua
index f137323..e7213ad 100644
--- a/durt/nodes/(527,-3,-1959).lua
+++ b/durt/nodes/(527,-3,-1959).lua
@@ -5,7 +5,7 @@ if atc_arrow then
atc_set_text_inside("DEPOT")
else
atc_send("SM")
- set_line("1")
+ set_line("21")
atc_set_text_outside("Line 21\n---> South Forest")
atc_set_text_inside("Next stop: Bamboo Hills")
end \ No newline at end of file
diff --git a/durt/nodes/(529,-3,-1954).lua b/durt/nodes/(529,-3,-1954).lua
index da5fd9f..f734da7 100644
--- a/durt/nodes/(529,-3,-1954).lua
+++ b/durt/nodes/(529,-3,-1954).lua
@@ -1,6 +1,6 @@
if atc_arrow then
atc_send("SM")
- set_line("1")
+ set_line("21")
atc_set_text_outside("Line 21\n---> Turtle Rock")
atc_set_text_inside("Next stop: Clown Island")
else