summaryrefslogtreecommitdiff
path: root/Crossroads
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-04-22 14:51:45 +0200
committerautocommitter <autocommitter@linux-forks.de>2024-04-22 14:51:45 +0200
commit0b14726c5539782a60d2f4beaed2cfca74a50f7a (patch)
tree1de6e16c565f7bb9806552fc587d7eac870b6b00 /Crossroads
downloadluaatc_envs-0b14726c5539782a60d2f4beaed2cfca74a50f7a.tar.gz
luaatc_envs-0b14726c5539782a60d2f4beaed2cfca74a50f7a.tar.bz2
luaatc_envs-0b14726c5539782a60d2f4beaed2cfca74a50f7a.zip
State at 2019-12-13
Diffstat (limited to 'Crossroads')
-rw-r--r--Crossroads/init_code.lua224
-rw-r--r--Crossroads/nodes/(-5710,2,-3917).lua14
-rw-r--r--Crossroads/nodes/(1083,19,3028).lua5
-rw-r--r--Crossroads/nodes/(1167,8,1013).lua5
-rw-r--r--Crossroads/nodes/(1219,9,1549).lua1
-rw-r--r--Crossroads/nodes/(1223,12,1555).lua5
-rw-r--r--Crossroads/nodes/(1224,12,1555).lua1
-rw-r--r--Crossroads/nodes/(1227,12,1541).lua1
-rw-r--r--Crossroads/nodes/(1228,12,1541).lua5
-rw-r--r--Crossroads/nodes/(1232,9,1547).lua1
-rw-r--r--Crossroads/nodes/(1288,9,1545).lua4
-rw-r--r--Crossroads/nodes/(1350,11,1371).lua1
-rw-r--r--Crossroads/nodes/(1352,11,1389).lua1
-rw-r--r--Crossroads/nodes/(1359,11,1380).lua1
-rw-r--r--Crossroads/nodes/(1388,-9,1321).lua1
-rw-r--r--Crossroads/nodes/(1388,-9,1352).lua1
-rw-r--r--Crossroads/nodes/(1388,-9,1373).lua1
-rw-r--r--Crossroads/nodes/(1393,19,1619).lua1
-rw-r--r--Crossroads/nodes/(1393,19,1709).lua1
-rw-r--r--Crossroads/nodes/(1393,19,1820).lua1
-rw-r--r--Crossroads/nodes/(1393,4,1965).lua1
-rw-r--r--Crossroads/nodes/(1393,8,1489).lua1
-rw-r--r--Crossroads/nodes/(1397,19,1630).lua1
-rw-r--r--Crossroads/nodes/(1397,19,1720).lua1
-rw-r--r--Crossroads/nodes/(1397,4,1977).lua1
-rw-r--r--Crossroads/nodes/(1397,8,1501).lua1
-rw-r--r--Crossroads/nodes/(1400,21,819).lua1
-rw-r--r--Crossroads/nodes/(1402,19,1820).lua1
-rw-r--r--Crossroads/nodes/(1419,26,819).lua1
-rw-r--r--Crossroads/nodes/(1601,5,1992).lua9
-rw-r--r--Crossroads/nodes/(1673,20,985).lua1
-rw-r--r--Crossroads/nodes/(1682,20,971).lua1
-rw-r--r--Crossroads/nodes/(1702,12,914).lua1
-rw-r--r--Crossroads/nodes/(1709,17,914).lua1
-rw-r--r--Crossroads/nodes/(1714,26,1007).lua3
-rw-r--r--Crossroads/nodes/(1720,15,995).lua4
-rw-r--r--Crossroads/nodes/(1746,12,914).lua1
-rw-r--r--Crossroads/nodes/(1746,17,987).lua1
-rw-r--r--Crossroads/nodes/(1753,12,988).lua1
-rw-r--r--Crossroads/nodes/(1753,17,917).lua1
-rw-r--r--Crossroads/nodes/(1755,27,942).lua5
-rw-r--r--Crossroads/nodes/(1755,27,943).lua57
-rw-r--r--Crossroads/nodes/(1767,27,946).lua2
-rw-r--r--Crossroads/nodes/(1773,5,994).lua1
-rw-r--r--Crossroads/nodes/(1790,5,1020).lua1
-rw-r--r--Crossroads/nodes/(1795,5,1000).lua5
-rw-r--r--Crossroads/nodes/(1796,25,1011).lua1
-rw-r--r--Crossroads/nodes/(1796,25,1019).lua1
-rw-r--r--Crossroads/nodes/(1801,5,1008).lua5
-rw-r--r--Crossroads/nodes/(2009,4,993).lua1
-rw-r--r--Crossroads/nodes/(2022,4,993).lua1
-rw-r--r--Crossroads/nodes/(2254,4,991).lua1
-rw-r--r--Crossroads/nodes/(2254,4,997).lua1
-rw-r--r--Crossroads/nodes/(544,11,2152).lua9
-rw-r--r--Crossroads/nodes/(851,14,773).lua12
-rw-r--r--Crossroads/nodes/(852,12,710).lua6
-rw-r--r--Crossroads/nodes/(861,12,725).lua6
-rw-r--r--Crossroads/nodes/(864,14,793).lua11
-rw-r--r--Crossroads/nodes/(867,14,776).lua12
-rw-r--r--Crossroads/nodes/(880,14,789).lua1
-rw-r--r--Crossroads/nodes/(881,6,886).lua6
-rw-r--r--Crossroads/nodes/(898,14,835).lua6
62 files changed, 459 insertions, 0 deletions
diff --git a/Crossroads/init_code.lua b/Crossroads/init_code.lua
new file mode 100644
index 0000000..aa4e66d
--- /dev/null
+++ b/Crossroads/init_code.lua
@@ -0,0 +1,224 @@
+--[[
+This environment has programs that can be separated to three parts:
+I) Common functions
+II) Common variables
+III) ATL/CRT Bronze Line
+]]
+
+-- I) Common Functions
+if S.trains == nil then S.trains = {} end
+
+-- F.dst - Get summer time
+function F.dst()
+ if os.date().isdst then return "CEST" else return "CET" end
+end
+-- F.error - Send error with error code
+function F.error(errorcode)
+ error(F.errlist[errorcode])
+end
+--[[ F.stnbasic - Basis for all station functions:
+(By default, nil is defined as false or "no changes")
+stn = Station Code
+side = Door opening side
+optime = Length of time before train departs
+reverse = Reverse train before departing
+acc = Departure Speed
+out = Change outside text
+reventry = Allow trains to pass from the reverse direction
+predepart = Function to execute before departure
+postdepart = Function to execute after departure
+next = Next stop
+]]
+function F.stnbasic(stn, side, optime, reverse, acc, out, reventry, predepart, postdepart, next,track)
+ if event.train then
+ if atc_arrow then
+ local cmdstr=""
+ if out~=nil then atc_set_text_outside(out) end
+ if stn==nil then atc_set_text_inside("Unknown Station")
+ else atc_set_text_inside(F.stnlist[stn]) end
+ cmdstr="BBWO"..(side or "R")
+ if predepart~=nil then predepart() end
+ S.trains[atc_id] = "P "..stn.." "..(track or "x")
+ cmdstr=cmdstr.."D"..(optime or 15)
+ cmdstr=cmdstr.."OCD2"
+ if reverse then cmdstr=cmdstr.."R" end
+ cmdstr=cmdstr.."S"..(acc or "M")
+ atc_send(cmdstr)
+ interrupt((optime or 15)+2)
+ else
+ if reventry==nil then F.error("wrong_direction")
+ else
+ if not reventry then F.error("wrong_direction") end
+ end
+ end
+ end
+ if event.int then
+ if atc_id ~= nil then
+ if next == nil then atc_set_text_inside("") else atc_set_text_inside("Next stop: "..F.stnlist[next]) end
+ if postdepart~=nil then postdepart() end
+ end
+ end
+end
+
+-- F.hst - preset function for small stations (Haltestelle)
+function F.hst(cur, nxt, side, spd, out, trk)
+ F.stnbasic(cur, side, 10, false, spd, out, true, nil, nil, nxt, trk)
+end
+
+-- F.bhf - preset function for large stations (Bahnhof)
+function F.bhf(cur, nxt, side, spd, out, trk)
+ F.stnbasic(cur, side, 15, false, spd, out, true, nil, nil, nxt, trk)
+end
+
+-- F.kbhf - preset function for termini
+function F.kbhf(cur, nxt, side, spd, out, trk)
+ F.stnbasic(cur, side, 15, true, spd, out, true, nil, nil, nxt, trk)
+end
+
+-- F.timing - station with timing
+function F.timing(d_off, d_int, cur, nxt, side, spd, out, trk, term, pre, post)
+ local timenow = os.time()
+ local timerdy = timenow + 8
+ local wait = d_int - ((timerdy-d_off) % d_int)
+ local waitcorr = math.floor(wait*0.66)
+ F.stnbasic(cur, side, waitcorr, term, spd, out, true, pre, post, nxt, trk)
+end
+
+-- F.brk(direction) - sends ATC B2 command
+function F.brk(dir)
+ if event.type == "train" then
+ if atc_arrow == dir then
+ atc_send("B2S2")
+ end
+ end
+end
+
+--[[ F.eval - similar to the ? : operator in C
+expr = the expression to evaluate
+rettrue = the value to return if expr is true
+retfalse = the value to return if expr is false
+]]
+function F.eval(expr, rettrue, retfalse)
+ if expr then return rettrue else return retfalse end
+end
+
+function F.checkpoint(name,arrow,opp)
+ if event.train then
+ S.trains[atc_id] = "C "..name.." "
+ if atc_arrow then
+ S.trains[atc_id] = S.trains[atc_id]..arrow
+ else
+ S.trains[atc_id] = S.trains[atc_id]..opp
+ end
+ end
+end
+
+--[[ II) Common Variables
+F.stnlist = List of stations
+F.errlist = List of errors
+F.depint = Departure intervals
+]]
+F.stnlist = {
+ cg = "Colored Grasses",
+ clockwise = "Clockwise Route",
+ counterclockwise = "Counterclockwise Route",
+ cras = "Crossroads ARSE7's Shop",
+ crbfost = "Crossroads Station East",
+ crbfsm = "Crossroads Station St. Central",
+ crbfso = "Crossroads Station St. East",
+ crbfsw = "Crossroads Station St. West",
+ crch = "Crossroads City Hall",
+ crchs = "Crossroads City Hall South",
+ crmtrail = "Crossroads Mountain Railway Termius",
+ crnsw = "CR-North Station St. Ferry (W.)",
+ crrathaus = "Crossroads City Hall",
+ crsmacker = "Crossroads Smacker's Station",
+ crwm = "Crossroads-West Mountains",
+ crzn = "Crossroads-Zentrum/Nordstadt",
+ el = "Erstaziland",
+ elchateau = "Chateau d'Erstazi",
+ elgp = "Erstaziland Greener Pastures",
+ elsf = "Erstaziland Salt Factory",
+ evo = "EVO",
+ mushroom = "Mushroom Land",
+ neverbuild = "Neverbuild",
+ nvbcentral = "Neverbuild Central",
+ nvbold = "Neverbuild Old Termius",
+ nvboutskirts = "Neverbuild Outskirts",
+ oc = "Ocean City",
+ occh = "Ocean City, City Hall",
+ occrt = "Ocean City, CRT Office",
+ ocmushroom = "Ocean City, Mushroom Market",
+ ocoutskirts = "Ocean City Outskirts",
+ phwest = "Personhood, West",
+ scc = "Silver Coast Central",
+ scn = "Silver Coast North",
+ scs = "Silver Coast South",
+}
+F.errlist = {
+ ["runaway_train"] = "Runaway train found!",
+ ["train_disappeared"] = "Train has disappeared!",
+ ["unexpected_train"] = "Train is not expected to pass!",
+ ["wrong_direction"] = "Train passed in wrong direction!",
+}
+F.depint = {
+ ["AB"] = 60,
+ ["AG"] = 120,
+ ["CRT1"] = 30,
+}
+
+-- ATL/CRT Bronze Line
+
+-- Colored Grasses
+F.ab_cgw="--:-- "..F.dst()
+F.ab_cge="--:-- "..F.dst()
+
+F.ab_status = "Irregular operation"
+
+F.cg_disp = function()
+ if event.digiline then
+ if event.digiline then if not event.channel=="upd" then return end end
+ local t=os.date()
+ local cg="Colored Grasses\nATL/CRT Bronze Line\n"
+ local str = string.format("%s\n"..F.ab_status.." \n", os.date("%d %b %Y %H:%M %z",os.time()))
+ local abf = os.date("%H:%M %z",os.time()+60)
+ digiline_send("bstg1-1",cg.."<-- Personhood West\n[1] via The Cube")
+ digiline_send("bstg1-2",string.format("%s%27s\n%27s",str,"Crossroads City Hall -->","via Silver Coast [2]"))
+ digiline_send("bstg2-1",cg.."<-- Crossroads City Hall\n[2] via Silver Coast")
+ digiline_send("bstg2-2",string.format("%s%27s\n%27s",str,"Personhood West -->","via The Cube [1]"))
+ digiline_send("bstg3","Scheduled departure (Track\nScheduled departure (Track")
+ digiline_send("bstg4","1): "..abf.."\n2): "..abf)
+ return
+ end
+ return
+end
+
+function F.cg_stn(gleis)
+ if event.train and atc_arrow then
+ if get_line()~="AB" then atc_send("SM") return end
+ atc_send("B0 W OR")
+ local time=os.date()
+ if time.sec>50 then time.sec=time.sec-11 end
+ local m=""
+ if time.min>58 then
+ m = string.format("%s%02d:%02d", m, F.eval(time.hour > 22, time.hour - 24, time.hour) + 1, time.min - 59)
+ else
+ m = string.format("%s%02d:%02d", m, time.hour, time.min + 1)
+ end
+ m = m .. " " .. F.dst()
+ atc_set_text_inside("Colored Grasses\nThis train will depart at: "..m)
+ interrupt(60-time.sec,"depart")
+ if gleis==1 then F.ab_cgw=m
+ else F.ab_cge=m
+ end
+ end
+ if event.int and event.message=="depart" then
+ atc_set_text_inside("")
+ time = os.date()
+ local nxt = string.format("%02d:%02d %s", F.eval(time.min>58, F.eval(time.hour>22, time.hour-23, time.hour+1), time.hour), F.eval(time.min>58, time.min-59, time.min+1), F.dst())
+ atc_send("OC D1 SM")
+ if gleis==1 then F.ab_cgw=nxt
+ else F.ab_cge=nxt
+ end
+ end
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(-5710,2,-3917).lua b/Crossroads/nodes/(-5710,2,-3917).lua
new file mode 100644
index 0000000..65f7991
--- /dev/null
+++ b/Crossroads/nodes/(-5710,2,-3917).lua
@@ -0,0 +1,14 @@
+local testpos=POS(-5716,2,-3919)
+local chn="out"
+local newstate=nil
+
+if event.type=="punch" then
+ if is_passive(testpos) then
+ if newstate==nil then digiline_send(chn," true\n "..getstate(testpos))
+ else
+ digiline_send(chn," true\n "..getstate(testpos).."\n "..newstate)
+ setstate(testpos,newstate)
+ end
+ else digiline_send(chn," false")
+ end
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1083,19,3028).lua b/Crossroads/nodes/(1083,19,3028).lua
new file mode 100644
index 0000000..0e5b482
--- /dev/null
+++ b/Crossroads/nodes/(1083,19,3028).lua
@@ -0,0 +1,5 @@
+if event.train then
+ if not atc_arrow then return end
+ atc_set_text_outside("ATL/CRT Bronze Line - Crossroads City Hall")
+ set_line("AB")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1167,8,1013).lua b/Crossroads/nodes/(1167,8,1013).lua
new file mode 100644
index 0000000..5f46f5d
--- /dev/null
+++ b/Crossroads/nodes/(1167,8,1013).lua
@@ -0,0 +1,5 @@
+if event.type == "train" then
+ if atc_arrow then
+ atc_set_text_outside("ATL Mithril Line - Crossroads")
+ end
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1219,9,1549).lua b/Crossroads/nodes/(1219,9,1549).lua
new file mode 100644
index 0000000..e08cb42
--- /dev/null
+++ b/Crossroads/nodes/(1219,9,1549).lua
@@ -0,0 +1 @@
+F.cg_stn(1) \ No newline at end of file
diff --git a/Crossroads/nodes/(1223,12,1555).lua b/Crossroads/nodes/(1223,12,1555).lua
new file mode 100644
index 0000000..b07a528
--- /dev/null
+++ b/Crossroads/nodes/(1223,12,1555).lua
@@ -0,0 +1,5 @@
+if event.type == "digiline" then
+ if event.channel == "updwrapper" then
+ digiline_send("upd","update")
+ end
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1224,12,1555).lua b/Crossroads/nodes/(1224,12,1555).lua
new file mode 100644
index 0000000..a150241
--- /dev/null
+++ b/Crossroads/nodes/(1224,12,1555).lua
@@ -0,0 +1 @@
+F.cg_disp() \ No newline at end of file
diff --git a/Crossroads/nodes/(1227,12,1541).lua b/Crossroads/nodes/(1227,12,1541).lua
new file mode 100644
index 0000000..a150241
--- /dev/null
+++ b/Crossroads/nodes/(1227,12,1541).lua
@@ -0,0 +1 @@
+F.cg_disp() \ No newline at end of file
diff --git a/Crossroads/nodes/(1228,12,1541).lua b/Crossroads/nodes/(1228,12,1541).lua
new file mode 100644
index 0000000..b07a528
--- /dev/null
+++ b/Crossroads/nodes/(1228,12,1541).lua
@@ -0,0 +1,5 @@
+if event.type == "digiline" then
+ if event.channel == "updwrapper" then
+ digiline_send("upd","update")
+ end
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1232,9,1547).lua b/Crossroads/nodes/(1232,9,1547).lua
new file mode 100644
index 0000000..4e4a905
--- /dev/null
+++ b/Crossroads/nodes/(1232,9,1547).lua
@@ -0,0 +1 @@
+F.cg_stn(2) \ No newline at end of file
diff --git a/Crossroads/nodes/(1288,9,1545).lua b/Crossroads/nodes/(1288,9,1545).lua
new file mode 100644
index 0000000..f0f7da4
--- /dev/null
+++ b/Crossroads/nodes/(1288,9,1545).lua
@@ -0,0 +1,4 @@
+if event.train and atc_arrow then
+ atc_send("B8S8")
+ atc_set_text_inside("Next station:\nColored Grasses")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1350,11,1371).lua b/Crossroads/nodes/(1350,11,1371).lua
new file mode 100644
index 0000000..a9a4f88
--- /dev/null
+++ b/Crossroads/nodes/(1350,11,1371).lua
@@ -0,0 +1 @@
+F.bhf("oc","scn","R","M",nil,"ZS") \ No newline at end of file
diff --git a/Crossroads/nodes/(1352,11,1389).lua b/Crossroads/nodes/(1352,11,1389).lua
new file mode 100644
index 0000000..1b4c4ac
--- /dev/null
+++ b/Crossroads/nodes/(1352,11,1389).lua
@@ -0,0 +1 @@
+F.bhf("oc","elgp","R","M",nil,"ZN") \ No newline at end of file
diff --git a/Crossroads/nodes/(1359,11,1380).lua b/Crossroads/nodes/(1359,11,1380).lua
new file mode 100644
index 0000000..9214f4d
--- /dev/null
+++ b/Crossroads/nodes/(1359,11,1380).lua
@@ -0,0 +1 @@
+F.timing(215, F.depint["AG"], "oc","ocoutskirts","R","M","ATL Gold Line - Neverbuild Central","T",true) \ No newline at end of file
diff --git a/Crossroads/nodes/(1388,-9,1321).lua b/Crossroads/nodes/(1388,-9,1321).lua
new file mode 100644
index 0000000..64642da
--- /dev/null
+++ b/Crossroads/nodes/(1388,-9,1321).lua
@@ -0,0 +1 @@
+F.hst("ocmushroom","occh","L",8,nil,"2") \ No newline at end of file
diff --git a/Crossroads/nodes/(1388,-9,1352).lua b/Crossroads/nodes/(1388,-9,1352).lua
new file mode 100644
index 0000000..44e8f92
--- /dev/null
+++ b/Crossroads/nodes/(1388,-9,1352).lua
@@ -0,0 +1 @@
+F.hst("occrt","ocmushroom","L",7,nil,"2") \ No newline at end of file
diff --git a/Crossroads/nodes/(1388,-9,1373).lua b/Crossroads/nodes/(1388,-9,1373).lua
new file mode 100644
index 0000000..c53d4a6
--- /dev/null
+++ b/Crossroads/nodes/(1388,-9,1373).lua
@@ -0,0 +1 @@
+F.hst("occh","occrt","R",8,nil,"2") \ No newline at end of file
diff --git a/Crossroads/nodes/(1393,19,1619).lua b/Crossroads/nodes/(1393,19,1619).lua
new file mode 100644
index 0000000..02e416b
--- /dev/null
+++ b/Crossroads/nodes/(1393,19,1619).lua
@@ -0,0 +1 @@
+F.timing(125,F.depint["AG"],"nvboutskirts", "ocoutskirts", "R", "M", nil, "S") \ No newline at end of file
diff --git a/Crossroads/nodes/(1393,19,1709).lua b/Crossroads/nodes/(1393,19,1709).lua
new file mode 100644
index 0000000..4eaa76f
--- /dev/null
+++ b/Crossroads/nodes/(1393,19,1709).lua
@@ -0,0 +1 @@
+F.timing(85, F.depint["AG"], "mushroom", "nvboutskirts", "R", "M", nil, "S") \ No newline at end of file
diff --git a/Crossroads/nodes/(1393,19,1820).lua b/Crossroads/nodes/(1393,19,1820).lua
new file mode 100644
index 0000000..fada4e2
--- /dev/null
+++ b/Crossroads/nodes/(1393,19,1820).lua
@@ -0,0 +1 @@
+F.timing(50,F.depint["AG"],"nvbold","mushroom","L","M",nil,"S") \ No newline at end of file
diff --git a/Crossroads/nodes/(1393,4,1965).lua b/Crossroads/nodes/(1393,4,1965).lua
new file mode 100644
index 0000000..0f6692c
--- /dev/null
+++ b/Crossroads/nodes/(1393,4,1965).lua
@@ -0,0 +1 @@
+F.timing(0, F.depint["AG"], "nvbcentral", "nvbold", "R", "M", "ATL Gold Line - Ocean City","GS") \ No newline at end of file
diff --git a/Crossroads/nodes/(1393,8,1489).lua b/Crossroads/nodes/(1393,8,1489).lua
new file mode 100644
index 0000000..2c08535
--- /dev/null
+++ b/Crossroads/nodes/(1393,8,1489).lua
@@ -0,0 +1 @@
+F.timing(165,F.depint["AG"],"ocoutskirts","oc","R","M",nil,"S") \ No newline at end of file
diff --git a/Crossroads/nodes/(1397,19,1630).lua b/Crossroads/nodes/(1397,19,1630).lua
new file mode 100644
index 0000000..d343142
--- /dev/null
+++ b/Crossroads/nodes/(1397,19,1630).lua
@@ -0,0 +1 @@
+F.timing(305,F.depint["AG"],"nvboutskirts", "mushroom", "R", "M", nil, "N") \ No newline at end of file
diff --git a/Crossroads/nodes/(1397,19,1720).lua b/Crossroads/nodes/(1397,19,1720).lua
new file mode 100644
index 0000000..85d220d
--- /dev/null
+++ b/Crossroads/nodes/(1397,19,1720).lua
@@ -0,0 +1 @@
+F.timing(345,F.depint["AG"],"mushroom","nvbold","R","M",nil,"N") \ No newline at end of file
diff --git a/Crossroads/nodes/(1397,4,1977).lua b/Crossroads/nodes/(1397,4,1977).lua
new file mode 100644
index 0000000..d42c671
--- /dev/null
+++ b/Crossroads/nodes/(1397,4,1977).lua
@@ -0,0 +1 @@
+F.bhf("nvbcentral","nvbcentral","R","8","ATL Gold Line - Ocean City","N") \ No newline at end of file
diff --git a/Crossroads/nodes/(1397,8,1501).lua b/Crossroads/nodes/(1397,8,1501).lua
new file mode 100644
index 0000000..58832a9
--- /dev/null
+++ b/Crossroads/nodes/(1397,8,1501).lua
@@ -0,0 +1 @@
+F.timing(265,F.depint["AG"],"ocoutskirts","nvboutskirts","R","M", nil, "N") \ No newline at end of file
diff --git a/Crossroads/nodes/(1400,21,819).lua b/Crossroads/nodes/(1400,21,819).lua
new file mode 100644
index 0000000..4b632e4
--- /dev/null
+++ b/Crossroads/nodes/(1400,21,819).lua
@@ -0,0 +1 @@
+F.bhf("crwm","scs","L","M",nil,"FW") \ No newline at end of file
diff --git a/Crossroads/nodes/(1402,19,1820).lua b/Crossroads/nodes/(1402,19,1820).lua
new file mode 100644
index 0000000..6569ce9
--- /dev/null
+++ b/Crossroads/nodes/(1402,19,1820).lua
@@ -0,0 +1 @@
+F.timing(385, F.depint["AG"], "nvbold", "nvbcentral", "L", "M", nil, "N") \ No newline at end of file
diff --git a/Crossroads/nodes/(1419,26,819).lua b/Crossroads/nodes/(1419,26,819).lua
new file mode 100644
index 0000000..e3c0adf
--- /dev/null
+++ b/Crossroads/nodes/(1419,26,819).lua
@@ -0,0 +1 @@
+F.bhf("crwm","crch","R","M",nil,"1") \ No newline at end of file
diff --git a/Crossroads/nodes/(1601,5,1992).lua b/Crossroads/nodes/(1601,5,1992).lua
new file mode 100644
index 0000000..4cb1cb8
--- /dev/null
+++ b/Crossroads/nodes/(1601,5,1992).lua
@@ -0,0 +1,9 @@
+--
+local interval = 900 -- Interval in seconds
+local offset = interval/2 -- Offset for the timing system
+if event.type == "train" then
+ if atc_arrow then
+ interrupt_time = (offset-os.time())%interval
+ atc_send(string.format("BBWD%dRSM",interrupt_time))
+ end
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1673,20,985).lua b/Crossroads/nodes/(1673,20,985).lua
new file mode 100644
index 0000000..20d4674
--- /dev/null
+++ b/Crossroads/nodes/(1673,20,985).lua
@@ -0,0 +1 @@
+F.stnbasic("crsmacker", "L", (30-os.date().sec)%30, false, "M", "CRT 1 - Counterclockwise Route", false, nil, nil, "cras", "2") \ No newline at end of file
diff --git a/Crossroads/nodes/(1682,20,971).lua b/Crossroads/nodes/(1682,20,971).lua
new file mode 100644
index 0000000..048d9f3
--- /dev/null
+++ b/Crossroads/nodes/(1682,20,971).lua
@@ -0,0 +1 @@
+F.stnbasic("crsmacker", "L", (27-os.date().sec)%30+5, false, "M", "CRT 1 - Clockwise Route", false, nil, nil, "crch", "1") \ No newline at end of file
diff --git a/Crossroads/nodes/(1702,12,914).lua b/Crossroads/nodes/(1702,12,914).lua
new file mode 100644
index 0000000..27def93
--- /dev/null
+++ b/Crossroads/nodes/(1702,12,914).lua
@@ -0,0 +1 @@
+F.hst("cras","crsmacker","L","M",nil,"1") \ No newline at end of file
diff --git a/Crossroads/nodes/(1709,17,914).lua b/Crossroads/nodes/(1709,17,914).lua
new file mode 100644
index 0000000..1375bd7
--- /dev/null
+++ b/Crossroads/nodes/(1709,17,914).lua
@@ -0,0 +1 @@
+F.hst("cras","crchs","R","M",nil,"2") \ No newline at end of file
diff --git a/Crossroads/nodes/(1714,26,1007).lua b/Crossroads/nodes/(1714,26,1007).lua
new file mode 100644
index 0000000..7193ddb
--- /dev/null
+++ b/Crossroads/nodes/(1714,26,1007).lua
@@ -0,0 +1,3 @@
+if event.train and atc_arrow then
+ atc_set_text_inside("Next stop: Crossroads City Hall")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1720,15,995).lua b/Crossroads/nodes/(1720,15,995).lua
new file mode 100644
index 0000000..c9162ac
--- /dev/null
+++ b/Crossroads/nodes/(1720,15,995).lua
@@ -0,0 +1,4 @@
+if event.train then
+atc_set_text_inside("Next station:\nCrossroads City Hall")
+atc_set_text_outside("ATL/CRT Bronze Line - Personhood West")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1746,12,914).lua b/Crossroads/nodes/(1746,12,914).lua
new file mode 100644
index 0000000..4a5be7d
--- /dev/null
+++ b/Crossroads/nodes/(1746,12,914).lua
@@ -0,0 +1 @@
+F.hst("crchs","cras","R",8,nil,"1") \ No newline at end of file
diff --git a/Crossroads/nodes/(1746,17,987).lua b/Crossroads/nodes/(1746,17,987).lua
new file mode 100644
index 0000000..819ca25
--- /dev/null
+++ b/Crossroads/nodes/(1746,17,987).lua
@@ -0,0 +1 @@
+F.hst("crch","crsmacker","L","M",nil,"R2") \ No newline at end of file
diff --git a/Crossroads/nodes/(1753,12,988).lua b/Crossroads/nodes/(1753,12,988).lua
new file mode 100644
index 0000000..c3dce37
--- /dev/null
+++ b/Crossroads/nodes/(1753,12,988).lua
@@ -0,0 +1 @@
+F.hst("crch","crchs","R","M",nil,"R1") \ No newline at end of file
diff --git a/Crossroads/nodes/(1753,17,917).lua b/Crossroads/nodes/(1753,17,917).lua
new file mode 100644
index 0000000..4e4f080
--- /dev/null
+++ b/Crossroads/nodes/(1753,17,917).lua
@@ -0,0 +1 @@
+F.hst("crchs","crch","L","M",nil,"1") \ No newline at end of file
diff --git a/Crossroads/nodes/(1755,27,942).lua b/Crossroads/nodes/(1755,27,942).lua
new file mode 100644
index 0000000..f208c95
--- /dev/null
+++ b/Crossroads/nodes/(1755,27,942).lua
@@ -0,0 +1,5 @@
+if event.type == "digiline" then
+ if event.channel == "upd_wrapper" then
+ digiline_send("upd_main","")
+ end
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1755,27,943).lua b/Crossroads/nodes/(1755,27,943).lua
new file mode 100644
index 0000000..01ed586
--- /dev/null
+++ b/Crossroads/nodes/(1755,27,943).lua
@@ -0,0 +1,57 @@
+local head="TRAIN STATUS"
+local function trainpairs(t, f)
+ local a = {}
+ for n in pairs(t) do table.insert(a, n) end
+ table.sort(a, f)
+ local i = 0
+ local iter = function ()
+ i = i + 1
+ if a[i] == nil then return nil
+ else return a[i], t[a[i]]
+ end
+ end
+ return iter
+end
+local length = 18
+if event.type=="digiline" then
+ if event.channel=="upd_main" then
+ local start_t = os.clock()
+ if not S.lagrec then S.lagrec = {} end
+ local l = {}
+ local i
+ for i=1,length,1 do
+ if i%2 == 0 then
+ l[i]=""
+ else
+ l[i]=head
+ end
+ end
+ local counter=0
+ for id,st in trainpairs(S.trains) do
+ if (counter) % 7 < 3 then
+ i = (counter - counter % 7) / 7 * 2 + 1
+ else
+ i = (counter - counter % 7) / 7 * 2 + 2
+ end
+ l[i] = l[i] .. "\n" .. id .. " " .. st
+ counter = counter + 1
+ end
+ for i=1,length,1 do
+ if l[i]=="" then
+ digiline_send("d"..tostring(i),"...")
+ else
+ digiline_send("d"..tostring(i),l[i])
+ end
+ end
+ local end_t = os.clock()
+ table.insert(S.lagrec,end_t - start_t)
+ table.sort(S.lagrec)
+ local lagavg = 0
+ for _,v in pairs(S.lagrec) do
+ lagavg = lagavg + v
+ end
+ lagavg = lagavg / #S.lagrec
+ digiline_send("lag1", "DEBUG\nTRAINS: " .. counter .. "\nDISPS: " .. length .. "\nTIME: " .. os.date("%d %b %Y %X"))
+ digiline_send("lag2", "CUR " .. (end_t - start_t) .. "\nMIN " .. S.lagrec[1] .. "\nMAX " .. S.lagrec[#S.lagrec] .. "\nAVG " .. lagavg)
+ end
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1767,27,946).lua b/Crossroads/nodes/(1767,27,946).lua
new file mode 100644
index 0000000..27d996d
--- /dev/null
+++ b/Crossroads/nodes/(1767,27,946).lua
@@ -0,0 +1,2 @@
+S.trains = {}
+S.lagavg = {} \ No newline at end of file
diff --git a/Crossroads/nodes/(1773,5,994).lua b/Crossroads/nodes/(1773,5,994).lua
new file mode 100644
index 0000000..575cb88
--- /dev/null
+++ b/Crossroads/nodes/(1773,5,994).lua
@@ -0,0 +1 @@
+F.timing(0, F.depint["AB"], "crch", "crwm", "R", "M", "ATL/CRT Bronze Line - Personhood West", "1", true) \ No newline at end of file
diff --git a/Crossroads/nodes/(1790,5,1020).lua b/Crossroads/nodes/(1790,5,1020).lua
new file mode 100644
index 0000000..b7a24f0
--- /dev/null
+++ b/Crossroads/nodes/(1790,5,1020).lua
@@ -0,0 +1 @@
+F.kbhf("crrathaus","crbfsw","L","M","CRT2 - Crossroads North","5") \ No newline at end of file
diff --git a/Crossroads/nodes/(1795,5,1000).lua b/Crossroads/nodes/(1795,5,1000).lua
new file mode 100644
index 0000000..ccf3e26
--- /dev/null
+++ b/Crossroads/nodes/(1795,5,1000).lua
@@ -0,0 +1,5 @@
+if event.type == "train" then
+ if atc_arrow then
+ atc_set_text_inside("Next stop: CR-North Station St. Ferry (West)")
+ end
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(1796,25,1011).lua b/Crossroads/nodes/(1796,25,1011).lua
new file mode 100644
index 0000000..9aafeb8
--- /dev/null
+++ b/Crossroads/nodes/(1796,25,1011).lua
@@ -0,0 +1 @@
+F.kbhf("crch","crwm","L","M","CRT 12","C4") \ No newline at end of file
diff --git a/Crossroads/nodes/(1796,25,1019).lua b/Crossroads/nodes/(1796,25,1019).lua
new file mode 100644
index 0000000..69f3d92
--- /dev/null
+++ b/Crossroads/nodes/(1796,25,1019).lua
@@ -0,0 +1 @@
+F.kbhf("crch","crch","R","M",nil,"C5") \ No newline at end of file
diff --git a/Crossroads/nodes/(1801,5,1008).lua b/Crossroads/nodes/(1801,5,1008).lua
new file mode 100644
index 0000000..7741b35
--- /dev/null
+++ b/Crossroads/nodes/(1801,5,1008).lua
@@ -0,0 +1,5 @@
+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
diff --git a/Crossroads/nodes/(2009,4,993).lua b/Crossroads/nodes/(2009,4,993).lua
new file mode 100644
index 0000000..7006284
--- /dev/null
+++ b/Crossroads/nodes/(2009,4,993).lua
@@ -0,0 +1 @@
+F.hst("crbfsw","crch","L","M",nil,"W") \ No newline at end of file
diff --git a/Crossroads/nodes/(2022,4,993).lua b/Crossroads/nodes/(2022,4,993).lua
new file mode 100644
index 0000000..5cfe913
--- /dev/null
+++ b/Crossroads/nodes/(2022,4,993).lua
@@ -0,0 +1 @@
+F.hst("crbfsw","crnsw","R","M",nil,"E") \ No newline at end of file
diff --git a/Crossroads/nodes/(2254,4,991).lua b/Crossroads/nodes/(2254,4,991).lua
new file mode 100644
index 0000000..9340cff
--- /dev/null
+++ b/Crossroads/nodes/(2254,4,991).lua
@@ -0,0 +1 @@
+F.kbhf("crnsw","crbfsw","R","M","CRT2 - Crossroads City Hall","1") \ No newline at end of file
diff --git a/Crossroads/nodes/(2254,4,997).lua b/Crossroads/nodes/(2254,4,997).lua
new file mode 100644
index 0000000..94928cd
--- /dev/null
+++ b/Crossroads/nodes/(2254,4,997).lua
@@ -0,0 +1 @@
+F.kbhf("crnsw","crch","L","M","ATL Mithril Line - Ehlodex","2") \ No newline at end of file
diff --git a/Crossroads/nodes/(544,11,2152).lua b/Crossroads/nodes/(544,11,2152).lua
new file mode 100644
index 0000000..69612c9
--- /dev/null
+++ b/Crossroads/nodes/(544,11,2152).lua
@@ -0,0 +1,9 @@
+--
+local interval = 900 -- Interval in seconds
+local offset = 0 -- Offset for the timing system
+if event.type == "train" then
+ if atc_arrow then
+ interrupt_time = (offset-os.time())%interval
+ atc_send(string.format("BBWD%dRSM",interrupt_time))
+ end
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(851,14,773).lua b/Crossroads/nodes/(851,14,773).lua
new file mode 100644
index 0000000..aabbc7b
--- /dev/null
+++ b/Crossroads/nodes/(851,14,773).lua
@@ -0,0 +1,12 @@
+if event.train then
+ if atc_arrow then
+ atc_send("B0 W OL")
+ atc_set_text_inside("EVO")
+ interrupt(15)
+ end
+end
+
+if event.int then
+ atc_send("OCD2SM")
+ atc_set_text_inside("")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(852,12,710).lua b/Crossroads/nodes/(852,12,710).lua
new file mode 100644
index 0000000..7d7b203
--- /dev/null
+++ b/Crossroads/nodes/(852,12,710).lua
@@ -0,0 +1,6 @@
+if event.train then
+ if atc_arrow then
+ atc_send("B14S14")
+ atc_set_text_inside("Next station: EVO")
+ end
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(861,12,725).lua b/Crossroads/nodes/(861,12,725).lua
new file mode 100644
index 0000000..7d7b203
--- /dev/null
+++ b/Crossroads/nodes/(861,12,725).lua
@@ -0,0 +1,6 @@
+if event.train then
+ if atc_arrow then
+ atc_send("B14S14")
+ atc_set_text_inside("Next station: EVO")
+ end
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(864,14,793).lua b/Crossroads/nodes/(864,14,793).lua
new file mode 100644
index 0000000..da49bc9
--- /dev/null
+++ b/Crossroads/nodes/(864,14,793).lua
@@ -0,0 +1,11 @@
+if event.train then
+ if atc_arrow then
+ atc_send("B0 W OL")
+ atc_set_text_inside("EVO")
+ interrupt(15)
+ end
+end
+if event.int then
+ atc_send("OCD2SM")
+ atc_set_text_inside("")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(867,14,776).lua b/Crossroads/nodes/(867,14,776).lua
new file mode 100644
index 0000000..08ccb2c
--- /dev/null
+++ b/Crossroads/nodes/(867,14,776).lua
@@ -0,0 +1,12 @@
+if event.train then
+ if atc_arrow then
+ atc_send("B0WOL")
+ atc_set_text_inside("EVO")
+ interrupt(15)
+ end
+end
+
+if event.int then
+ atc_set_text_inside("")
+ atc_send("OCD2SM")
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(880,14,789).lua b/Crossroads/nodes/(880,14,789).lua
new file mode 100644
index 0000000..f6c14b8
--- /dev/null
+++ b/Crossroads/nodes/(880,14,789).lua
@@ -0,0 +1 @@
+F.bhf("evo","scs","L","M",nil,"ZN") \ No newline at end of file
diff --git a/Crossroads/nodes/(881,6,886).lua b/Crossroads/nodes/(881,6,886).lua
new file mode 100644
index 0000000..fada148
--- /dev/null
+++ b/Crossroads/nodes/(881,6,886).lua
@@ -0,0 +1,6 @@
+if event.train then
+ if atc_arrow then
+ atc_send("B14S14")
+ atc_set_text_inside("Next station: EVO")
+ end
+end \ No newline at end of file
diff --git a/Crossroads/nodes/(898,14,835).lua b/Crossroads/nodes/(898,14,835).lua
new file mode 100644
index 0000000..7d7b203
--- /dev/null
+++ b/Crossroads/nodes/(898,14,835).lua
@@ -0,0 +1,6 @@
+if event.train then
+ if atc_arrow then
+ atc_send("B14S14")
+ atc_set_text_inside("Next station: EVO")
+ end
+end \ No newline at end of file