summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-04-22 14:52:38 +0200
committerautocommitter <autocommitter@linux-forks.de>2024-04-22 14:52:38 +0200
commitcfa65d94f1bc9d9e9efe13791711a9ad044a4a67 (patch)
treebdecc9982a58cb88367e4e8b1fcd9cfa1f95573e
parentf3da24b214b3337ad63ebd885da29d5b789d4738 (diff)
downloadluaatc_envs-cfa65d94f1bc9d9e9efe13791711a9ad044a4a67.tar.gz
luaatc_envs-cfa65d94f1bc9d9e9efe13791711a9ad044a4a67.tar.bz2
luaatc_envs-cfa65d94f1bc9d9e9efe13791711a9ad044a4a67.zip
State at 2021-04-04
-rw-r--r--Crossroads/init_code.lua159
-rw-r--r--Crossroads/nodes/(1100,16,1950).lua1
-rw-r--r--Crossroads/nodes/(1100,20,1945).lua3
-rw-r--r--Crossroads/nodes/(1116,12,2621).lua4
-rw-r--r--Crossroads/nodes/(1116,12,2653).lua4
-rw-r--r--Crossroads/nodes/(1116,23,3014).lua3
-rw-r--r--Crossroads/nodes/(1116,23,3027).lua3
-rw-r--r--Crossroads/nodes/(1117,16,1977).lua1
-rw-r--r--Crossroads/nodes/(1117,20,1951).lua3
-rw-r--r--Crossroads/nodes/(1119,16,2757).lua1
-rw-r--r--Crossroads/nodes/(1119,19,3018).lua1
-rw-r--r--Crossroads/nodes/(1122,16,2771).lua1
-rw-r--r--Crossroads/nodes/(1171,5,846).lua1
-rw-r--r--Crossroads/nodes/(1179,5,863).lua1
-rw-r--r--Crossroads/nodes/(1187,-2,987).lua3
-rw-r--r--Crossroads/nodes/(1187,-6,989).lua1
-rw-r--r--Crossroads/nodes/(1190,-2,987).lua3
-rw-r--r--Crossroads/nodes/(1190,-6,989).lua1
-rw-r--r--Crossroads/nodes/(1198,-6,1006).lua1
-rw-r--r--Crossroads/nodes/(1201,-6,1006).lua1
-rw-r--r--Crossroads/nodes/(1223,12,1555).lua2
-rw-r--r--Crossroads/nodes/(1228,12,1541).lua2
-rw-r--r--Crossroads/nodes/(1702,5,906).lua6
-rw-r--r--Crossroads/nodes/(1755,27,943).lua17
-rw-r--r--Crossroads/nodes/(1760,5,1000).lua6
-rw-r--r--Crossroads/nodes/(1786,5,994).lua1
-rw-r--r--Crossroads/nodes/(1795,5,1000).lua6
-rw-r--r--Crossroads/nodes/(1801,5,1008).lua4
-rw-r--r--Crossroads/nodes/(2010,3,5938).lua1
-rw-r--r--Crossroads/nodes/(30671,-6,1142).lua1
-rw-r--r--Tyard/init_code.lua2
-rw-r--r--X_Nihilo/nodes/(-2716,16,962).lua0
-rw-r--r--X_Nihilo/nodes/(-2716,16,963).lua0
-rw-r--r--X_Nihilo/nodes/(-2716,16,964).lua0
-rw-r--r--X_Nihilo/nodes/(-2716,16,965).lua0
-rw-r--r--X_Nihilo/nodes/(-2716,16,966).lua0
-rw-r--r--X_Nihilo/nodes/(-2716,16,967).lua0
-rw-r--r--X_Nihilo/nodes/(-2716,16,968).lua0
-rw-r--r--X_Nihilo/nodes/(-2716,16,969).lua0
-rw-r--r--X_Nihilo/nodes/(-2716,16,970).lua0
-rw-r--r--X_Nihilo/nodes/(-2716,16,971).lua0
-rw-r--r--X_Nihilo/nodes/(-2716,16,972).lua0
-rw-r--r--durt/init_code.lua57
-rw-r--r--durt/nodes/(-1924,13,-1696).lua1
-rw-r--r--durt/nodes/(-1987,13,-1700).lua3
-rw-r--r--durt/nodes/(-2084,9,918).lua2
-rw-r--r--durt/nodes/(-2213,8,898).lua1
-rw-r--r--durt/nodes/(-2732,11,891).lua0
-rw-r--r--durt/nodes/(-2734,11,891).lua0
-rw-r--r--durt/nodes/(-3525,8,-2281).lua7
-rw-r--r--durt/nodes/(-3544,8,-2277).lua2
-rw-r--r--durt/nodes/(-3552,16,-2275).lua1
-rw-r--r--durt/nodes/(-3588,8,-2277).lua3
-rw-r--r--durt/nodes/(-3761,12,-3554).lua2
-rw-r--r--durt/nodes/(-585,26,2478).lua2
-rw-r--r--durt/nodes/(-716,3,1873).lua3
-rw-r--r--durt/nodes/(-716,3,1892).lua1
-rw-r--r--durt/nodes/(-733,3,1854).lua3
-rw-r--r--durt/nodes/(-734,3,1828).lua1
-rw-r--r--durt/nodes/(1817,11,9226).lua1
-rw-r--r--durt/nodes/(1819,11,9227).lua1
-rw-r--r--durt/nodes/(1819,11,9233).lua1
-rw-r--r--durt/nodes/(1852,8,9034).lua1
-rw-r--r--durt/nodes/(1854,11,9164).lua1
-rw-r--r--durt/nodes/(1856,11,9165).lua1
-rw-r--r--durt/nodes/(1864,11,9161).lua1
-rw-r--r--durt/nodes/(1865,17,9141).lua1
-rw-r--r--durt/nodes/(1866,11,9122).lua1
-rw-r--r--durt/nodes/(1874,11,9122).lua1
-rw-r--r--durt/nodes/(1904,7,9133).lua1
-rw-r--r--durt/nodes/(1907,9,9129).lua2
-rw-r--r--durt/nodes/(1909,8,9115).lua5
-rw-r--r--durt/nodes/(1914,7,9096).lua1
-rw-r--r--durt/nodes/(1918,7,9099).lua1
-rw-r--r--durt/nodes/(1918,7,9147).lua1
-rw-r--r--durt/nodes/(1921,7,9096).lua1
-rw-r--r--durt/nodes/(1921,7,9148).lua1
-rw-r--r--durt/nodes/(1928,8,9112).lua1
-rw-r--r--durt/nodes/(1968,39,8411).lua3
-rw-r--r--durt/nodes/(431,-11,-256).lua9
-rw-r--r--durt/nodes/(434,-4,-200).lua7
-rw-r--r--durt/nodes/(442,-4,-198).lua9
-rw-r--r--durt/nodes/(446,-4,-201).lua9
-rw-r--r--durt/nodes/(771,25,8503).lua3
-rw-r--r--ers/init_code.lua91
-rw-r--r--ers/nodes/(1655,1,1261).lua30
-rw-r--r--ers/nodes/(1655,1,1264).lua6
-rw-r--r--ers/nodes/(3159,74,2331).lua0
-rw-r--r--il_timetable/init_code.lua453
-rw-r--r--il_timetable/nodes/(-1023,21,-108).lua1
-rw-r--r--il_timetable/nodes/(-1023,21,-150).lua1
-rw-r--r--il_timetable/nodes/(-1023,21,-190).lua1
-rw-r--r--il_timetable/nodes/(-1023,21,-88).lua1
-rw-r--r--il_timetable/nodes/(-1477,9,-83).lua29
-rw-r--r--il_timetable/nodes/(-1481,3,1160).lua10
-rw-r--r--il_timetable/nodes/(-2091,9,-4569).lua1
-rw-r--r--il_timetable/nodes/(-640,14,-426).lua3
-rw-r--r--il_timetable/nodes/(1103,23,3014).lua8
-rw-r--r--il_timetable/nodes/(1103,23,3027).lua8
-rw-r--r--il_timetable/nodes/(1106,19,3007).lua6
-rw-r--r--il_timetable/nodes/(1106,23,1943).lua9
-rw-r--r--il_timetable/nodes/(1107,16,1951).lua5
-rw-r--r--il_timetable/nodes/(142,8,164).lua1
-rw-r--r--il_timetable/nodes/(1524,21,2656).lua4
-rw-r--r--il_timetable/nodes/(159,11,846).lua28
-rw-r--r--il_timetable/nodes/(1604,-1,7982).lua10
-rw-r--r--il_timetable/nodes/(1618,-1,7982).lua10
-rw-r--r--il_timetable/nodes/(1725,28,2912).lua1
-rw-r--r--il_timetable/nodes/(1730,26,2915).lua12
-rw-r--r--il_timetable/nodes/(1730,26,2926).lua5
-rw-r--r--il_timetable/nodes/(1734,26,2922).lua10
-rw-r--r--il_timetable/nodes/(1899,19,8223).lua4
-rw-r--r--il_timetable/nodes/(1932,8,9112).lua19
-rw-r--r--il_timetable/nodes/(1936,7,9131).lua11
-rw-r--r--il_timetable/nodes/(1953,19,8220).lua4
-rw-r--r--il_timetable/nodes/(1971,5,7353).lua8
-rw-r--r--il_timetable/nodes/(1973,42,8384).lua9
-rw-r--r--il_timetable/nodes/(1973,5,6132).lua8
-rw-r--r--il_timetable/nodes/(1976,5,7914).lua8
-rw-r--r--il_timetable/nodes/(1977,3,7354).lua4
-rw-r--r--il_timetable/nodes/(1980,3,6129).lua4
-rw-r--r--il_timetable/nodes/(1980,3,7922).lua4
-rw-r--r--il_timetable/nodes/(1980,41,8381).lua5
-rw-r--r--il_timetable/nodes/(1980,41,8395).lua10
-rw-r--r--il_timetable/nodes/(2648,13,4352).lua4
-rw-r--r--il_timetable/nodes/(286,4,206).lua27
-rw-r--r--il_timetable/nodes/(767,10,3484).lua10
-rw-r--r--il_timetable/nodes/(790,8,-109).lua5
-rw-r--r--il_timetable/nodes/(941,18,-571).lua5
-rw-r--r--il_timetable/nodes/(957,14,1047).lua6
-rw-r--r--il_timetable/nodes/(960,14,1067).lua3
-rw-r--r--il_timetable/nodes/(972,14,1053).lua5
-rw-r--r--nlvcross/init_code.lua1
-rw-r--r--nlvcross/nodes/(-117,5,-1975).lua5
-rw-r--r--nlvcross/nodes/(-170,7,-2008).lua5
-rw-r--r--nlvcross/nodes/(1604,-1,8169).lua1
-rw-r--r--nlvcross/nodes/(1607,-1,8169).lua1
-rw-r--r--nlvcross/nodes/(1615,-1,8169).lua1
-rw-r--r--nlvcross/nodes/(1618,-1,8169).lua1
-rw-r--r--nlvcross/nodes/(1683,26,8220).lua1
-rw-r--r--nlvcross/nodes/(1683,26,8223).lua1
-rw-r--r--nlvcross/nodes/(572,14,1011).lua2
-rw-r--r--subway/init_code.lua10
-rw-r--r--subway/nodes/(-1559,-1,697).lua63
-rw-r--r--subway/nodes/(-1606,2,595).lua12
-rw-r--r--subway/nodes/(10,0,-10).lua2
-rw-r--r--subway/nodes/(305,9,34).lua1
147 files changed, 1344 insertions, 67 deletions
diff --git a/Crossroads/init_code.lua b/Crossroads/init_code.lua
index ce984ab..dc8cf08 100644
--- a/Crossroads/init_code.lua
+++ b/Crossroads/init_code.lua
@@ -1,5 +1,13 @@
+F.foo = {}
+function F.foo2()
+ F.foo[1] = "foo"
+end
+
if S.trains == nil then S.trains = {} end
if not S.odsd then S.odsd = {} end
+if not S.cpoints then S.cpoints = {} end
+S.pd = {}
+S.pdt = {}
F.odj = {}
@@ -116,6 +124,7 @@ end
-- Second version of the station function
function F.stn2gen(stn, trk, door, ret, chout)
+ __approach_callback_mode = 1
if not stn then return end
if not trk then return end
if not door then return end
@@ -129,20 +138,38 @@ function F.stn2gen(stn, trk, door, ret, chout)
local l = get_line()
if (not l) or l==" " then return end
local rc = get_rc() or ""
- if rc:match("FREIGHT") then
+ if rc:match("FREIGHT") and atc_id then
atc_send (ret and "BBWRSM" or "SM")
return
end
- if event.type == "train" then
+ if event.type == "approach" then
+ for i = 1, #t, 1 do
+ if t[i][1]==l then
+ atc_set_lzb_tsr(2)
+ return
+ end
+ end
+ return
+ elseif event.type == "train" then
for i = 1, #t, 1 do
if t[i][1]==l then
stop = true
- atc_send(string.format("BBWO%sD15OCD1%sSM", door, (ret and "R" or "")))
+ local timenow = os.time()
+ local interval = F.lines[l].interval
+ local offset = t[i][7]
+ local arroff
+ if interval and offset then
+ arroff = timenow%interval
+ interval = (offset-timenow)%interval
+ interval = math.max(10, math.min(45, interval))
+ else
+ interval = 15
+ end
+ atc_send(string.format("A0B0WO%sD%dOCD1%sA1SM", door, interval, (ret and "R" or "")))
local intext_nxt = F.stnlist[t[i][2]] and ("Next station:\n%s\n(Track: %s)"):format(F.stnlist[t[i][2]], t[i][3] or "?") or ""
- local intext = ("%s\n%s"):format(F.stnlist[stn] or stn, intext_nxt)
+ local intext = ("%s\n%s\nDebug: %d %d"):format(F.stnlist[stn] or stn, intext_nxt, arroff or timenow, interval)
local outtext = string.format("%s (%06d)",F.lines[l].name or l, atc_id)
if t[i][4] then outtext = outtext.." - "..(F.stnlist[t[i][4]] or t[i][4]) end
- local timenow = os.time()
t[i][5] = t[i][5] or (timenow-(F.depint[l] or 300))
-- note that the "average" time is weighted
t[i][6] = t[i][6] and (t[i][6]+timenow-t[i][5]+30)/2 or (timenow-t[i][5])
@@ -155,19 +182,17 @@ function F.stn2gen(stn, trk, door, ret, chout)
s = stn,
t = (trk or "N/A"),
}
- schedule_in(15, intext_nxt)
+ schedule_in(interval)
break
end
end
if (not stop) then
atc_send(ret and "BBWRSM" or "SM")
end
- end
- if event.type == "schedule" then
- --[[if type(event.msg) == "string" then
- atc_set_text_inside(event.msg)
- atc_send(ret and "OCD1RSM" or "OCD1SM")
- end]]
+ elseif event.type == "schedule" then
+ if atc_id then
+ atc_send("OCD1"..(((not ret) == (not atc_arrow)) and "R" or "").."A1SM")
+ end
end
end
@@ -176,7 +201,11 @@ function F.disp2gen(stn)
if not F.stndet[stn] then return end
local s = F.stndet[stn]
local sn = F.stnlist[stn] or stn
- local d={{sn.."\nTrack Line\n", (string.sub(sn, 28, 54) or "").." \nDestination\n", " \nEstimated Arrival\n"}}
+ local d={{
+ {sn.."\nTrack Line"},
+ {(string.sub(sn, 28, 54) or "").." \nDestination"},
+ {" \nEstimated Arrival"}
+ }}
local c=2
local t={}
for i,_ in pairs(s) do t[#t+1]=i end
@@ -187,17 +216,59 @@ function F.disp2gen(stn)
for j = 1,#trk,1 do
local det = trk[j]
local r = (c%4==0) and (c/4+1) or ((c-c%4)/4+1)
- if not d[r] then d[r]={"",""} end
- d[r][1] = d[r][1] .. string.format("%-8s %s\n", tostring(trkname), F.lines[det[1]].name)
- d[r][2] = d[r][2] .. (F.lines[det[1]].ring and "Ring Line" or (F.stnlist[det[4]] or det[4] or "")).."\n"
+ if not d[r] then d[r]={{},{},{}} end
+ d[r][1][#d[r][1]+1] = string.format("%-8s %s", tostring(trkname), F.lines[det[1]].name)
+ d[r][2][#d[r][2]+1] = (F.lines[det[1]].ring and "Ring Line" or (F.stnlist[det[4]] or det[4] or ""))
c=c+1
local earr = (det[5] or os.time())+(det[6] or F.depint[det[1]] or 600)
- d[r][3] = d[r][3] .. os.date("%Y-%m-%d %H:%M %Z", earr) .. "\n"
+ d[r][3][#d[r][3]+1] = os.date("%Y-%m-%d %H:%M %Z", earr)
end
end
for i = 1, #d, 1 do
- for j = 1, #d[1], 1 do
- digiline_send("d_"..tostring(i).."_"..tostring(j), d[i][j])
+ for j = 1, #d[i], 1 do
+ digiline_send("d_"..tostring(i).."_"..tostring(j), table.concat(d[i][j],"\n"))
+ end
+ end
+end
+
+--function F.disp2gen() end
+
+function F.pdisp(stn, trk, dn)
+ if not (stn and trk and dn) then return end
+ if not F.stndet[stn] or not F.stndet[stn][trk] then return end
+ if not S.pd[stn] then S.pd[stn] = { [trk] = {[dn] = 0} } end
+ if not S.pd[stn][trk] then S.pd[stn][trk] = {[dn] = 0} end
+ if not S.pd[stn][trk][dn] then S.pd[stn][trk][dn] = 0 end
+ if not S.pdt[stn] then S.pdt[stn] = {} end
+ if not S.pdt[stn][trk] then
+ local t = {}
+ for i = 1, #F.stndet[stn][trk], 1 do
+ local v = F.stndet[stn][trk][i]
+ t[#t+1] = ("Track: %s\n%s\nTo: %s\nNext: %s"):format(
+ trk, F.lines[v[1]].name, F.stnlist[v[4] or "N/A"] or v[4] or "N/A",
+ F.stnlist[v[2] or "N/A"] or v[2] or "N/A")
+ end
+ S.pdt[stn][trk] = t
+ end
+ local n = S.pd[stn][trk][dn] + 1
+ local t = S.pdt[stn][trk]
+ digiline_send("track"..trk,t[n])
+ if n >= #t then n = 0 end
+ S.pd[stn][trk][dn] = n
+end
+
+function F.dirsign(stn, trk, ln, arrow)
+ if event.type == "init" or event.type == "punch" then
+ if not (stn and trk and ln and arrow) then return end
+ local t = F.stndet[stn]
+ if not t then return end
+ t = t[trk]
+ if not t then return end
+ for i = 1, #t, 1 do
+ if t[i][1] == ln then
+ digiline_send("lcd",("%s T. %s | %s | %s"):format(arrow, trk, F.lines[ln].name, F.stnlist[t[i][4]]))
+ break
+ end
end
end
end
@@ -234,6 +305,8 @@ function F.atc (cmd, intext, outtext)
end
F.stnlist = {
+ ["N/A"] = "N/A",
+ Bts = "Origin Berton St.",
cg = "Colored Grasses",
clockwise = "Clockwise Route",
counterclockwise = "Counterclockwise Route",
@@ -276,16 +349,25 @@ F.stnlist = {
F.lines = {
["AB"] = {
- name = "ATL Bronze Line",
+ name = "ATL-B Commuter", short = "ATL-B/C",
+ ring = false,
+ interval = 240,
+ [1] = { {"crch","A1"}, --[[ {"crwm","3"},]] {"scs","N1"}, {"scc","N1"}, {"scn","N1"}, {"cg","1"}, {"thecube","4"}, --[[{"phsc","N"},]] {"grsc", "4"}, {"phwest","2"} },
+ [2] = { {"phwest","2"}, {"grsc", "3"}, --[[{"phsc","S"},]] {"thecube","1"}, {"cg","2"}, {"scn","S1"}, {"scc","S1"}, {"scs","S1"}, --[[ {"crwm","4"}, ]] {"crch","A1"} },
+ },
+ ["ABE"] = {
+ name = "ATL-B Express", short = "ATL-B/E",
ring = false,
- [1] = { {"crch","A1"}, --[[ {"crwm","3"}, ]] {"scs","N2"}, {"scc","N2"}, {"scn","N2"}, {"cg","1"}, {"thecube","4"}, {"phsc","N"}, {"grsc", "4"}, {"phwest","1"} },
- [2] = { {"phwest","1"}, {"grsc", "3"}, {"phsc","S"}, {"thecube","1"}, {"cg","2"}, {"scn","S2"}, {"scc","S2"}, {"scs","S2"}, --[[ {"crwm","4"}, ]] {"crch","A1"} },
+ interval = 240,
+ [1] = {{"crch","A1"}, {"scc","N2"}, {"cg","1"}, {"thecube", "4"}, {"phwest", "2"}},
+ [2] = {{"phwest", "2"}, {"thecube", "1"}, {"cg", "2"}, {"scc", "S2"}, {"crch", "A1"}},
},
["AZ"] = {
- name = "ATL Zinc Line",
+ name = "ATL Zinc Line", short = "ATL-Z",
ring = false,
- [1] = { {"evo","N/A"}, {"scs","N1"}, {"scc","N1"}, {"scn","N1"}, {"oc","N"}, {"elgp","N"}, {"elsf","E"}, {"elchateau","S"} },
- [2] = { {"elchateau","S"}, {"elsf","W"}, {"elgp","S"}, {"oc","S"}, {"scn","S1"}, {"scc", "S1"}, {"scs","S1"}, {"evo","N/A"} },
+ interval = 480,
+ [1] = { {"Bts","3"}, {"evo","N/A"}, {"scs","N1"}, {"scc","N1"}, {"scn","N1"}, {"oc","N"}, {"elgp","N"}, {"elsf","E"}, {"elchateau","S"} },
+ [2] = { {"elchateau","S"}, {"elsf","W"}, {"elgp","S"}, {"oc","S"}, {"scn","S1"}, {"scc", "S1"}, {"scs","S1"}, {"evo","N/A"}, {"Bts","3"}, },
},
["CRT1"] = {
name = "CRT 1",
@@ -308,15 +390,17 @@ for i, l in pairs(F.lines) do
for k = 1, #dir, 1 do
local s = dir[k][1]
local t = dir[k][2]
+ local o = dir[k][3]
if not F.stndet[s] then F.stndet[s] = {} end
if not F.stndet[s][t] then F.stndet[s][t] = {} end
+ local det = F.stndet[s][t]
if k~=#dir or l.ring then
local nxt = dir[k==#dir and 1 or k+1]
- F.stndet[s][t][#F.stndet[s][t]+1] = {i, nxt[1], nxt[2], dir[#dir][1]}
+ det[#det+1] = {i, nxt[1], nxt[2], dir[#dir][1], nil, nil, o}
else
local addent = true
for m = 1, #l, 1 do addent = addent and (l[m][1]==dir[k]) end
- if addent then F.stndet[s][t][#F.stndet[s][t]+1] = {i, nil, nil, s} end
+ if addent then det[#det+1] = {i, nil, nil, s, nil, nil, o} end
end
end
end
@@ -385,4 +469,25 @@ end
function F.odc(ln, rc)
interrupt_pos(F.dpts[ln],{['rc']=rc})
+end
+
+function F.cpoint(name, int)
+ __approach_callback_mode = 1
+ local last = S.cpoints[name] or 0
+ local next = last+int
+ local now = os.time()
+ if event.type == "approach" then
+ if now < next then atc_set_lzb_tsr(2) end
+ elseif event.type == "train" and atc_arrow then
+ if now < next then
+ atc_send(string.format("A0B0WD%dA1SM", next-now))
+ schedule_in(next-now)
+ else
+ S.cpoints[name] = now
+ atc_send("A1SM")
+ end
+ elseif event.type == "schedule" and atc_arrow then
+ S.cpoints[name] = now
+ atc_send("A1SM")
+ end
end \ No newline at end of file
diff --git a/Crossroads/nodes/(1100,16,1950).lua b/Crossroads/nodes/(1100,16,1950).lua
new file mode 100644
index 0000000..194c3d9
--- /dev/null
+++ b/Crossroads/nodes/(1100,16,1950).lua
@@ -0,0 +1 @@
+F.stn2gen("thecube","1","L") \ No newline at end of file
diff --git a/Crossroads/nodes/(1100,20,1945).lua b/Crossroads/nodes/(1100,20,1945).lua
new file mode 100644
index 0000000..0cdeadc
--- /dev/null
+++ b/Crossroads/nodes/(1100,20,1945).lua
@@ -0,0 +1,3 @@
+if event.type == "digiline" and event.channel == "t1" then
+ F.pdisp("thecube","1","S")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1116,12,2621).lua b/Crossroads/nodes/(1116,12,2621).lua
index 3b6577d..1267653 100644
--- a/Crossroads/nodes/(1116,12,2621).lua
+++ b/Crossroads/nodes/(1116,12,2621).lua
@@ -1 +1,3 @@
-F.disp2gen("phsc") \ No newline at end of file
+if event.type == "digiline" and event.channel == "upd" then
+ F.disp2gen("phsc")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1116,12,2653).lua b/Crossroads/nodes/(1116,12,2653).lua
index 3b6577d..1267653 100644
--- a/Crossroads/nodes/(1116,12,2653).lua
+++ b/Crossroads/nodes/(1116,12,2653).lua
@@ -1 +1,3 @@
-F.disp2gen("phsc") \ No newline at end of file
+if event.type == "digiline" and event.channel == "upd" then
+ F.disp2gen("phsc")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1116,23,3014).lua b/Crossroads/nodes/(1116,23,3014).lua
new file mode 100644
index 0000000..44e9c85
--- /dev/null
+++ b/Crossroads/nodes/(1116,23,3014).lua
@@ -0,0 +1,3 @@
+if event.type == "digiline" and event.channel == "track2-update" then
+ F.pdisp("phwest","2","S")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1116,23,3027).lua b/Crossroads/nodes/(1116,23,3027).lua
new file mode 100644
index 0000000..4902e0c
--- /dev/null
+++ b/Crossroads/nodes/(1116,23,3027).lua
@@ -0,0 +1,3 @@
+if event.type == "digiline" and event.channel == "track2-update" then
+ F.pdisp("phwest","2","N")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1117,16,1977).lua b/Crossroads/nodes/(1117,16,1977).lua
new file mode 100644
index 0000000..29aeb3f
--- /dev/null
+++ b/Crossroads/nodes/(1117,16,1977).lua
@@ -0,0 +1 @@
+F.stn2gen("thecube","4","L") \ No newline at end of file
diff --git a/Crossroads/nodes/(1117,20,1951).lua b/Crossroads/nodes/(1117,20,1951).lua
new file mode 100644
index 0000000..a17606a
--- /dev/null
+++ b/Crossroads/nodes/(1117,20,1951).lua
@@ -0,0 +1,3 @@
+if event.type == "digiline" and event.channel == "t4" then
+ F.pdisp("thecube","4","S")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1119,16,2757).lua b/Crossroads/nodes/(1119,16,2757).lua
new file mode 100644
index 0000000..dde01ed
--- /dev/null
+++ b/Crossroads/nodes/(1119,16,2757).lua
@@ -0,0 +1 @@
+F.stn2gen("grsc", "3", "R") \ No newline at end of file
diff --git a/Crossroads/nodes/(1119,19,3018).lua b/Crossroads/nodes/(1119,19,3018).lua
new file mode 100644
index 0000000..51ef14b
--- /dev/null
+++ b/Crossroads/nodes/(1119,19,3018).lua
@@ -0,0 +1 @@
+F.stn2gen("phwest","2","L",true,true) \ No newline at end of file
diff --git a/Crossroads/nodes/(1122,16,2771).lua b/Crossroads/nodes/(1122,16,2771).lua
new file mode 100644
index 0000000..27a6f78
--- /dev/null
+++ b/Crossroads/nodes/(1122,16,2771).lua
@@ -0,0 +1 @@
+F.stn2gen("grsc", "4", "R") \ No newline at end of file
diff --git a/Crossroads/nodes/(1171,5,846).lua b/Crossroads/nodes/(1171,5,846).lua
new file mode 100644
index 0000000..354d229
--- /dev/null
+++ b/Crossroads/nodes/(1171,5,846).lua
@@ -0,0 +1 @@
+F.stn2gen("scs","S1","R") \ No newline at end of file
diff --git a/Crossroads/nodes/(1179,5,863).lua b/Crossroads/nodes/(1179,5,863).lua
new file mode 100644
index 0000000..61b92a5
--- /dev/null
+++ b/Crossroads/nodes/(1179,5,863).lua
@@ -0,0 +1 @@
+F.stn2gen("scs","N1","R") \ No newline at end of file
diff --git a/Crossroads/nodes/(1187,-2,987).lua b/Crossroads/nodes/(1187,-2,987).lua
new file mode 100644
index 0000000..d4e994b
--- /dev/null
+++ b/Crossroads/nodes/(1187,-2,987).lua
@@ -0,0 +1,3 @@
+if event.type == "digiline" and event.channel == "upd" then
+ F.pdisp("scc","S2","S")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1187,-6,989).lua b/Crossroads/nodes/(1187,-6,989).lua
new file mode 100644
index 0000000..5c86126
--- /dev/null
+++ b/Crossroads/nodes/(1187,-6,989).lua
@@ -0,0 +1 @@
+F.stn2gen("scc", "S2", "R") \ No newline at end of file
diff --git a/Crossroads/nodes/(1190,-2,987).lua b/Crossroads/nodes/(1190,-2,987).lua
new file mode 100644
index 0000000..3722041
--- /dev/null
+++ b/Crossroads/nodes/(1190,-2,987).lua
@@ -0,0 +1,3 @@
+if event.type == "digiline" and event.channel == "upd" then
+ F.pdisp("scc","S1","S")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1190,-6,989).lua b/Crossroads/nodes/(1190,-6,989).lua
new file mode 100644
index 0000000..3947016
--- /dev/null
+++ b/Crossroads/nodes/(1190,-6,989).lua
@@ -0,0 +1 @@
+F.stn2gen("scc", "S1", "L") \ No newline at end of file
diff --git a/Crossroads/nodes/(1198,-6,1006).lua b/Crossroads/nodes/(1198,-6,1006).lua
new file mode 100644
index 0000000..c0c450e
--- /dev/null
+++ b/Crossroads/nodes/(1198,-6,1006).lua
@@ -0,0 +1 @@
+F.stn2gen("scc", "N1", "L") \ No newline at end of file
diff --git a/Crossroads/nodes/(1201,-6,1006).lua b/Crossroads/nodes/(1201,-6,1006).lua
new file mode 100644
index 0000000..855f755
--- /dev/null
+++ b/Crossroads/nodes/(1201,-6,1006).lua
@@ -0,0 +1 @@
+F.stn2gen("scc", "N2", "R") \ No newline at end of file
diff --git a/Crossroads/nodes/(1223,12,1555).lua b/Crossroads/nodes/(1223,12,1555).lua
index b07a528..75d5eea 100644
--- a/Crossroads/nodes/(1223,12,1555).lua
+++ b/Crossroads/nodes/(1223,12,1555).lua
@@ -1,5 +1,5 @@
if event.type == "digiline" then
if event.channel == "updwrapper" then
- digiline_send("upd","update")
+ F.disp2gen("cg")
end
end \ No newline at end of file
diff --git a/Crossroads/nodes/(1228,12,1541).lua b/Crossroads/nodes/(1228,12,1541).lua
index b07a528..75d5eea 100644
--- a/Crossroads/nodes/(1228,12,1541).lua
+++ b/Crossroads/nodes/(1228,12,1541).lua
@@ -1,5 +1,5 @@
if event.type == "digiline" then
if event.channel == "updwrapper" then
- digiline_send("upd","update")
+ F.disp2gen("cg")
end
end \ No newline at end of file
diff --git a/Crossroads/nodes/(1702,5,906).lua b/Crossroads/nodes/(1702,5,906).lua
new file mode 100644
index 0000000..03259d6
--- /dev/null
+++ b/Crossroads/nodes/(1702,5,906).lua
@@ -0,0 +1,6 @@
+__approach_callback_mode = 1
+if event.type == "approach" then
+ atc_set_lzb_tsr(2)
+elseif event.type == "train" then
+ atc_send("B2")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1755,27,943).lua b/Crossroads/nodes/(1755,27,943).lua
index d09f055..135d7ab 100644
--- a/Crossroads/nodes/(1755,27,943).lua
+++ b/Crossroads/nodes/(1755,27,943).lua
@@ -1,7 +1,8 @@
-local head = { "V TRAIN LINE STATION", " " }
+local head = { "V TRAIN LINE STATION ", " " }
local length = 18
if event.type=="digiline" or event.type=="punch" then
if event.channel=="upd_main" or event.type=="punch" then
+ local table = table
local start_t = os.clock()
if not S.lagrec then S.lagrec = {} end
local la = {}
@@ -14,16 +15,16 @@ if event.type=="digiline" or event.type=="punch" then
for id = 1, #ids, 1 do
local st = (S.trains[ids[id] or 0] or "")
i = (counter-counter%7)/7*2+((counter%7<3) and 1 or 2)
- if not la[i] then la[i] = (i%2==0) and "" or head[1] end
- if not lb[i] then lb[i] = (i%2==0) and "" or head[2] end
- local n = "[" .. (st.t or "N/A") .. "] " .. (F.stnlist[st.s] or st.s)
- la[i] = string.format ("%s\n%02d %06d %-7s %s", la[i], st.v, ids[id], st.l, n)
- lb[i] = lb[i] .. "\n" .. (n:len() < 10 and " " or n:sub(10))
+ if not la[i] then la[i] = (i%2==0) and {} or {head[1]} end
+ if not lb[i] then lb[i] = (i%2==0) and {} or {head[2]} end
+ local n = string.format("[%s] %s", st.t or "?", F.stnlist[st.s] or st.s)
+ la[i][#la[i]+1] = string.format("%02d %06d %-7s %s", st.v, ids[id], st.l, n)
+ lb[i][#lb[i]+1] = (n:len() < 10 and " " or n:sub(10))
counter = counter + 1
end
for i=1,#la,1 do
- digiline_send("d"..tostring(i).."a", la[i] or "")
- digiline_send("d"..tostring(i).."b", lb[i] or "")
+ digiline_send("d"..tostring(i).."a", table.concat(la[i] or {" "," "},"\n"))
+ digiline_send("d"..tostring(i).."b", table.concat(lb[i] or {" "," "},"\n"))
end
local end_t = os.clock()
S.lagrec[#S.lagrec+1] = end_t - start_t
diff --git a/Crossroads/nodes/(1760,5,1000).lua b/Crossroads/nodes/(1760,5,1000).lua
index ccb559e..7489acc 100644
--- a/Crossroads/nodes/(1760,5,1000).lua
+++ b/Crossroads/nodes/(1760,5,1000).lua
@@ -1,5 +1 @@
-if event.type=='train' then
- if atc_arrow then
- atc_set_text_outside('ATL Mithril Line - Ehlodex')
- end
-end \ No newline at end of file
+-- \ No newline at end of file
diff --git a/Crossroads/nodes/(1786,5,994).lua b/Crossroads/nodes/(1786,5,994).lua
new file mode 100644
index 0000000..e701f62
--- /dev/null
+++ b/Crossroads/nodes/(1786,5,994).lua
@@ -0,0 +1 @@
+F.stn2gen("crch", "A1", "R", true, true) \ No newline at end of file
diff --git a/Crossroads/nodes/(1795,5,1000).lua b/Crossroads/nodes/(1795,5,1000).lua
index d5beb66..7489acc 100644
--- a/Crossroads/nodes/(1795,5,1000).lua
+++ b/Crossroads/nodes/(1795,5,1000).lua
@@ -1,5 +1 @@
-if event.type == "train" then
- if atc_arrow then
- atc_set_text_inside("Next stop: CR-North Station St. 9th Alley")
- end
-end \ No newline at end of file
+-- \ No newline at end of file
diff --git a/Crossroads/nodes/(1801,5,1008).lua b/Crossroads/nodes/(1801,5,1008).lua
index 7741b35..72e6533 100644
--- a/Crossroads/nodes/(1801,5,1008).lua
+++ b/Crossroads/nodes/(1801,5,1008).lua
@@ -1,5 +1,5 @@
-if event.type == "train" then
+--[[if event.type == "train" then
if atc_arrow then
atc_set_text_outside("ATL Mithril Line - Ehlodex")
end
-end \ No newline at end of file
+end]] \ No newline at end of file
diff --git a/Crossroads/nodes/(2010,3,5938).lua b/Crossroads/nodes/(2010,3,5938).lua
index 99bcc37..4716a64 100644
--- a/Crossroads/nodes/(2010,3,5938).lua
+++ b/Crossroads/nodes/(2010,3,5938).lua
@@ -1,3 +1,4 @@
+do return end
if event.type == "punch" then
for i = 1, 4, 1 do
cancel_route("mary4-testsignal-"..tostring(i))
diff --git a/Crossroads/nodes/(30671,-6,1142).lua b/Crossroads/nodes/(30671,-6,1142).lua
new file mode 100644
index 0000000..a333ad4
--- /dev/null
+++ b/Crossroads/nodes/(30671,-6,1142).lua
@@ -0,0 +1 @@
+F.cpoint("wbx-ind", 300) \ No newline at end of file
diff --git a/Tyard/init_code.lua b/Tyard/init_code.lua
index 99b63e4..91bf2b0 100644
--- a/Tyard/init_code.lua
+++ b/Tyard/init_code.lua
@@ -2,4 +2,4 @@
S.single_dir = true
-F.EOL = function(direction,lane) if S.yard_active then if S.dir == direction then if atc_arrow then if not S.exiting then --return to PICKUP via headshunt split_off_locomotive("B0WR") set_rc("PICKUP") set_route("TY"..direction.."_"..lane, "HEADSHUNT") else --if S.exiting then loco has already sorted to correct lane for departure --S.exiting set by the pickup track set_rc(S.rc) set_route("TY"..direction.."_"..lane, "EXIT") S.exiting = nil end end else -- preparing for bi-directional. also EOL Bounce atc_send("B0WD1RS4") end end end \ No newline at end of file
+F.EOL = function(direction,lane) if S.yard_active then if S.dir == direction then if atc_arrow then if not S.exiting then --return to PICKUP via headshunt split_off_locomotive("B0WR") set_rc("PICKUP") set_route("TY"..direction.."_"..lane, "HEADSHUNT") else --if S.exiting then loco has already sorted to correct lane for departure --S.exiting set by the pickup track set_rc(S.rc) set_route("TY"..direction.."_"..lane, "EXIT") S.exiting = nil end end else -- preparing for bi-directional. also EOL Bounce atc_send("B0WD1RS4") end end end \ No newline at end of file
diff --git a/X_Nihilo/nodes/(-2716,16,962).lua b/X_Nihilo/nodes/(-2716,16,962).lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/X_Nihilo/nodes/(-2716,16,962).lua
diff --git a/X_Nihilo/nodes/(-2716,16,963).lua b/X_Nihilo/nodes/(-2716,16,963).lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/X_Nihilo/nodes/(-2716,16,963).lua
diff --git a/X_Nihilo/nodes/(-2716,16,964).lua b/X_Nihilo/nodes/(-2716,16,964).lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/X_Nihilo/nodes/(-2716,16,964).lua
diff --git a/X_Nihilo/nodes/(-2716,16,965).lua b/X_Nihilo/nodes/(-2716,16,965).lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/X_Nihilo/nodes/(-2716,16,965).lua
diff --git a/X_Nihilo/nodes/(-2716,16,966).lua b/X_Nihilo/nodes/(-2716,16,966).lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/X_Nihilo/nodes/(-2716,16,966).lua
diff --git a/X_Nihilo/nodes/(-2716,16,967).lua b/X_Nihilo/nodes/(-2716,16,967).lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/X_Nihilo/nodes/(-2716,16,967).lua
diff --git a/X_Nihilo/nodes/(-2716,16,968).lua b/X_Nihilo/nodes/(-2716,16,968).lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/X_Nihilo/nodes/(-2716,16,968).lua
diff --git a/X_Nihilo/nodes/(-2716,16,969).lua b/X_Nihilo/nodes/(-2716,16,969).lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/X_Nihilo/nodes/(-2716,16,969).lua
diff --git a/X_Nihilo/nodes/(-2716,16,970).lua b/X_Nihilo/nodes/(-2716,16,970).lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/X_Nihilo/nodes/(-2716,16,970).lua
diff --git a/X_Nihilo/nodes/(-2716,16,971).lua b/X_Nihilo/nodes/(-2716,16,971).lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/X_Nihilo/nodes/(-2716,16,971).lua
diff --git a/X_Nihilo/nodes/(-2716,16,972).lua b/X_Nihilo/nodes/(-2716,16,972).lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/X_Nihilo/nodes/(-2716,16,972).lua
diff --git a/durt/init_code.lua b/durt/init_code.lua
index c264a3a..af89c7c 100644
--- a/durt/init_code.lua
+++ b/durt/init_code.lua
@@ -11,4 +11,59 @@ S.M27_tracking = {}
-- -3602,18,-3961 Willow Tunnel <-> Djnc -- -3602.18.-3961 Djnc<->Dcaves
-- -2345,15,-1336 Tanh Depot -- -1986,13,-1699 x2 Foundry entry
-F.M27_tracking = function(id) if not event.train then return end local rc = get_rc() or "" if not rc:match("M27_tracking") then return end S.M27_tracking.last = S.M27_tracking.now S.M27_tracking.now = id end --------------------------------------------------------------------- --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
+F.M27_tracking = function(id) if not event.train then return end local rc = get_rc() or "" if not rc:match("M27_tracking") then return end S.M27_tracking.last = S.M27_tracking.now S.M27_tracking.now = id end
+
+--Atlac Yard Operations
+if event.init then
+ local list_of_yards = {
+ ["WOA"] = {}
+ }
+ S.yards = S.yards or list_of_yards
+end
+
+F.yard_road_count = function(yard,section_id,monitoring_light) if not S.yards[yard][section_id] then S.yards[yard][section_id] = {['car_count'] = 0} end local car_count = S.yards[yard][section_id].car_count if event.train then if atc_arrow then --arrow points into section, add to length car_count = car_count + train_length() else -- subtract from car_count = car_count - train_length() end if car_count > 0 then -- light = on setstate(monitoring_light,"on") else car_count = 0 setstate(monitoring_light,"off") end S.yards[yard][section_id].car_count = car_count end end
+
+
+--stats counter from subway/il_timetable
+F.stat=function(line, init)
+--statistics
+-- init
+if init then
+reftrain = atc_id
+a_tbt = 30
+a_tbtmax = 30
+a_rtt = 500
+a_not = 0
+c_not = 0
+c_tbtmax = 0
+time_lt = os.time()
+time_rt=os.time()
+end
+if not a_tbtmax then a_tbtmax = 30 end
+if not c_tbtmax then c_tbtmax = 0 end
+--real code
+if event.train then
+local time = os.time()
+c_not = c_not + 1
+a_tbt = (a_tbt + (time - time_lt)) / 2
+c_tbtmax = math.max(c_tbtmax, (time - time_lt))
+if atc_id == reftrain then
+ a_rtt = (a_rtt*0.2 + (time - time_rt)*0.8)
+ a_not = c_not
+ c_not = 0
+ a_tbtmax = (a_tbtmax + c_tbtmax) / 2
+ c_tbtmax = 0
+end
+ digiline_send("stats", "Stat: "..line..
+ " NoT:"..a_not.."("..c_not..")"..
+ " TbT:"..math.floor(a_tbt).."("..(time-time_lt)..")"..
+ " Tmx:"..math.floor(a_tbtmax).."("..c_tbtmax..")"..
+ " R:"..math.floor(a_rtt).."("..(time - time_rt)..")"
+ )
+time_lt = time
+if atc_id == reftrain then
+ time_rt = time
+end
+end
+end
+ --------------------------------------------------------------------- --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/(-1924,13,-1696).lua b/durt/nodes/(-1924,13,-1696).lua
new file mode 100644
index 0000000..74c05cc
--- /dev/null
+++ b/durt/nodes/(-1924,13,-1696).lua
@@ -0,0 +1 @@
+__approach_callback_mode = 1 if not atc_id or not atc_arrow then return end if event.approach and not event.has_entered then atc_set_lzb_tsr(2) end if event.train and atc_arrow then atc_send("S1") end \ No newline at end of file
diff --git a/durt/nodes/(-1987,13,-1700).lua b/durt/nodes/(-1987,13,-1700).lua
index 00818fd..fc6a367 100644
--- a/durt/nodes/(-1987,13,-1700).lua
+++ b/durt/nodes/(-1987,13,-1700).lua
@@ -1 +1,4 @@
+if event.train and atc_arrow and atc_speed == 1 then
+ atc_send("SM")
+end
F.M27_tracking("Exit Foundry") \ No newline at end of file
diff --git a/durt/nodes/(-2084,9,918).lua b/durt/nodes/(-2084,9,918).lua
index ae8e76f..dbf9fcf 100644
--- a/durt/nodes/(-2084,9,918).lua
+++ b/durt/nodes/(-2084,9,918).lua
@@ -1 +1 @@
-if event.type=="digiline" then if event.channel ~= "trainctl" then return end if event.msg == "send" then setstate(POS(-2085,11,918),"green") if atc_id and atc_arrow then atc_send("B5S5") elseif atc_id and atc_arrow == false then atc_send("B0S0WRS5") end interrupt(10,"clear_signal") return elseif event.msg == "open" then setstate(POS(-2085,11,918),"green") return elseif event.msg == "close" then setstate(POS(-2085,11,918),"red") return end return end if event.type=="int" then if event.msg=="clear_signal" then setstate(POS(-2085,11,918),"red") end return end \ No newline at end of file
+if event.type=="digiline" then if event.channel ~= "trainctl" then return end if event.msg == "send" then setstate(POS(-2085,11,918),"green") setstate(POS(-2084,9,915),"on") if atc_id and atc_arrow then atc_send("S0B0WRD1RB5S5") elseif atc_id and atc_arrow == false then atc_send("B0S0WRS5") end interrupt(10,"clear_signal") return elseif event.msg == "open" then setstate(POS(-2085,11,918),"green") setstate(POS(-2084,9,915),"on") return elseif event.msg == "close" then setstate(POS(-2085,11,918),"red") setstate(POS(-2084,9,915),"off") return end return end if event.type=="int" then if event.msg=="clear_signal" then setstate(POS(-2085,11,918),"red") end return end \ No newline at end of file
diff --git a/durt/nodes/(-2213,8,898).lua b/durt/nodes/(-2213,8,898).lua
new file mode 100644
index 0000000..3d93bd0
--- /dev/null
+++ b/durt/nodes/(-2213,8,898).lua
@@ -0,0 +1 @@
+if event.type=="digiline" then if event.channel ~= "trainctl" then return end if event.msg == "send" then if atc_id and atc_arrow then atc_send("S0WRS4") elseif atc_id and atc_arrow == false then atc_send("S4") end end end \ No newline at end of file
diff --git a/durt/nodes/(-2732,11,891).lua b/durt/nodes/(-2732,11,891).lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/durt/nodes/(-2732,11,891).lua
diff --git a/durt/nodes/(-2734,11,891).lua b/durt/nodes/(-2734,11,891).lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/durt/nodes/(-2734,11,891).lua
diff --git a/durt/nodes/(-3525,8,-2281).lua b/durt/nodes/(-3525,8,-2281).lua
index 6bb5ea1..cb3c02c 100644
--- a/durt/nodes/(-3525,8,-2281).lua
+++ b/durt/nodes/(-3525,8,-2281).lua
@@ -1,3 +1,8 @@
if event.train then
- if not atc_arrow then atc_send("S1B1") end
+ if not atc_arrow then
+ atc_send("S1B1")
+ set_autocouple()
+ else
+ digiline_send("lcd",atc_id)
+ end
end \ No newline at end of file
diff --git a/durt/nodes/(-3544,8,-2277).lua b/durt/nodes/(-3544,8,-2277).lua
index e6d9f27..37c1019 100644
--- a/durt/nodes/(-3544,8,-2277).lua
+++ b/durt/nodes/(-3544,8,-2277).lua
@@ -1 +1 @@
- --East End of Loading Road local siding_id = "TreeFarm" local control_interface = POS(-3553,18,-2261) local loading_sig = POS(-3539,9,-2279) local exit_route = "Exit to Mainline" local accelerator_loop_diverge_sig = POS(-3602,9,-2282) if event.type=="ext_int" then if not atc_id then interrupt_pos(control_interface,"No Train at Signal") return elseif atc_speed ~= 0 then interrupt_pos(control_interface,"Train Still Moving") return end if event.message == "shuffle" then if can_set_route(loading_sig,"Loop Around") then set_route(loading_sig,"Loop Around") set_route(accelerator_loop_diverge_sig,"Loading Road") atc_send("S8") else interrupt_pos(control_interface,"Unable to set route") end elseif event.message == "depart" then atc_set_text_outside("Preparing to Depart") interrupt_pos(control_interface,"Preparing to Depart") interrupt(5,"depart") else interrupt_pos(control_interface,"Unknown Command:||"..tostring(event.msg)) end end if event.type=="int" then if event.message == "depart" then set_route(loading_sig,"Exit to Mainline") atc_send("SM") atc_set_text_inside("-- Manifest --\nCargo: Logs and Leaves\nOrigin: Auto Logging Plantation") atc_set_text_outside("") end end \ No newline at end of file
+---------------------------------------------- --East End of Loading Road local siding_id = "TreeFarm" local control_interface = POS(-3553,18,-2261) local loading_sig = POS(-3539,9,-2279) local exit_route = "Exit to Mainline" local accelerator_loop_diverge_sig = POS(-3602,9,-2282) if event.type=="ext_int" then if not atc_id then interrupt_pos(control_interface,"No Train at Signal") return elseif atc_speed ~= 0 then interrupt_pos(control_interface,"Train Still Moving") return end if event.message == "shuffle" then if can_set_route(loading_sig,"Loop Around") then set_route(loading_sig,"Loop Around") set_route(accelerator_loop_diverge_sig,"Loading Road (Left)") atc_send("S8") else interrupt_pos(control_interface,"Unable to set route") end elseif event.message == "depart" then atc_set_text_outside("Preparing to Depart") interrupt_pos(control_interface,"Preparing to Depart") interrupt_safe(5,"depart") else interrupt_pos(control_interface,"Unknown Command:||"..tostring(event.msg)) end end if event.type=="int" then if event.message == "depart" then set_route(loading_sig,"Exit to Mainline") atc_send("SM") atc_set_text_inside("-- Manifest --\nCargo: Logs and Leaves\nOrigin: Auto Logging Plantation") atc_set_text_outside("Maverick2797 Organic Diamonds\nFrom Tree to Shiny!") unset_autocouple() end end \ No newline at end of file
diff --git a/durt/nodes/(-3552,16,-2275).lua b/durt/nodes/(-3552,16,-2275).lua
new file mode 100644
index 0000000..4225d33
--- /dev/null
+++ b/durt/nodes/(-3552,16,-2275).lua
@@ -0,0 +1 @@
+digiline_send("","Active: "..tostring(S.TreeFarm.yard_active)) \ No newline at end of file
diff --git a/durt/nodes/(-3588,8,-2277).lua b/durt/nodes/(-3588,8,-2277).lua
index 0cb4557..c0fbf23 100644
--- a/durt/nodes/(-3588,8,-2277).lua
+++ b/durt/nodes/(-3588,8,-2277).lua
@@ -1 +1,2 @@
- --West End of Loading Road local siding_id = "TreeFarm" local control_interface = POS(-3553,18,-2261) local hs_sig = POS(-3594,9,-2277) local hs_route = "Shunt Around Via Loop" if not S[siding_id] then S[siding_id] = {} end if not atc_arrow then atc_send("B1") end if not S[siding_id].yard_active then if atc_arrow then S[siding_id].yard_active = true S[siding_id].info = { ['rc'] = get_rc() or "", ['line'] = get_line() or "" } -- set_rc("AROUND") split_off_locomotive("B0WR") set_autocouple() set_route(hs_sig,hs_route) atc_send("S4") end else if atc_arrow then -- train has rejoined atc_send("B0WD2RS1") -- reverse and load train set_rc(S[siding_id].info.rc) set_line(S[siding_id].info.line) unset_autocouple() interrupt_pos(control_interface,"Train Shunted||Now Loading") S[siding_id].info.rc = nil S[siding_id].info.line = nil S[siding_id].yard_active = nil end end \ No newline at end of file
+------------------------------------------------------------------ --West End of Loading Road local siding_id = "TreeFarm" local control_interface = POS(-3553,18,-2261) local hs_sig = POS(-3594,9,-2277) local hs_route = "Shunt Around Via Loop" if not S[siding_id] then S[siding_id] = {} end if not atc_arrow then atc_send("B1") end if not S[siding_id].yard_active then if atc_arrow then S[siding_id].yard_active = true S[siding_id].info = { ['rc'] = get_rc() or "", ['line'] = get_line() or "" } -- set_rc("AROUND")
+ step_fc() split_off_locomotive("B0WR") set_route(hs_sig,hs_route) atc_send("S4") end else if atc_arrow then -- train has rejoined atc_send("B0WD2RS1") -- reverse and load train set_rc(S[siding_id].info.rc) set_line(S[siding_id].info.line) unset_autocouple() interrupt_pos(control_interface,"Train Shunted||Now Loading") S[siding_id].info.rc = nil S[siding_id].info.line = nil S[siding_id].yard_active = nil end end \ No newline at end of file
diff --git a/durt/nodes/(-3761,12,-3554).lua b/durt/nodes/(-3761,12,-3554).lua
new file mode 100644
index 0000000..118b1c4
--- /dev/null
+++ b/durt/nodes/(-3761,12,-3554).lua
@@ -0,0 +1,2 @@
+--
+F.M27_tracking("EV_S<-->Sinensis") \ No newline at end of file
diff --git a/durt/nodes/(-585,26,2478).lua b/durt/nodes/(-585,26,2478).lua
index 23d349b..f79b2c9 100644
--- a/durt/nodes/(-585,26,2478).lua
+++ b/durt/nodes/(-585,26,2478).lua
@@ -1 +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
+--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",3) 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/(-716,3,1873).lua b/durt/nodes/(-716,3,1873).lua
new file mode 100644
index 0000000..fad9270
--- /dev/null
+++ b/durt/nodes/(-716,3,1873).lua
@@ -0,0 +1,3 @@
+__approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) atc_set_lzb_tsr(1) end
+
+if event.train and atc_arrow then atc_send("S1") end \ No newline at end of file
diff --git a/durt/nodes/(-716,3,1892).lua b/durt/nodes/(-716,3,1892).lua
new file mode 100644
index 0000000..bb8cdaf
--- /dev/null
+++ b/durt/nodes/(-716,3,1892).lua
@@ -0,0 +1 @@
+__approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) atc_set_lzb_tsr(1) end if event.train and atc_arrow then atc_set_ars_disable(false) atc_send("SM") end \ No newline at end of file
diff --git a/durt/nodes/(-733,3,1854).lua b/durt/nodes/(-733,3,1854).lua
new file mode 100644
index 0000000..fad9270
--- /dev/null
+++ b/durt/nodes/(-733,3,1854).lua
@@ -0,0 +1,3 @@
+__approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) atc_set_lzb_tsr(1) end
+
+if event.train and atc_arrow then atc_send("S1") end \ No newline at end of file
diff --git a/durt/nodes/(-734,3,1828).lua b/durt/nodes/(-734,3,1828).lua
new file mode 100644
index 0000000..bb8cdaf
--- /dev/null
+++ b/durt/nodes/(-734,3,1828).lua
@@ -0,0 +1 @@
+__approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) atc_set_lzb_tsr(1) end if event.train and atc_arrow then atc_set_ars_disable(false) atc_send("SM") end \ No newline at end of file
diff --git a/durt/nodes/(1817,11,9226).lua b/durt/nodes/(1817,11,9226).lua
new file mode 100644
index 0000000..a749beb
--- /dev/null
+++ b/durt/nodes/(1817,11,9226).lua
@@ -0,0 +1 @@
+F.yard_road_count("WOA","WOA_ass_W","WOA_ass_W") \ No newline at end of file
diff --git a/durt/nodes/(1819,11,9227).lua b/durt/nodes/(1819,11,9227).lua
new file mode 100644
index 0000000..43153e0
--- /dev/null
+++ b/durt/nodes/(1819,11,9227).lua
@@ -0,0 +1 @@
+F.yard_road_count("WOA","WOA_ass_C","WOA_ass_C") \ No newline at end of file
diff --git a/durt/nodes/(1819,11,9233).lua b/durt/nodes/(1819,11,9233).lua
new file mode 100644
index 0000000..c833ab1
--- /dev/null
+++ b/durt/nodes/(1819,11,9233).lua
@@ -0,0 +1 @@
+F.yard_road_count("WOA","WOA_ass_E","WOA_ass_E") \ No newline at end of file
diff --git a/durt/nodes/(1852,8,9034).lua b/durt/nodes/(1852,8,9034).lua
new file mode 100644
index 0000000..7489acc
--- /dev/null
+++ b/durt/nodes/(1852,8,9034).lua
@@ -0,0 +1 @@
+-- \ No newline at end of file
diff --git a/durt/nodes/(1854,11,9164).lua b/durt/nodes/(1854,11,9164).lua
new file mode 100644
index 0000000..a749beb
--- /dev/null
+++ b/durt/nodes/(1854,11,9164).lua
@@ -0,0 +1 @@
+F.yard_road_count("WOA","WOA_ass_W","WOA_ass_W") \ No newline at end of file
diff --git a/durt/nodes/(1856,11,9165).lua b/durt/nodes/(1856,11,9165).lua
new file mode 100644
index 0000000..43153e0
--- /dev/null
+++ b/durt/nodes/(1856,11,9165).lua
@@ -0,0 +1 @@
+F.yard_road_count("WOA","WOA_ass_C","WOA_ass_C") \ No newline at end of file
diff --git a/durt/nodes/(1864,11,9161).lua b/durt/nodes/(1864,11,9161).lua
new file mode 100644
index 0000000..c833ab1
--- /dev/null
+++ b/durt/nodes/(1864,11,9161).lua
@@ -0,0 +1 @@
+F.yard_road_count("WOA","WOA_ass_E","WOA_ass_E") \ No newline at end of file
diff --git a/durt/nodes/(1865,17,9141).lua b/durt/nodes/(1865,17,9141).lua
new file mode 100644
index 0000000..ab7f545
--- /dev/null
+++ b/durt/nodes/(1865,17,9141).lua
@@ -0,0 +1 @@
+turnouts = { {1870,11,9122},-- Southern headshunt/Goods Shed {1863,11,9122},--Southern Roads {1857,11,9122}, {1851,11,9122}, {1845,11,9122}, {1782,11,9222},--NW Roads {1782,11,9216}, {1782,11,9210}, {1782,11,9204}, {1868,11,9157}, --Eastern Assembly Roads {1860,11,9161}, {1817,11,9237}, {1817,11,9231}, {1822,11,9251}, --Northern Wye {1817,11,9238}, {1806,11,9243}, } routes = { -- max# of routes = 32 (1-31 + R0) --southern headshunt {['matrix']={"1st"}, ['name']="Goods Shed Headshunt"}, --1 {['matrix']={"1cr"}, ['name']="West Assembly Yard"}, --2 --southern road access {['matrix']={"2cr"}, ['name']="East S1"}, --3 {['matrix']={"2st","3cr"}, ['name']="East S2"}, --4 {['matrix']={"2st","3st","4cr"}, ['name']="East S3"}, --5 {['matrix']={"2st","3st","4st","5cr"}, ['name']="East S4"}, --6 {['matrix']={"2st","3st","4st","5st"}, ['name']="East S5"}, --7 --NW road access {['matrix']={"6cr"}, ['name']="East N1"}, --8 {['matrix']={"6st","7cr"}, ['name']="East N2"}, --9 {['matrix']={"6st","7st","8cr"}, ['name']="East N3"}, --10 {['matrix']={"6st","7st","8st","9cr"}, ['name']="East N4"}, --11 {['matrix']={"6st","7st","8st","9st"}, ['name']="East N5"}, --12 --Eastern Assembly Roads {['matrix']={"10st","12cr"}, ['name']="Assembly East"}, --13 {['matrix']={"10cr","11cr","12st","13cr"}, ['name']="Assembly Central"}, --14 {['matrix']={"10cr","11st","12st","13st"}, ['name']="Assembly West"}, --15 --Norther Wye {['matrix']={"15st","14cr"}, ['name']="Assembly<->Station"}, --16 {['matrix']={"15cr","16cr"}, ['name']="Yard Loopback"}, --17 {['matrix']={"14st","16st"}, ['name']="Bypass Yard"}, --18 --testing routes {['matrix']={"1cr","2cr","3cr","4cr","5cr"}, ['name']="[TEST]Southern Cr"}, --19 {['matrix']={"1st","2st","3st","4st","5st"}, ['name']="[TEST]Southern St"}, --20 {['matrix']={"6st","7st","8st","9st"}, ['name']="[TEST]Northern St"}, --21 {['matrix']={"6cr","7cr","8cr","9cr"}, ['name']="[TEST]Northern Cr"}, --22 } local display = "tl1" local debug_screen = "tl2" function tableLength(T) local count = 0 for _ in pairs(T) do count = count + 1 end return count end if event.type=="digiline" then if event.channel=="track_control" then local r = event.msg if r > tableLength(routes) then digiline_send(display,"Input ["..r.."] exceeds #routes||"..tableLength(routes)) -- digiline_send(debug_screen,"Input ["..r.."] exceeds #routes ("..tableLength(routes)..")") return elseif r == 0 then digiline_send(display,"Input 0 is not defined") -- digiline_send(debug_screen,"Input 0 is not defined") return end route = routes[r] -- a = "" for _,v in pairs(route.matrix) do local tid = tonumber(v:match("%d+")) local tpos = turnouts[tid] local turnout = {} turnout.x = tpos[1] turnout.y = tpos[2] turnout.z = tpos[3] local cmd = v:match("%a+") -- a = a..string.format("%s %d,%d,%d\n",cmd,turnout.x,turnout.y,turnout.z) setstate(turnout,cmd) end local verbose = table.concat(route.matrix," ") digiline_send(display,"Route "..r.." set||"..verbose.."||"..route.name) -- digiline_send(debug_screen,a) return end if event.channel=="input" then --show debug info if event.msg=="rwt_get" then digiline_send("rwt_get",rwt.now()) elseif event.msg=="debug" then digiline_send(debug_screen,"#turnouts: "..tableLength(turnouts).."\n#routes: "..tableLength(routes)) elseif event.msg=="occupancy_refresh" then local m = "" for k,v in pairs(S.yards.WOA) do m = m..k..": "..v.car_count.."||" end digiline_send(debug_screen,m) end end end \ No newline at end of file
diff --git a/durt/nodes/(1866,11,9122).lua b/durt/nodes/(1866,11,9122).lua
new file mode 100644
index 0000000..577ba71
--- /dev/null
+++ b/durt/nodes/(1866,11,9122).lua
@@ -0,0 +1 @@
+__approach_callback_mode = 2 if event.approach and not event.has_entered then atc_set_lzb_tsr(1) end \ No newline at end of file
diff --git a/durt/nodes/(1874,11,9122).lua b/durt/nodes/(1874,11,9122).lua
new file mode 100644
index 0000000..fdee831
--- /dev/null
+++ b/durt/nodes/(1874,11,9122).lua
@@ -0,0 +1 @@
+F.yard_road_count("WOA","hs","WOA_hs") \ No newline at end of file
diff --git a/durt/nodes/(1904,7,9133).lua b/durt/nodes/(1904,7,9133).lua
new file mode 100644
index 0000000..22bd87c
--- /dev/null
+++ b/durt/nodes/(1904,7,9133).lua
@@ -0,0 +1 @@
+local yard_id = "WOA" __approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) atc_set_lzb_tsr(1) end if event.train and atc_arrow then atc_send("S1") S.yards[yard_id].last_pass2 = S.yards[yard_id].last_pass1 or rwt.now() S.yards[yard_id].last_pass1 = rwt.now() S.yards[yard_id].last_id = atc_id end if event.train then local init = false if not S.WOA_stats then S.WOA_stats = true init = true end F.stat("WOA_mine",init) end \ No newline at end of file
diff --git a/durt/nodes/(1907,9,9129).lua b/durt/nodes/(1907,9,9129).lua
new file mode 100644
index 0000000..6e01750
--- /dev/null
+++ b/durt/nodes/(1907,9,9129).lua
@@ -0,0 +1,2 @@
+local yard_id = "WOA" if event.schedule then local now = rwt.now() local last = S.yards[yard_id].last_pass1 local dtime = rwt.diff(last,now) local rtt = rwt.diff(S.yards[yard_id].last_pass2,last) digiline_send("lcd",string.format("Now: %s |Last Pass: %s |ID: %s Delta: %s |TBT: %s ",rwt.to_string(now),rwt.to_string(last),S.yards.WOA.last_id,rwt.to_string(dtime),rwt.to_string(rtt))) schedule(rwt.next_rpt(rwt.now(), "0;05", 0)) end if event.punch then schedule(rwt.next_rpt(rwt.now(), "0;05", 0))
+ if S.WOA_stats == true then S.WOA_stats = false end end \ No newline at end of file
diff --git a/durt/nodes/(1909,8,9115).lua b/durt/nodes/(1909,8,9115).lua
new file mode 100644
index 0000000..224bafc
--- /dev/null
+++ b/durt/nodes/(1909,8,9115).lua
@@ -0,0 +1,5 @@
+do return end
+
+
+
+local foundry_track = POS(-1962,13,-1709) local warmoneaye_track = POS(1918,7,9099) if event.ext_int then if type(event.msg) == "string" then digiline_send("lcd",event.msg) end if type(event.msg) == "table" then local m = event.msg local location = m.location local message = m.msg digiline_send(location,message) return end end if event.digiline then if event.channel=="send" then -- interrupt_pos(foundry_track,"send") interrupt_pos(warmoneaye_track,"send") end end if event.punch then digiline_send("Foundry","test") digiline_send("Warmoneaye","test") end \ No newline at end of file
diff --git a/durt/nodes/(1914,7,9096).lua b/durt/nodes/(1914,7,9096).lua
new file mode 100644
index 0000000..bb8cdaf
--- /dev/null
+++ b/durt/nodes/(1914,7,9096).lua
@@ -0,0 +1 @@
+__approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) atc_set_lzb_tsr(1) end if event.train and atc_arrow then atc_set_ars_disable(false) atc_send("SM") end \ No newline at end of file
diff --git a/durt/nodes/(1918,7,9099).lua b/durt/nodes/(1918,7,9099).lua
new file mode 100644
index 0000000..3df43db
--- /dev/null
+++ b/durt/nodes/(1918,7,9099).lua
@@ -0,0 +1 @@
+local location = "Warmoneaye" local ctl_pan = POS(1919,7,9093) local signal = POS(1919,10,9094) local route = "Exit South" err = interrupt_pos if event.ext_int then if not atc_id then err(ctl_pan,{['location'] = location, ['msg'] = " | No Train"}) end if event.msg == "send" then set_route(signal,route) if atc_arrow then atc_send("SM") else atc_send("S0WRSM") end end end \ No newline at end of file
diff --git a/durt/nodes/(1918,7,9147).lua b/durt/nodes/(1918,7,9147).lua
new file mode 100644
index 0000000..7489acc
--- /dev/null
+++ b/durt/nodes/(1918,7,9147).lua
@@ -0,0 +1 @@
+-- \ No newline at end of file
diff --git a/durt/nodes/(1921,7,9096).lua b/durt/nodes/(1921,7,9096).lua
new file mode 100644
index 0000000..32d89d7
--- /dev/null
+++ b/durt/nodes/(1921,7,9096).lua
@@ -0,0 +1 @@
+if event.digiline then if event.channel ~= "track_control" then return end local err = 0 if not atc_id then err = 1 end if not atc_arrow then err = 1 end if type(event.msg) ~= "table" then err = 1 end if err == 1 then digiline_send("lcd","--Error-- | Check Train") return end local i = event.msg set_rc(i.ars or "") atc_set_text_inside("Destination: "..(i.name or "Unknown").."\nCargo: "..(i.info or "Unknown")) end \ No newline at end of file
diff --git a/durt/nodes/(1921,7,9148).lua b/durt/nodes/(1921,7,9148).lua
new file mode 100644
index 0000000..7489acc
--- /dev/null
+++ b/durt/nodes/(1921,7,9148).lua
@@ -0,0 +1 @@
+-- \ No newline at end of file
diff --git a/durt/nodes/(1928,8,9112).lua b/durt/nodes/(1928,8,9112).lua
new file mode 100644
index 0000000..82f90cc
--- /dev/null
+++ b/durt/nodes/(1928,8,9112).lua
@@ -0,0 +1 @@
+-- do return end --if event.punch then schedule(1) end if event.schedule then local t = rwt.now() for k,v in pairs(t) do if v < 10 then t[k] = "0"..v end end time = string.format("Warmoneaye | | Railway Time | %s;%s",tostring(t.m),tostring(t.s)) digiline_send("clock",time) schedule(1) end \ No newline at end of file
diff --git a/durt/nodes/(1968,39,8411).lua b/durt/nodes/(1968,39,8411).lua
new file mode 100644
index 0000000..1a91da0
--- /dev/null
+++ b/durt/nodes/(1968,39,8411).lua
@@ -0,0 +1,3 @@
+if atc_arrow == true and get_line() == "DTLS1" then
+ atc_set_text_outside("DTL S1 -> Banana Place Central")
+end \ No newline at end of file
diff --git a/durt/nodes/(431,-11,-256).lua b/durt/nodes/(431,-11,-256).lua
new file mode 100644
index 0000000..8f8784e
--- /dev/null
+++ b/durt/nodes/(431,-11,-256).lua
@@ -0,0 +1,9 @@
+if atc_arrow == true then
+ local rc = get_rc()
+ if rc:find("bh_ewb_unload") then
+ setstate("s_bh_ewb", "st")
+ end
+ if rc:find("bh_ewb_load") then
+ setstate("s_bh_ewb", "cr")
+ end
+end \ No newline at end of file
diff --git a/durt/nodes/(434,-4,-200).lua b/durt/nodes/(434,-4,-200).lua
new file mode 100644
index 0000000..b072d04
--- /dev/null
+++ b/durt/nodes/(434,-4,-200).lua
@@ -0,0 +1,7 @@
+if event.type == "train" then
+ rc = get_rc()
+ if rc:find("d23a_leave") ~= nil then
+ rc = rc:gsub("d23a_leave", "d23_unload")
+ end
+ set_rc(rc)
+end \ No newline at end of file
diff --git a/durt/nodes/(442,-4,-198).lua b/durt/nodes/(442,-4,-198).lua
new file mode 100644
index 0000000..028a50e
--- /dev/null
+++ b/durt/nodes/(442,-4,-198).lua
@@ -0,0 +1,9 @@
+if event.type == "train" then
+ local rc = get_rc()
+ if rc:find("d23a_unload") ~= nil then
+ rc = rc:gsub("d23a_unload", "d23a_load")
+ elseif rc:find("d23a_load") ~= nil then
+ rc = rc:gsub("d23a_load", "d23a_leave")
+ end
+ set_rc(rc)
+end \ No newline at end of file
diff --git a/durt/nodes/(446,-4,-201).lua b/durt/nodes/(446,-4,-201).lua
new file mode 100644
index 0000000..028a50e
--- /dev/null
+++ b/durt/nodes/(446,-4,-201).lua
@@ -0,0 +1,9 @@
+if event.type == "train" then
+ local rc = get_rc()
+ if rc:find("d23a_unload") ~= nil then
+ rc = rc:gsub("d23a_unload", "d23a_load")
+ elseif rc:find("d23a_load") ~= nil then
+ rc = rc:gsub("d23a_load", "d23a_leave")
+ end
+ set_rc(rc)
+end \ No newline at end of file
diff --git a/durt/nodes/(771,25,8503).lua b/durt/nodes/(771,25,8503).lua
new file mode 100644
index 0000000..58252f0
--- /dev/null
+++ b/durt/nodes/(771,25,8503).lua
@@ -0,0 +1,3 @@
+if atc_arrow == true and get_line() == "DTLS1" then
+ atc_set_text_outside("DTL S1 -> Azena Transirejo")
+end \ No newline at end of file
diff --git a/ers/init_code.lua b/ers/init_code.lua
new file mode 100644
index 0000000..f0a5c4d
--- /dev/null
+++ b/ers/init_code.lua
@@ -0,0 +1,91 @@
+-- environment_ers.lua
+F.debug = true
+
+F.isempty = function (s)
+ return s == nil or s == ''
+end
+
+F.print = function (str)
+ if F.debug then
+ print("PrntMsg: ".. (str or "nil") )
+ end
+end
+
+S.train_duration = {}
+F.train_duration = function(type)
+ if not atc_id then return end
+ local now = os.date("%H:%M:%S")
+ if F.isempty(type) then
+ type = "start"
+ end
+ if not S.train_duration[atc_id] then
+ S.train_duration[atc_id] = { ["start"] = "", ["end"] = "" }
+ end
+ if type == "start" then
+ S.train_duration[atc_id]["end"] = "Nil"
+ end
+ S.train_duration[atc_id][type] = now
+end
+
+F.train_info = function (passive_name, show_print)
+ local timestart = ""
+ local timeend = ""
+ local time_message = ""
+ if F.isempty(passive_name) or passive_name == "RESETALL" then
+ msg_atc_id = "No Train"
+ if passive_name == "RESETALL" then
+ S.train_duration = {}
+ end
+ else
+ timestart = S.train_duration[atc_id]["start"]
+ timeend = S.train_duration[atc_id]["end"]
+ msg_atc_id = atc_id
+ end
+ local lcd_message = "" ..
+ msg_atc_id ..
+ ""
+
+ if not F.isempty(timestart) and not F.isempty(timeend) then
+ time_message = "Time: | " .. timestart .. " to " .. timeend
+ elseif not F.isempty(timestart) and F.isempty(timeend) then
+ time_message = "Start Time: | " .. timestart
+ else
+ time_message = "RegTime: | " .. os.date("%H:%M:%S")
+ end
+
+ digiline_send("lcd", lcd_message)
+ digiline_send("time", time_message)
+ local message = lcd_message .. " | " .. time_message
+
+ if show_print == true then
+ F.print(message)
+ end
+end
+
+F.does_train_have_rc = function(wanted_rc)
+ local rc = get_rc() or ""
+ if rc:match(wanted_rc) then
+ return true
+ else
+ return false
+ end
+end
+
+F.send_route = function(passive_name, route, show_print)
+ if can_set_route(passive_name, route) then
+ set_route(passive_name, route)
+ if show_print == true then
+ F.print(passive_name .. " has been set to " .. route)
+ end
+ return true
+ else
+ if show_print == true then
+ F.print(route .. " cannot be set for " .. passive_name .. ". Try another")
+ end
+ return false
+ end
+end
+
+if event.type == "init" then
+ F.print("Initialized")
+end \ No newline at end of file
diff --git a/ers/nodes/(1655,1,1261).lua b/ers/nodes/(1655,1,1261).lua
new file mode 100644
index 0000000..2d9ef7a
--- /dev/null
+++ b/ers/nodes/(1655,1,1261).lua
@@ -0,0 +1,30 @@
+-- luaatctrack_main_depot_01.lua
+local show_print = false
+if event.train then
+ if atc_arrow then
+ local passive_name = "ErsDepotTurnaround"
+ local track_route = ""
+ local can_do_route = false
+ F.train_duration("start")
+ F.train_info(passive_name, show_print)
+
+ if F.does_train_have_rc("ERSTAZIDEPOTUNLOAD") then
+ track_route = "01 UNLOADING TRACK"
+ F.send_route(passive_name, track_route, show_print)
+ elseif F.does_train_have_rc("ERSTAZITST") then
+ track_route = "02 LOADING TRACK"
+ F.send_route(passive_name, track_route, show_print)
+ else
+ track_route = "03 EXTRA"
+ can_do_route = F.send_route(passive_name, track_route, show_print)
+ if can_do_route == false then
+ track_route = "04 EXTRA"
+ F.send_route(passive_name, track_route, show_print)
+ end
+ end
+ else
+ local passive_name = "ErsDepotTurnaround"
+ F.train_duration("end")
+ F.train_info(passive_name, show_print)
+ end
+end \ No newline at end of file
diff --git a/ers/nodes/(1655,1,1264).lua b/ers/nodes/(1655,1,1264).lua
new file mode 100644
index 0000000..0cb6ef7
--- /dev/null
+++ b/ers/nodes/(1655,1,1264).lua
@@ -0,0 +1,6 @@
+-- luaoperatingpanel_depot_01.lua
+local show_print = false
+if event.type == "punch" then
+ F.train_info("RESETALL", show_print)
+ return
+end \ No newline at end of file
diff --git a/ers/nodes/(3159,74,2331).lua b/ers/nodes/(3159,74,2331).lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ers/nodes/(3159,74,2331).lua
diff --git a/il_timetable/init_code.lua b/il_timetable/init_code.lua
index 313075b..e44819e 100644
--- a/il_timetable/init_code.lua
+++ b/il_timetable/init_code.lua
@@ -37,4 +37,455 @@ end
function F.timedisplay()
digiline_send("time", "Time: | "..rwt.to_string(rwt.now(),true).." | "..os.date("%H:%M:%S"))
schedule(rwt.next_rpt(rwt.now(),5,0), "")
-end \ No newline at end of file
+end
+
+-- Stat counter and timetaking utilities
+-- Stat from subway
+F.stat=function(line, init)
+--statistics
+-- init
+if init then
+reftrain = atc_id
+a_tbt = 30
+a_tbtmax = 30
+a_rtt = 500
+a_not = 0
+c_not = 0
+c_tbtmax = 0
+time_lt = os.time()
+time_rt=os.time()
+end
+if not a_tbtmax then a_tbtmax = 30 end
+if not c_tbtmax then c_tbtmax = 0 end
+--real code
+if event.train then
+local time = os.time()
+c_not = c_not + 1
+a_tbt = (a_tbt + (time - time_lt)) / 2
+c_tbtmax = math.max(c_tbtmax, (time - time_lt))
+if atc_id == reftrain then
+ a_rtt = (a_rtt*0.2 + (time - time_rt)*0.8)
+ a_not = c_not
+ c_not = 0
+ a_tbtmax = (a_tbtmax + c_tbtmax) / 2
+ c_tbtmax = 0
+end
+ digiline_send("stats", "Stat: "..line..
+ " NoT:"..a_not.."("..c_not..")"..
+ " TbT:"..math.floor(a_tbt).."("..(time-time_lt)..")"..
+ " Tmx:"..math.floor(a_tbtmax).."("..c_tbtmax..")"..
+ " R:"..math.floor(a_rtt).."("..(time - time_rt)..")"
+ )
+time_lt = time
+if atc_id == reftrain then
+ time_rt = time
+end
+end
+end
+
+S.timetake = {}
+function F.timetake_start(ttname)
+ if not atc_id then return end
+ local nouw = rwt.to_secs(rwt.now())
+ if not S.timetake[ttname] then
+ S.timetake[ttname] = {}
+ end
+ S.timetake[ttname][atc_id] = nouw
+end
+
+--L100
+function F.timetake_end(ttname)
+ if not atc_id then return end
+ if not S.timetake[ttname] or not S.timetake[ttname][atc_id] then
+ digiline_send("timetake", "No start time for "..atc_id)
+ return
+ end
+ local first = S.timetake[ttname][atc_id]
+ local nouw = rwt.to_secs(rwt.now())
+ local tdiff = nouw - first
+ local cavg = S.timetake[ttname].avg
+ local cmax = S.timetake[ttname].max
+ local cmin = S.timetake[ttname].min
+ if cavg and cmax and cmin then
+ S.timetake[ttname].avg = tdiff*0.1 + cavg*0.9
+ S.timetake[ttname].min = math.min(tdiff, cmin)
+ S.timetake[ttname].max = math.max(tdiff, cmax)
+ else
+ S.timetake[ttname].avg = tdiff
+ S.timetake[ttname].min = tdiff
+ S.timetake[ttname].max = tdiff
+ end
+ digiline_send("timetake", ttname..
+ " this:"..tdiff..
+ " min:"..math.floor(S.timetake[ttname].min)..
+ " avg:"..math.floor(S.timetake[ttname].avg)..
+ " max:"..math.floor(S.timetake[ttname].max)
+ )
+
+end
+
+--== Timetable prototype (TTP) ===
+--[[ table structures:
+F.ttp - static timetable data - see below
+S.ttp[tt_name] = { - dynamic tt data
+ recording_train = <id of the train that is recording travel times, or nil>
+ travel_times = {
+ <station name> = <time in seconds from initial departure at first station of the line to departure at this station>
+ }
+ station_order = { <station 1>, <station 2>...}
+}
+S.ttt[train_id] = { - trains
+ timetable = <timetable ID that the train is currently using>,
+ initial_dep = <departure at first station of the line>,
+ location = <Station where the train was last seen>,
+ desired_dep = <Departure time as in timetable>,
+ planned_dep = <real departure time calculated as the train reaches station>,
+ actual_dep = <actual departure time at last station. is nil while train is stopped>,
+ last_delay = <last known delay of the train - calculated every departure>,
+ }
+}
+]]
+
+local STOP_TIME = 10
+local DEPCMD="A1OCD1SM"
+local RDEPCMD="RA1OCD1SM"
+
+if not S.ttp then S.ttp = {} end
+if not S.ttt then S.ttt = {} end
+F.ttp={
+ CFE_N = {
+ outside_text = "[CFE] Warmoneaye\nvia Ehlodex, Personhood West, Crystal Farms",
+ inside_line_desc = "CFE to Warmoneaye",
+ stn_display = "CFE Warmoneaye",
+ },
+ CFE_S = {
+ outside_text = "[CFE] Origin\nvia Crystal Farms, Personhood West, Ehlodex",
+ inside_line_desc = "CFE to Origin",
+ stn_display = "CFE Origin",
+ },
+ NRG_E = {
+ outside_text = "[NRG] Azena Transirejo",
+ inside_line_desc = "NRG to Azena Transirejo",
+ stn_display = "NRG Azena Transirejo",
+ },
+ NRG_W = {
+ outside_text = "[NRG] New Roses Gardens",
+ inside_line_desc = "NRG to New Roses Gardens",
+ stn_display = "NRG New Roses Gardens",
+ },
+ NX_S = {
+ outside_text = "[NX] Trisiston\nvia Personhood West, Ehlodex, South Forest, Melinka",
+ inside_line_desc = "NX to Trisiston",
+ stn_display = "NX Trisiston",
+ },
+ E1_S = {
+ outside_text = "[E1] Melinka\nvia The Cube, Ehlodex, Spawn Main, Mom Junction",
+ inside_line_desc = "E1 to Melinka",
+ stn_display = "E1 Melinka",
+ },
+ testing = {
+ outside_text = "[testing] Sued via Mitte",
+ inside_line_desc = "[testing] Sued",
+ },
+
+}
+
+--[[
+Timetable entry point. The train finalizes its last timetable and
+registers itself on the given timetable instance. It departs at the next time slot
+(given by interval and offset).
+F.ttp_begin({
+ stn = "Warmoneaye", -- station name
+ tt = "CFE_S", -- timetable ID
+ depint = "05;00", --departure slot interval
+ depoff = "00;00", --departure slot offset
+ doorside = "L",
+ reverse = true,
+ only_lines = nil, --if given a table, only trains where only_lines[get_line()] is true are considered
+ force_tt_reset = false, -- force reset of travel times for this timetable
+})
+]]
+-- Make train depart at the next time slot, and save its start time
+function F.ttp_begin(p)
+ __approach_callback_mode = 1
+
+ if not F.ttp[p.tt] then error("No TT instance "..p.tt) end
+ if not atc_id or not atc_arrow then return end
+ if p.only_lines and not p.only_lines[get_line()] then return end
+ if not S.ttp[p.tt] then S.ttp[p.tt] = {} end
+ local tti = S.ttp[p.tt]
+--L150
+ if event.approach and not event.has_entered then
+ -- make the train stop
+ atc_set_ars_disable(true)
+ atc_set_lzb_tsr(2)
+ atc_set_text_inside("Next stop: "..p.stn.."\nTerminal Station.\nThis train continues as "..F.ttp[p.tt].inside_line_desc)
+ end
+ if event.train then
+ -- train arrived, planning departure
+ atc_send("B0 W O"..p.doorside)
+
+ local time_now = rwt.now()
+ -- Train might have had another TT before, do the cleanup from ttp_end here.
+ local trno = S.ttt[atc_id]
+ if trno then
+ local ttio = S.ttp[trno.timetable]
+ if ttio.recording_train == atc_id then
+ ttio.travel_times[p.stn] = rwt.diff(trno.initial_dep, time_now)
+ ttio.station_order[#ttio.station_order+1] = p.stn
+ end
+ end
+ local next_dep_time = rwt.next_rpt(rwt.add(time_now, 10), p.depint, p.depoff)
+ schedule(next_dep_time, "departure")
+ S.ttt[atc_id] = {
+ timetable = p.tt,
+ initial_dep = next_dep_time,
+ location = p.stn,
+ desired_dep = next_dep_time,
+ planned_dep = next_dep_time,
+ last_delay = 0,
+ }
+ -- if no travel times are available yet, set this train as recording
+ if not tti.travel_times or p.force_tt_reset then
+ tti.travel_times = {}
+ tti.station_order = {p.stn}
+ tti.recording_train = atc_id
+ elseif tti.recording_train == atc_id then
+ tti.recording_train = nil
+ end
+ atc_set_text_outside(F.ttp[p.tt].outside_text)
+ atc_set_text_inside(p.stn.."\nAa: "
+ ..rwt.to_string(time_now, true).." Da: "
+ ..rwt.to_string(next_dep_time, true))
+ end
+ if event.schedule then
+ -- departure. save actual departure time in tt
+ S.ttt[atc_id].actual_dep = rwt.now()
+ local delay = rwt.diff(S.ttt[atc_id].desired_dep, S.ttt[atc_id].actual_dep)
+ atc_set_text_inside(F.ttp[p.tt].inside_line_desc
+ .."\nDelay:"..rwt.to_string(delay, true))
+ S.ttt[atc_id].last_delay = delay
+ if p.reverse then
+ atc_send(RDEPCMD)
+ else
+ atc_send(DEPCMD)
+ end
+ end
+end
+--[[
+Generic stop on timetable. Any train that has a TT instance registered
+stops here, waits STOP_TIME and continues. Behavior can be altered by options:
+F.ttp_stop({
+ stn = "Personhood West", -- station name
+ doorside = "L",
+ only_lines = nil, --if given a table, only trains where only_lines[get_line()] is true are considered
+ end_of_tt = { TT_ID = true },
+ -- if present and key is true for a TT identifier, this is the last station on this timetable. Trains will stop recording timetable and be deregistered.
+ departure = { TT_ID = RWT relative to initial departure }
+ -- If present, override desired departure time. Defaults to travel time + STOP_TIME if not provided
+})
+]]function F.ttp_stop(p)
+ -- set my approach callback mode
+ __approach_callback_mode = 1
+ if not atc_id or not atc_arrow then return end
+ if not S.ttt[atc_id] then return end
+ if p.only_lines and not p.only_lines[get_line()] then return end
+ local trn = S.ttt[atc_id]
+ local tt = trn.timetable
+ if not F.ttp[tt] then
+ S.ttt[atc_id] = nil
+ end
+ local tti = S.ttp[tt]
+ if event.approach and not event.has_entered then
+ -- make the train stop
+ atc_set_ars_disable(true)
+ atc_set_lzb_tsr(2)
+ atc_set_text_inside("Next stop: "..p.stn)
+ end
+ if event.train then
+ -- train arrived, planning departure
+ atc_send("B0 W O"..p.doorside)
+ local time_now = rwt.now()
+ -- update our location and determine desired and planned departure
+--L200
+ local next_dep_time = rwt.add(time_now, STOP_TIME)
+ trn.location = p.stn
+ trn.desired_dep = nil
+ trn.actual_dep = nil
+
+ -- calculate desired departure nouw
+ if p.departure and p.departure[tt] then
+ trn.desired_dep = rwt.add(trn.initial_dep or 0,
+ p.departure[tt])
+ elseif tti.travel_times[p.stn] then
+ trn.desired_dep = rwt.add(trn.initial_dep or 0,
+ tti.travel_times[p.stn] + STOP_TIME)
+ end
+
+ if trn.desired_dep then
+ -- if we had a source for desired departure, update planned daparture time
+ if rwt.to_secs(next_dep_time) < rwt.to_secs(trn.desired_dep) then
+ -- don't depart before the planned departure time
+ next_dep_time = trn.desired_dep
+ end
+ atc_set_text_inside(p.stn.."\nAa "
+ ..rwt.to_string(time_now, true).." Dd"
+ ..rwt.to_string(trn.desired_dep, true).." Da"
+ ..rwt.to_string(next_dep_time, true))
+ else
+ atc_set_text_inside(p.stn.."\nAa "
+ ..rwt.to_string(time_now, true).." Dd ? Da"
+ ..rwt.to_string(next_dep_time, true))
+ end
+
+ if tti.recording_train == atc_id then
+ -- we are recording. save travel time
+ tti.travel_times[p.stn] = rwt.diff(trn.initial_dep or 0, time_now)
+ tti.station_order[#tti.station_order+1] = p.stn
+ atc_set_text_inside(p.stn.."\nRec TT "
+ ..rwt.to_string(tti.travel_times[p.stn], true).." Da"
+ ..rwt.to_string(next_dep_time, true))
+ end
+
+ trn.planned_dep = next_dep_time
+ schedule(next_dep_time, "departure")
+ end
+ if event.schedule then
+ -- departure. save actual departure time in tt
+ trn.actual_dep = rwt.now()
+ local delay = rwt.diff(trn.desired_dep or trn.actual_dep, trn.actual_dep)
+ atc_set_text_inside(F.ttp[tt].inside_line_desc
+ .."\nDelay:"..rwt.to_string(delay, true))
+ S.ttt[atc_id].last_delay = delay
+ atc_send(DEPCMD)
+ if p.end_of_tt and p.end_of_tt[tt] then
+ -- end of timetable. Deregister train
+ if tti.recording_train == atc_id then
+ tti.recording_train = nil
+ end
+ S.ttt[atc_id] = nil
+ end
+ end
+end
+
+
+function F.ttp_info_times(tt, starttime)
+ --L307
+ local ttf = F.ttp[tt]
+ local tti = S.ttp[tt]
+ local p = {}
+ if tti.recording_train then
+ p[#p+1] = ("recording "..tti.recording_train)
+ end
+ p[#p+1] = ("Di "..rwt.to_string(starttime, true).." "..tti.station_order[1])
+ for i=2,#tti.station_order do
+ local ap = rwt.add(starttime, tti.travel_times[tti.station_order[i]])
+ p[#p+1] = ("Ap "..rwt.to_string(ap, true)..
+ " Dp "..rwt.to_string(rwt.add(ap, STOP_TIME), true)..
+ " "..tti.station_order[i])
+ end
+ return p
+end
+function F.ttp_info_trains(tt, starttime)
+ --L307
+ local ttf = F.ttp[tt]
+ local tti = S.ttp[tt]
+ local p = {}
+ for tid,trn in pairs(S.ttt) do
+ if trn.timetable==tt then
+ if trn.actual_dep then
+ p[#p+1] = ("Trn "..tid..
+ " after "..trn.location..
+ " Dd "..rwt.to_string(trn.desired_dep, true)..
+ " Da "..rwt.to_string(trn.actual_dep, true)..
+ " Delay "..rwt.to_string(trn.last_delay))
+ else
+ p[#p+1] = ("Trn "..tid..
+ " at "..trn.location..
+ " Dd "..rwt.to_string(trn.desired_dep, true)..
+ " Delay "..rwt.to_string(trn.last_delay))
+ end
+ end
+ end
+ return p
+end
+
+
+
+--[[F.ttp_station_display({
+ lines = {"CFE_S", "NX_S", "E1_S"},
+ departure = {},
+ station = "The Cube",
+ title = "The Cube (Track 2)",
+ interval = 30,
+ display1 = "display1",
+ display2 = "display2",
+}]]
+function F.ttp_station_display(p)
+--L425
+-- { dep, text }
+local next_trains = {}
+local function is_past_station(tstn, stnorder)
+ for _,s in ipairs(stnorder) do
+ if s==p.station then return true end
+ if s==tstn then return false end
+ end
+ return true
+end
+local function add_train(deptime, line)
+ local tent = {dep = deptime, text =
+ rwt.to_string(deptime,true).." "..F.ttp[line].stn_display}
+ for i,ntrn in ipairs(next_trains) do
+ if rwt.diff(ntrn.dep, deptime)<0 then
+ table.insert(next_trains, i, tent)
+ return
+ end
+ end
+ table.insert(next_trains, tent)
+end
+
+for _,line in ipairs(p.lines) do
+ local fttp = F.ttp[line]
+ local sttp = S.ttp[line]
+ -- find all trains on this line
+ for id, train in pairs(S.ttt) do
+ if train.timetable == line then
+ if train.location == p.station and not train.actual_dep then
+ -- the train is currently standing at this station
+ add_train(train.planned_dep, line)
+ elseif not is_past_station(train.location, sttp.station_order) then
+ -- train is still approaching, calculate arrival time
+ local trav_dep = rwt.add(train.initial_dep, (sttp.travel_times[p.station] or 0) + STOP_TIME)
+ local act_dep = rwt.add(trav_dep, train.last_delay)
+ if p.departure and p.departure[line] then
+ local plan_dep = rwt.add(train.initial_dep, p.departure[line])
+ if rwt.to_secs(act_dep) < rwt.to_secs(plan_dep) then
+ act_dep = plan_dep
+ end
+ end
+ add_train(act_dep, line)
+ end
+ end
+ end
+end
+
+-- make output
+local i
+local text1 = p.title .. " * "..rwt.to_string(rwt.now(), true).." * "
+for i=1,3 do
+ if next_trains[i] then
+ text1 = text1 .. "\n".. next_trains[i].text
+ end
+end
+digiline_send(p.display1, text1)
+if p.display2 then
+ local text2 = ""
+ for i=4,7 do
+ if next_trains[i] then
+ text2 = text2 .. next_trains[i].text .. "\n"
+ end
+ end
+ digiline_send(p.display2, text2)
+end
+schedule_in(p.interval or 30,"foo")
+end
diff --git a/il_timetable/nodes/(-1023,21,-108).lua b/il_timetable/nodes/(-1023,21,-108).lua
new file mode 100644
index 0000000..51ee459
--- /dev/null
+++ b/il_timetable/nodes/(-1023,21,-108).lua
@@ -0,0 +1 @@
+F.ttp_stop("testing", "Mitte 1", "L") \ No newline at end of file
diff --git a/il_timetable/nodes/(-1023,21,-150).lua b/il_timetable/nodes/(-1023,21,-150).lua
new file mode 100644
index 0000000..ea2b0c2
--- /dev/null
+++ b/il_timetable/nodes/(-1023,21,-150).lua
@@ -0,0 +1 @@
+F.ttp_stop("testing", "Mitte 2", "L") \ No newline at end of file
diff --git a/il_timetable/nodes/(-1023,21,-190).lua b/il_timetable/nodes/(-1023,21,-190).lua
new file mode 100644
index 0000000..c524004
--- /dev/null
+++ b/il_timetable/nodes/(-1023,21,-190).lua
@@ -0,0 +1 @@
+F.ttp_end("testing", "Sued", "L", 2) \ No newline at end of file
diff --git a/il_timetable/nodes/(-1023,21,-88).lua b/il_timetable/nodes/(-1023,21,-88).lua
new file mode 100644
index 0000000..62a70b4
--- /dev/null
+++ b/il_timetable/nodes/(-1023,21,-88).lua
@@ -0,0 +1 @@
+F.ttp_begin("testing", "Nord", "01;00", "00;30", "L") \ No newline at end of file
diff --git a/il_timetable/nodes/(-1477,9,-83).lua b/il_timetable/nodes/(-1477,9,-83).lua
new file mode 100644
index 0000000..21d7954
--- /dev/null
+++ b/il_timetable/nodes/(-1477,9,-83).lua
@@ -0,0 +1,29 @@
+if event.train then
+st_name = "Shouwroom"
+flip = not flip
+end
+
+doors = "L"
+ if event.train then
+ local time_now = rwt.now()
+ local next_dep_time = rwt.next_rpt(rwt.add(time_now, 10), 240, 0)
+if flip then
+ atc_set_text_outside("4 - Schwarzschild Street")
+ digiline_send("monitor", "4 Schwarzschild St . "..rwt.to_string(next_dep_time, true))
+ set_rc("SC")
+else
+ digiline_send("monitor", "4 NYE Square "..rwt.to_string(next_dep_time, true))
+ atc_set_text_outside("4 - NYE Square")
+ set_rc("NY")
+end
+ atc_set_text_inside(st_name.."\nDeparture: "..rwt.to_string(next_dep_time, true))
+ atc_send("B0 W O"..doors)
+ schedule(next_dep_time, "depart")
+ elseif event.schedule then
+ atc_send("OCD1SM")
+ set_route("shrdep", "*")
+ digiline_send("monitor", "Last Departure: | "..rwt.to_string(rwt.now(), true))
+ atc_set_text_inside("")
+ depart = true
+ end
+-- \ No newline at end of file
diff --git a/il_timetable/nodes/(-1481,3,1160).lua b/il_timetable/nodes/(-1481,3,1160).lua
new file mode 100644
index 0000000..8055b7a
--- /dev/null
+++ b/il_timetable/nodes/(-1481,3,1160).lua
@@ -0,0 +1,10 @@
+if atc_arrow then
+if flip then
+ atc_set_text_outside("4 - Schwarzschild Street")
+ set_rc("SC")
+else
+ atc_set_text_outside("4 - NYE Square")
+ set_rc("NY")
+end
+flip = not flip
+end \ No newline at end of file
diff --git a/il_timetable/nodes/(-2091,9,-4569).lua b/il_timetable/nodes/(-2091,9,-4569).lua
new file mode 100644
index 0000000..293832f
--- /dev/null
+++ b/il_timetable/nodes/(-2091,9,-4569).lua
@@ -0,0 +1 @@
+F.stop_sd_sched("Melinka", "L", "RSM", 10, 120, 0)
diff --git a/il_timetable/nodes/(-640,14,-426).lua b/il_timetable/nodes/(-640,14,-426).lua
new file mode 100644
index 0000000..0a32291
--- /dev/null
+++ b/il_timetable/nodes/(-640,14,-426).lua
@@ -0,0 +1,3 @@
+if event.train then
+ F.timetake_end("E1-Psh-Ehl")
+end \ No newline at end of file
diff --git a/il_timetable/nodes/(1103,23,3014).lua b/il_timetable/nodes/(1103,23,3014).lua
new file mode 100644
index 0000000..0ea53b2
--- /dev/null
+++ b/il_timetable/nodes/(1103,23,3014).lua
@@ -0,0 +1,8 @@
+F.ttp_station_display({
+ lines = {"CFE_S", "NX_S"},
+ departure = {CFE_S="15;00", NX_S="02;30"},
+ station = "Personhood West",
+ title = "PH West - Track 4",
+ interval = 30,
+ display1 = "track4",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1103,23,3027).lua b/il_timetable/nodes/(1103,23,3027).lua
new file mode 100644
index 0000000..0ea53b2
--- /dev/null
+++ b/il_timetable/nodes/(1103,23,3027).lua
@@ -0,0 +1,8 @@
+F.ttp_station_display({
+ lines = {"CFE_S", "NX_S"},
+ departure = {CFE_S="15;00", NX_S="02;30"},
+ station = "Personhood West",
+ title = "PH West - Track 4",
+ interval = 30,
+ display1 = "track4",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1106,19,3007).lua b/il_timetable/nodes/(1106,19,3007).lua
new file mode 100644
index 0000000..ff8b71e
--- /dev/null
+++ b/il_timetable/nodes/(1106,19,3007).lua
@@ -0,0 +1,6 @@
+F.ttp_stop({
+ stn = "Personhood West",
+ doorside = "R",
+-- end_of_tt = {CFE_S=true, NX_S=true},
+ departure = {CFE_S="15;00", NX_S="02;30"},
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1106,23,1943).lua b/il_timetable/nodes/(1106,23,1943).lua
new file mode 100644
index 0000000..84a52d0
--- /dev/null
+++ b/il_timetable/nodes/(1106,23,1943).lua
@@ -0,0 +1,9 @@
+F.ttp_station_display({
+ lines = {"CFE_S", "NX_S", "E1_S"},
+ departure = {},
+ station = "The Cube",
+ title = "The Cube (Track 2)",
+ interval = 15,
+ display1 = "display1",
+ display2 = "display2",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1107,16,1951).lua b/il_timetable/nodes/(1107,16,1951).lua
new file mode 100644
index 0000000..1d7d775
--- /dev/null
+++ b/il_timetable/nodes/(1107,16,1951).lua
@@ -0,0 +1,5 @@
+F.ttp_stop({
+ stn = "The Cube",
+ doorside = "R",
+ end_of_tt = {CFE_S=true,NX_S=true,E1_S=true},
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(142,8,164).lua b/il_timetable/nodes/(142,8,164).lua
new file mode 100644
index 0000000..acced81
--- /dev/null
+++ b/il_timetable/nodes/(142,8,164).lua
@@ -0,0 +1 @@
+atc_set_text_outside("[CFE] Warmoneaye\nvia Ehlodex, Personhood West, Crystal Farms") \ No newline at end of file
diff --git a/il_timetable/nodes/(1524,21,2656).lua b/il_timetable/nodes/(1524,21,2656).lua
new file mode 100644
index 0000000..9b7580d
--- /dev/null
+++ b/il_timetable/nodes/(1524,21,2656).lua
@@ -0,0 +1,4 @@
+F.ttp_stop({
+ stn = "Personhood South",
+ doorside = "R",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(159,11,846).lua b/il_timetable/nodes/(159,11,846).lua
new file mode 100644
index 0000000..49e1131
--- /dev/null
+++ b/il_timetable/nodes/(159,11,846).lua
@@ -0,0 +1,28 @@
+if event.train then
+st_name = "Schwarzschild Street"
+set_line("4")
+flip = not flip
+end
+
+doors = "L"
+ if event.train then
+ local time_now = rwt.now()
+ local next_dep_time = rwt.next_rpt(rwt.add(time_now, 10), 120, 0)
+if flip then
+ atc_set_text_outside("4 - Showroom")
+ digiline_send("monitor", "4 Showroom "..rwt.to_string(next_dep_time, true))
+ set_rc("SH")
+else
+ digiline_send("monitor", "4 Ice Mountain "..rwt.to_string(next_dep_time, true))
+ atc_set_text_outside("4 - Ice Mountain")
+ set_rc("IM")
+end
+ atc_set_text_inside(st_name.."\nDeparture: "..rwt.to_string(next_dep_time, true))
+ atc_send("B0 W O"..doors)
+ schedule(next_dep_time, "depart")
+ elseif event.schedule then
+ atc_send("OCD1SM")
+ digiline_send("monitor", "Last Departure: | "..rwt.to_string(rwt.now(), true))
+ atc_set_text_inside("")
+ depart = true
+ end
diff --git a/il_timetable/nodes/(1604,-1,7982).lua b/il_timetable/nodes/(1604,-1,7982).lua
new file mode 100644
index 0000000..1326eab
--- /dev/null
+++ b/il_timetable/nodes/(1604,-1,7982).lua
@@ -0,0 +1,10 @@
+F.ttp_begin({
+ stn = "New Roses Gardens", -- station name
+ tt = "NRG_E", -- timetable ID
+ depint = "10;00", --departure slot interval
+ depoff = "01;30", --departure slot offset
+ doorside = "L",
+ reverse = true,
+ only_lines = nil,
+ force_tt_reset = false, -- force reset of travel times for this timetable
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1618,-1,7982).lua b/il_timetable/nodes/(1618,-1,7982).lua
new file mode 100644
index 0000000..c1b0bce
--- /dev/null
+++ b/il_timetable/nodes/(1618,-1,7982).lua
@@ -0,0 +1,10 @@
+F.ttp_begin({
+ stn = "New Roses Gardens", -- station name
+ tt = "NRG_E", -- timetable ID
+ depint = "10;00", --departure slot interval
+ depoff = "06;30", --departure slot offset
+ doorside = "R",
+ reverse = true,
+ only_lines = nil,
+ force_tt_reset = false, -- force reset of travel times for this timetable
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1725,28,2912).lua b/il_timetable/nodes/(1725,28,2912).lua
new file mode 100644
index 0000000..6c2907f
--- /dev/null
+++ b/il_timetable/nodes/(1725,28,2912).lua
@@ -0,0 +1 @@
+F.timedisplay() \ No newline at end of file
diff --git a/il_timetable/nodes/(1730,26,2915).lua b/il_timetable/nodes/(1730,26,2915).lua
new file mode 100644
index 0000000..44b483e
--- /dev/null
+++ b/il_timetable/nodes/(1730,26,2915).lua
@@ -0,0 +1,12 @@
+-- d_int: Departure every n seconds (epoch modulo)
+-- d_off: Departure time offset
+-- function F.stop_sd(st_name, doors, departcommand, minstoptime, d_int, d_off)
+F.stop_sd_sched("Personhood Main", "L", "RSM", 10, 120, 70)
+atc_set_text_outside("E1: Personhood <-> Spawn <-> Melinka Town")
+if event.train then
+ F.stat("E1", false)
+ F.timetake_end("E1-Ehl-Psh")
+end
+if depart then
+ F.timetake_start("E1-Psh-Ehl")
+end
diff --git a/il_timetable/nodes/(1730,26,2926).lua b/il_timetable/nodes/(1730,26,2926).lua
new file mode 100644
index 0000000..b2341c2
--- /dev/null
+++ b/il_timetable/nodes/(1730,26,2926).lua
@@ -0,0 +1,5 @@
+-- d_int: Departure every n seconds (epoch modulo)
+-- d_off: Departure time offset
+-- function F.stop_sd(st_name, doors, departcommand, minstoptime, d_int, d_off)
+atc_set_text_outside("E11 - Oasis")
+F.stop_sd_sched("Personhood Main Station", "R", "RSM", 10, 300, 0) \ No newline at end of file
diff --git a/il_timetable/nodes/(1734,26,2922).lua b/il_timetable/nodes/(1734,26,2922).lua
new file mode 100644
index 0000000..36913b1
--- /dev/null
+++ b/il_timetable/nodes/(1734,26,2922).lua
@@ -0,0 +1,10 @@
+F.ttp_begin({
+ stn = "Personhood Main", -- station name
+ tt = "E1_S", -- timetable ID
+ depint = "02;30", --departure slot interval
+ depoff = "00;00", --departure slot offset
+ doorside = "R",
+ reverse = true,
+ only_lines = { E1 = true },
+ force_tt_reset = false,
+})
diff --git a/il_timetable/nodes/(1899,19,8223).lua b/il_timetable/nodes/(1899,19,8223).lua
new file mode 100644
index 0000000..c07fbb8
--- /dev/null
+++ b/il_timetable/nodes/(1899,19,8223).lua
@@ -0,0 +1,4 @@
+F.ttp_stop({
+ stn = "Krasnograd",
+ doorside = "R",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1932,8,9112).lua b/il_timetable/nodes/(1932,8,9112).lua
new file mode 100644
index 0000000..ab5f43e
--- /dev/null
+++ b/il_timetable/nodes/(1932,8,9112).lua
@@ -0,0 +1,19 @@
+--S.ttp["CFE_S"].travel_times["Personhood West"] = 890
+
+lines = F.ttp_info_times("CFE_S", "00;00")
+linestr = F.ttp_info_trains("CFE_S", "00;00")
+local li = lines
+for i=1,#linestr do li[#li+1] = linestr[i] end
+print(" CFE\n"..table.concat(li, "\n"))
+
+lines = F.ttp_info_times("NX_S", "00;00")
+linestr = F.ttp_info_trains("NX_S", "00;00")
+li = lines
+for i=1,#linestr do li[#li+1] = linestr[i] end
+print(" NX\n"..table.concat(li, "\n"))
+
+lines = F.ttp_info_times("E1_S", "00;00")
+linestr = F.ttp_info_trains("E1_S", "00;00")
+li = lines
+for i=1,#linestr do li[#li+1] = linestr[i] end
+print(" E1\n"..table.concat(li, "\n")) \ No newline at end of file
diff --git a/il_timetable/nodes/(1936,7,9131).lua b/il_timetable/nodes/(1936,7,9131).lua
new file mode 100644
index 0000000..815f30a
--- /dev/null
+++ b/il_timetable/nodes/(1936,7,9131).lua
@@ -0,0 +1,11 @@
+F.ttp_begin({
+ stn = "Warmoneaye", -- station name
+ tt = "CFE_S", -- timetable ID
+ depint = "05;00", --departure slot interval
+ depoff = "00;00", --departure slot offset
+ doorside = "L",
+ reverse = true,
+ only_lines = nil,
+ force_tt_reset = false,
+})
+F.stat("CFE") \ No newline at end of file
diff --git a/il_timetable/nodes/(1953,19,8220).lua b/il_timetable/nodes/(1953,19,8220).lua
new file mode 100644
index 0000000..c07fbb8
--- /dev/null
+++ b/il_timetable/nodes/(1953,19,8220).lua
@@ -0,0 +1,4 @@
+F.ttp_stop({
+ stn = "Krasnograd",
+ doorside = "R",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1971,5,7353).lua b/il_timetable/nodes/(1971,5,7353).lua
new file mode 100644
index 0000000..d9f6da9
--- /dev/null
+++ b/il_timetable/nodes/(1971,5,7353).lua
@@ -0,0 +1,8 @@
+F.ttp_station_display({
+ lines = {"CFE_S"},
+ departure = {},
+ station = "Crystal Farms",
+ title = "Crystal Farms",
+ interval = 60,
+ display1 = "disp1",
+})
diff --git a/il_timetable/nodes/(1973,42,8384).lua b/il_timetable/nodes/(1973,42,8384).lua
new file mode 100644
index 0000000..8fe1919
--- /dev/null
+++ b/il_timetable/nodes/(1973,42,8384).lua
@@ -0,0 +1,9 @@
+F.ttp_station_display({
+ lines = {"CFE_S", "NRG_W", "NRG_E"},
+ departure = {},
+ station = "Azena Transirejo",
+ title = "Azena Transirejo",
+ interval = 30,
+ display1 = "display1",
+ display2 = "display2",
+})
diff --git a/il_timetable/nodes/(1973,5,6132).lua b/il_timetable/nodes/(1973,5,6132).lua
new file mode 100644
index 0000000..451a05c
--- /dev/null
+++ b/il_timetable/nodes/(1973,5,6132).lua
@@ -0,0 +1,8 @@
+F.ttp_station_display({
+ lines = {"CFE_S"},
+ departure = {},
+ station = "Grootshad - X Nihilo",
+ title = "Grootshad-XNihilo",
+ interval = 60,
+ display1 = "disp1",
+})
diff --git a/il_timetable/nodes/(1976,5,7914).lua b/il_timetable/nodes/(1976,5,7914).lua
new file mode 100644
index 0000000..313ac90
--- /dev/null
+++ b/il_timetable/nodes/(1976,5,7914).lua
@@ -0,0 +1,8 @@
+F.ttp_station_display({
+ lines = {"CFE_S"},
+ departure = {},
+ station = "Malvarma Akvo",
+ title = "Malvarma Akvo",
+ interval = 60,
+ display1 = "disp1",
+})
diff --git a/il_timetable/nodes/(1977,3,7354).lua b/il_timetable/nodes/(1977,3,7354).lua
new file mode 100644
index 0000000..61e267f
--- /dev/null
+++ b/il_timetable/nodes/(1977,3,7354).lua
@@ -0,0 +1,4 @@
+F.ttp_stop({
+ stn = "Crystal Farms",
+ doorside = "R",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1980,3,6129).lua b/il_timetable/nodes/(1980,3,6129).lua
new file mode 100644
index 0000000..438b60f
--- /dev/null
+++ b/il_timetable/nodes/(1980,3,6129).lua
@@ -0,0 +1,4 @@
+F.ttp_stop({
+ stn = "Grootshad - X Nihilo",
+ doorside = "R",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1980,3,7922).lua b/il_timetable/nodes/(1980,3,7922).lua
new file mode 100644
index 0000000..9e91259
--- /dev/null
+++ b/il_timetable/nodes/(1980,3,7922).lua
@@ -0,0 +1,4 @@
+F.ttp_stop({
+ stn = "Malvarma Akvo",
+ doorside = "R",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1980,41,8381).lua b/il_timetable/nodes/(1980,41,8381).lua
new file mode 100644
index 0000000..bad022d
--- /dev/null
+++ b/il_timetable/nodes/(1980,41,8381).lua
@@ -0,0 +1,5 @@
+F.ttp_stop({
+ stn = "Azena Transirejo",
+ doorside = "R",
+ only_lines = {CFE=true}
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1980,41,8395).lua b/il_timetable/nodes/(1980,41,8395).lua
new file mode 100644
index 0000000..c763b43
--- /dev/null
+++ b/il_timetable/nodes/(1980,41,8395).lua
@@ -0,0 +1,10 @@
+F.ttp_begin({
+ stn = "Azena Transirejo", -- station name
+ tt = "NRG_W", -- timetable ID
+ depint = "05;00", --departure slot interval
+ depoff = "00;30", --departure slot offset
+ doorside = "L",
+ reverse = true,
+ only_lines = {["CFE-NRG"] = true},
+ force_tt_reset = false, -- force reset of travel times for this timetable
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(2648,13,4352).lua b/il_timetable/nodes/(2648,13,4352).lua
new file mode 100644
index 0000000..565febb
--- /dev/null
+++ b/il_timetable/nodes/(2648,13,4352).lua
@@ -0,0 +1,4 @@
+F.ttp_stop({
+ stn = "GRUB Valley (GVMER)",
+ doorside = "R"
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(286,4,206).lua b/il_timetable/nodes/(286,4,206).lua
new file mode 100644
index 0000000..8713687
--- /dev/null
+++ b/il_timetable/nodes/(286,4,206).lua
@@ -0,0 +1,27 @@
+if event.train then
+st_name = "NYE Square"
+flip = not flip
+end
+
+doors = "L"
+ if event.train then
+ local time_now = rwt.now()
+ local next_dep_time = rwt.next_rpt(rwt.add(time_now, 10), 240, 0)
+if flip then
+ atc_set_text_outside("4 - Showroom")
+ digiline_send("monitor", "4 Showroom "..rwt.to_string(next_dep_time, true))
+ set_rc("SH")
+else
+ digiline_send("monitor", "4 Ice Mountain "..rwt.to_string(next_dep_time, true))
+ atc_set_text_outside("4 - Ice Mountain")
+ set_rc("IM")
+end
+ atc_set_text_inside(st_name.."\nDeparture: "..rwt.to_string(next_dep_time, true))
+ atc_send("B0 W O"..doors)
+ schedule(next_dep_time, "depart")
+ elseif event.schedule then
+ atc_send("OCD1SM")
+ digiline_send("monitor", "Last Departure: | "..rwt.to_string(rwt.now(), true))
+ atc_set_text_inside("")
+ depart = true
+ end
diff --git a/il_timetable/nodes/(767,10,3484).lua b/il_timetable/nodes/(767,10,3484).lua
new file mode 100644
index 0000000..1b4f884
--- /dev/null
+++ b/il_timetable/nodes/(767,10,3484).lua
@@ -0,0 +1,10 @@
+F.ttp_begin({
+ stn = "Stopsleyhood Town Hall", -- station name
+ tt = "NX_S", -- timetable ID
+ depint = "05;00", --departure slot interval
+ depoff = "00;00", --departure slot offset
+ doorside = "L",
+ reverse = false,
+ only_lines = { XN = true },
+ force_tt_reset = false,
+})
diff --git a/il_timetable/nodes/(790,8,-109).lua b/il_timetable/nodes/(790,8,-109).lua
new file mode 100644
index 0000000..78cf1f7
--- /dev/null
+++ b/il_timetable/nodes/(790,8,-109).lua
@@ -0,0 +1,5 @@
+-- d_int: Departure every n seconds (epoch modulo)
+-- d_off: Departure time offset
+-- function F.stop_sd(st_name, doors, departcommand, minstoptime, d_int, d_off)
+atc_set_text_outside("Line 1 - Palm Bay")
+F.stop_sd_sched("Szymon's Dam Regional", "L", "RSM", 10, 120, 0) \ No newline at end of file
diff --git a/il_timetable/nodes/(941,18,-571).lua b/il_timetable/nodes/(941,18,-571).lua
new file mode 100644
index 0000000..38f1073
--- /dev/null
+++ b/il_timetable/nodes/(941,18,-571).lua
@@ -0,0 +1,5 @@
+atc_set_text_outside("Line 1 - Palm Bay")
+-- d_int: Departure every n seconds (epoch modulo)
+-- d_off: Departure time offset
+-- function F.stop_sd(st_name, doors, departcommand, minstoptime, d_int, d_off)
+F.stop_sd_sched("Windy Mountains", "R", "RSM", 10, 240, 60) \ No newline at end of file
diff --git a/il_timetable/nodes/(957,14,1047).lua b/il_timetable/nodes/(957,14,1047).lua
index 74760fd..d28a823 100644
--- a/il_timetable/nodes/(957,14,1047).lua
+++ b/il_timetable/nodes/(957,14,1047).lua
@@ -2,6 +2,10 @@
-- d_off: Departure time offset
-- function F.stop_sd(st_name, doors, departcommand, minstoptime, d_int, d_off)
F.stop_sd_sched("Ehlodex", "R", "SM", 10, 60, 0)
+
+if event.train then
+ F.timetake_end("E1-Psh-Ehl")
+end
if depart then
- setstate("Ehl6ARSPreventer", "st")
+ F.timetake_start("E1-Ehl-Spn")
end \ No newline at end of file
diff --git a/il_timetable/nodes/(960,14,1067).lua b/il_timetable/nodes/(960,14,1067).lua
new file mode 100644
index 0000000..43e2d7d
--- /dev/null
+++ b/il_timetable/nodes/(960,14,1067).lua
@@ -0,0 +1,3 @@
+if event.train then
+F.timetake_start("E1-Ehl-Psh")
+end \ No newline at end of file
diff --git a/il_timetable/nodes/(972,14,1053).lua b/il_timetable/nodes/(972,14,1053).lua
index fde413c..c316b90 100644
--- a/il_timetable/nodes/(972,14,1053).lua
+++ b/il_timetable/nodes/(972,14,1053).lua
@@ -1,4 +1,7 @@
-- d_int: Departure every n seconds (epoch modulo)
-- d_off: Departure time offset
-- function F.stop_sd(st_name, doors, departcommand, minstoptime, d_int, d_off)
-F.stop_sd_sched("Ehlodex", "R", "RSM", 10, 240, 75) \ No newline at end of file
+F.stop_sd_sched("Ehlodex", "R", "RSM", 10, 240, 65)
+if event.train then
+atc_set_text_outside("S12 - Spawn Main Station\nvia Schwarzschild Street, Anju Crossing")
+end \ No newline at end of file
diff --git a/nlvcross/init_code.lua b/nlvcross/init_code.lua
index 6dccede..2a5ffeb 100644
--- a/nlvcross/init_code.lua
+++ b/nlvcross/init_code.lua
@@ -20,6 +20,7 @@ F.crossings={
PH_WestS = 2,
gardonst = 4,
Trs_Church = 3,
+ NRG = 6,
}
--[[ Setting up level crossings:
1. choose a name
diff --git a/nlvcross/nodes/(-117,5,-1975).lua b/nlvcross/nodes/(-117,5,-1975).lua
new file mode 100644
index 0000000..cdcec9a
--- /dev/null
+++ b/nlvcross/nodes/(-117,5,-1975).lua
@@ -0,0 +1,5 @@
+if atc_arrow then
+ F.on("SF1SouthWest", 1)
+else
+ F.off("SF1SouthWest", 1, true)
+end \ No newline at end of file
diff --git a/nlvcross/nodes/(-170,7,-2008).lua b/nlvcross/nodes/(-170,7,-2008).lua
new file mode 100644
index 0000000..cdcec9a
--- /dev/null
+++ b/nlvcross/nodes/(-170,7,-2008).lua
@@ -0,0 +1,5 @@
+if atc_arrow then
+ F.on("SF1SouthWest", 1)
+else
+ F.off("SF1SouthWest", 1, true)
+end \ No newline at end of file
diff --git a/nlvcross/nodes/(1604,-1,8169).lua b/nlvcross/nodes/(1604,-1,8169).lua
new file mode 100644
index 0000000..06d0642
--- /dev/null
+++ b/nlvcross/nodes/(1604,-1,8169).lua
@@ -0,0 +1 @@
+F.off("NRG","S") \ No newline at end of file
diff --git a/nlvcross/nodes/(1607,-1,8169).lua b/nlvcross/nodes/(1607,-1,8169).lua
new file mode 100644
index 0000000..06d0642
--- /dev/null
+++ b/nlvcross/nodes/(1607,-1,8169).lua
@@ -0,0 +1 @@
+F.off("NRG","S") \ No newline at end of file
diff --git a/nlvcross/nodes/(1615,-1,8169).lua b/nlvcross/nodes/(1615,-1,8169).lua
new file mode 100644
index 0000000..de57380
--- /dev/null
+++ b/nlvcross/nodes/(1615,-1,8169).lua
@@ -0,0 +1 @@
+F.on("NRG","N") \ No newline at end of file
diff --git a/nlvcross/nodes/(1618,-1,8169).lua b/nlvcross/nodes/(1618,-1,8169).lua
new file mode 100644
index 0000000..de57380
--- /dev/null
+++ b/nlvcross/nodes/(1618,-1,8169).lua
@@ -0,0 +1 @@
+F.on("NRG","N") \ No newline at end of file
diff --git a/nlvcross/nodes/(1683,26,8220).lua b/nlvcross/nodes/(1683,26,8220).lua
new file mode 100644
index 0000000..a2d877b
--- /dev/null
+++ b/nlvcross/nodes/(1683,26,8220).lua
@@ -0,0 +1 @@
+F.off("NRG","N") \ No newline at end of file
diff --git a/nlvcross/nodes/(1683,26,8223).lua b/nlvcross/nodes/(1683,26,8223).lua
new file mode 100644
index 0000000..c3a20cf
--- /dev/null
+++ b/nlvcross/nodes/(1683,26,8223).lua
@@ -0,0 +1 @@
+F.on("NRG", "S") \ No newline at end of file
diff --git a/nlvcross/nodes/(572,14,1011).lua b/nlvcross/nodes/(572,14,1011).lua
index 5b08d92..4d71073 100644
--- a/nlvcross/nodes/(572,14,1011).lua
+++ b/nlvcross/nodes/(572,14,1011).lua
@@ -1,5 +1,5 @@
if atc_id then
- if get_line()=="E1" and get_aspect("gardonst_lvc_sig1").main.free then
+ if get_line()=="E1" and get_aspect("gardonst_lvc_sig1").main == -1 then
F.on("gardonst","1")
end
end \ No newline at end of file
diff --git a/subway/init_code.lua b/subway/init_code.lua
index ebe0781..20fd5ad 100644
--- a/subway/init_code.lua
+++ b/subway/init_code.lua
@@ -1,3 +1,4 @@
+-- 'subway' environment --
--F.stn_union=function(line1, prev1, prev2, this, next, doors, dps, osig, ret_sw, ret_st, nohalt, waittime)
F.stationnames={
Ewb="Edenwood Beach",
@@ -340,6 +341,13 @@ end
end
end
+local function aspect_is_free(asp)
+ if type(asp.main) == "table" then
+ return asp.main.free
+ else
+ return asp.main ~= 0
+ end
+end
-- 21.1.19, the rise of tss
F.stn_ilk=function(prev, this, next, doors, dps)
@@ -353,7 +361,7 @@ F.stn_ilk=function(prev, this, next, doors, dps)
if not asp then
atc_set_text_inside(F.stnname(this).."\nNo aspect for "..this)
else
- if asp.main.free then
+ if aspect_is_free(asp) then
atc_set_text_inside("Next stop:\n"..F.stnname(next))
atc_send("OC D1 S"..(dps or "M"))
depart = true
diff --git a/subway/nodes/(-1559,-1,697).lua b/subway/nodes/(-1559,-1,697).lua
index fb61529..06e29da 100644
--- a/subway/nodes/(-1559,-1,697).lua
+++ b/subway/nodes/(-1559,-1,697).lua
@@ -1 +1,62 @@
-F.stn("App1W", "Apl1W", "Pal1R", "L") \ No newline at end of file
+--print("Apple Plains: Train",atc_id,"event",event.type,"sigstate",getstate("Apl1W"))
+--F.stn("App1W", "Apl1W", "Pal1R", "L")
+local this = "Apl1W"
+local prev1 = "App1W"
+local doors = "L"
+local next = "Pal1R"
+
+ if not atc_id then
+ print("Apple Plains WTF - Bug happened again. Trying laterrr...")
+ interrupt(20, "ready")
+ return
+ end
+ if not atc_arrow then
+ atc_send("B0")
+ error("Train passed in wrong direction!")
+ end
+ depart=false
+ if event.train then
+ setstate(prev1, "red")
+ if prev2 then setstate(prev2, "red") end
+ atc_send("B0O"..doors)
+
+ if not nohalt then
+ interrupt(waittime or (ret_sw and 20 or 7), "ready")
+ atc_set_text_inside(F.stnname(this))
+ end
+ end
+ if (event.int and event.message=="ready") or (event.train and nohalt) then
+ if getstate(this)=="green" and (not osig or getstate(osig)=="green") then
+ if ret_sw then
+ atc_send("OCD1B0WRS"..(dps or "M"))
+ setstate(ret_sw, ret_st)
+ else
+ atc_send("OCD1S"..(dps or "M"))
+ setstate(prev1, "green")
+ if line1 then --this call did not come from F.stn, do union stuff
+ setstate(prev2, "green")
+ if S.line[atc_id]==line1 then
+ if S.union_waiting[prev2] then setstate(prev1, "red") end
+ else
+ if S.union_waiting[prev1] then setstate(prev2, "red") end
+ end
+ end
+ end
+ setstate(this, "red")
+ atc_set_text_inside("Next stop: "..F.stnname(next))
+ depart=true
+ nodepartc=nil
+ else
+ interrupt(F.rant(), "ready")
+ nodepartc=nodepartc and nodepartc+1 or 0
+ if nodepartc>=10 then
+ atc_set_text_inside(F.stnname(this).."\nLine out of order!")
+ else
+ if (not osig or getstate(osig)=="green") then
+ atc_set_text_inside(F.stnname(this).."\nWaiting for preceding train...")
+ else
+ atc_set_text_inside(F.stnname(this).."\nWaiting for oncoming train...")
+ end
+ end
+ end
+ end \ No newline at end of file
diff --git a/subway/nodes/(-1606,2,595).lua b/subway/nodes/(-1606,2,595).lua
index e1a4cf3..7dbb72c 100644
--- a/subway/nodes/(-1606,2,595).lua
+++ b/subway/nodes/(-1606,2,595).lua
@@ -1,2 +1,12 @@
+if event.train then
+if flip then
+ atc_set_text_outside("1 - Syzmon's Dam")
+ set_rc("Szy")
+else
+ atc_set_text_outside("1 - Windy Mountains")
+ set_rc("1wind")
+end
+flip = not flip
+end
+
F.stn_return("Apl1W", "Pal1R", "Apl1E", "R", "Pal1ES", "cr")
-F.lineset("1", "E")
diff --git a/subway/nodes/(10,0,-10).lua b/subway/nodes/(10,0,-10).lua
index bc56a91..9121a78 100644
--- a/subway/nodes/(10,0,-10).lua
+++ b/subway/nodes/(10,0,-10).lua
@@ -73,7 +73,7 @@ end
local txt = {
[1] = "Windy Mtns.",
- [4] = "Schwarzs...",
+ [4] = "Schwarzs.",
}
local line1, line2, line3 = "", "", ""
if du_line then
diff --git a/subway/nodes/(305,9,34).lua b/subway/nodes/(305,9,34).lua
index 0f9d5a7..e7abef3 100644
--- a/subway/nodes/(305,9,34).lua
+++ b/subway/nodes/(305,9,34).lua
@@ -1,2 +1 @@
-F.stn("Adb1W", "Rru1W", "Wcs1W", "L")
F.stat("Line 1") \ No newline at end of file