diff options
author | autocommitter <autocommitter@linux-forks.de> | 2024-10-15 22:37:32 +0200 |
---|---|---|
committer | autocommitter <autocommitter@linux-forks.de> | 2024-10-15 22:37:32 +0200 |
commit | 5c7f77725394d47ce0b907aabf885ea207a507bd (patch) | |
tree | a1ff9c67ef8f225a259e4c6f4c163a45c58bb870 /Crossroads | |
parent | b435d1b1b26db6f7c4f3eb589ecf1ed3bb79b57e (diff) | |
download | luaatc_envs-5c7f77725394d47ce0b907aabf885ea207a507bd.tar.gz luaatc_envs-5c7f77725394d47ce0b907aabf885ea207a507bd.tar.bz2 luaatc_envs-5c7f77725394d47ce0b907aabf885ea207a507bd.zip |
State at 2024-10-15
Diffstat (limited to 'Crossroads')
-rw-r--r-- | Crossroads/nodes/(1122,16,2769).lua | 1 | ||||
-rw-r--r-- | Crossroads/nodes/(1545,6,7947).lua | 1 | ||||
-rw-r--r-- | Crossroads/nodes/(1623,6,7920).lua | 2 | ||||
-rw-r--r-- | Crossroads/nodes/(1625,6,7988).lua | 4 | ||||
-rw-r--r-- | Crossroads/nodes/(1671,18,8231).lua | 1 | ||||
-rw-r--r-- | Crossroads/nodes/(1722,27,929).lua | 88 | ||||
-rw-r--r-- | Crossroads/nodes/(1922,19,8223).lua | 2 | ||||
-rw-r--r-- | Crossroads/nodes/(2010,3,5938).lua | 2 | ||||
-rw-r--r-- | Crossroads/nodes/(2610,12,8155).lua | 1 |
9 files changed, 99 insertions, 3 deletions
diff --git a/Crossroads/nodes/(1122,16,2769).lua b/Crossroads/nodes/(1122,16,2769).lua new file mode 100644 index 0000000..27a6f78 --- /dev/null +++ b/Crossroads/nodes/(1122,16,2769).lua @@ -0,0 +1 @@ +F.stn2gen("grsc", "4", "R")
\ No newline at end of file diff --git a/Crossroads/nodes/(1545,6,7947).lua b/Crossroads/nodes/(1545,6,7947).lua new file mode 100644 index 0000000..8d006a8 --- /dev/null +++ b/Crossroads/nodes/(1545,6,7947).lua @@ -0,0 +1 @@ +F.x_on {NRG_1 = 1}
\ No newline at end of file diff --git a/Crossroads/nodes/(1623,6,7920).lua b/Crossroads/nodes/(1623,6,7920).lua new file mode 100644 index 0000000..fdab00b --- /dev/null +++ b/Crossroads/nodes/(1623,6,7920).lua @@ -0,0 +1,2 @@ +F.tram2gen("NRG-bplatz","S",false) +F.x_off{NRG_3 = 1}
\ No newline at end of file diff --git a/Crossroads/nodes/(1625,6,7988).lua b/Crossroads/nodes/(1625,6,7988).lua index 8072a09..bd10f3a 100644 --- a/Crossroads/nodes/(1625,6,7988).lua +++ b/Crossroads/nodes/(1625,6,7988).lua @@ -1 +1,3 @@ -F.tram2gen("NRG-south","N",false)
\ No newline at end of file +F.tram2gen("NRG-south","N",false) +F.x_off{NRG_5 = 1} +F.sx_on{NRG_6 = 1, NRG_7 = 1}
\ No newline at end of file diff --git a/Crossroads/nodes/(1671,18,8231).lua b/Crossroads/nodes/(1671,18,8231).lua new file mode 100644 index 0000000..e361a24 --- /dev/null +++ b/Crossroads/nodes/(1671,18,8231).lua @@ -0,0 +1 @@ +F.stn2gen("NRG-pek", "1", "L", true)
\ No newline at end of file diff --git a/Crossroads/nodes/(1722,27,929).lua b/Crossroads/nodes/(1722,27,929).lua new file mode 100644 index 0000000..02fd367 --- /dev/null +++ b/Crossroads/nodes/(1722,27,929).lua @@ -0,0 +1,88 @@ +local head = { "V TRAIN LINE TIME", "ST TRK STATION ", " " } +local length = 18 +local height = 4 +local sformat = string.format + +if event.type=="digiline" or event.type=="punch" then + if event.channel=="upd_main" or event.type=="punch" then + local ts = os.time() + local table = table + local start_t = os.clock() + if not S.lagrec then S.lagrec = {} end + local ids = {} + for i in pairs(S.trains) do ids[#ids+1] = i end + table.sort(ids, function(a, b) + local ta, tb = S.trains[a], S.trains[b] + if ta.l == tb.l then + return a < b + else + return ta.l < tb.l + end + end) + --do return end + local disp = {{}, {}, {}} + local percol = height*4-1 + for id = 1, #ids, 1 do + local st = (S.trains[ids[id] or 0] or {}) + local i = math.floor((id-1)/percol) + local j = math.floor(((id-1)%percol+1)/4)+1 + local stn = sformat("%-3s %-3s %s", st.mode or "", st.t or "N/A", F.stnlist[st.s] or st.s) + stn = stn:gsub("ä","ae"):gsub("ö","oe"):gsub("ü","ue"):gsub("ß","ss") + local dt = ts - (st.ts or -1) + local td = "" + if dt < 60 then + td = sformat("%5ds", dt) + elseif dt < 3600 then + td = sformat("%2dm%02ds", math.floor(dt/60), dt%60) + elseif dt < 86400 then + td = sformat("%2dh%02dm", math.floor(dt/3600), math.floor(dt/60)%60) + elseif dt < 8640000 then + td = sformat("%2dd%02dh", math.floor(dt/86400), math.floor(dt/3600)%24) + elseif st.ts then + td = sformat("%5dd", math.floor(dt/86400)) + end + local line = { + sformat("%02d %06d %-7s %s", st.v, ids[id], st.l, td), + stn, + stn:len() > 27 and stn:sub(28) or " ", + } + for df, fstr in pairs(line) do + local ft = disp[df] + local ct = ft[i] + if not ct then + ct = {{head[df]}} + ft[i] = ct + end + local rt = ct[j] + if not rt then + rt = {} + ct[j] = rt + end + table.insert(rt, fstr) + end + end + for fi, ft in pairs(disp) do + for fc, ct in pairs(ft) do + for fr, rt in pairs(ct) do + digiline_send(tostring((fi+fc*3)*10+fr), table.concat(rt or {}, "\n")) + end + end + end + local end_t = os.clock() + local t = end_t - start_t + local lagrec = S.lagrec + if t > (lagrec.max or 0) then + lagrec.max = t + end + if t < (lagrec.min or math.huge) then + lagrec.min = t + end + avg = t + if lagrec.avg then + avg = (lagrec.avg+t)/2 + end + lagrec.avg = avg + digiline_send("lag1", sformat("DEBUG\nTRAINS: %d\nTS: %d", #ids, ts)) + digiline_send("lag2", sformat("CUR %f\nMIN %f\nMAX %f\nAVG %f", t, lagrec.min, lagrec.max, avg)) + end +end
\ No newline at end of file diff --git a/Crossroads/nodes/(1922,19,8223).lua b/Crossroads/nodes/(1922,19,8223).lua index a50daaa..80be033 100644 --- a/Crossroads/nodes/(1922,19,8223).lua +++ b/Crossroads/nodes/(1922,19,8223).lua @@ -1 +1 @@ -F.stn2gen("krasnograd", "W", "L", true, true)
\ No newline at end of file +F.stn2gen("krasnograd", "2", "R")
\ No newline at end of file diff --git a/Crossroads/nodes/(2010,3,5938).lua b/Crossroads/nodes/(2010,3,5938).lua index 4716a64..750be29 100644 --- a/Crossroads/nodes/(2010,3,5938).lua +++ b/Crossroads/nodes/(2010,3,5938).lua @@ -1,4 +1,4 @@ -do return end +--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/(2610,12,8155).lua b/Crossroads/nodes/(2610,12,8155).lua new file mode 100644 index 0000000..afc35a3 --- /dev/null +++ b/Crossroads/nodes/(2610,12,8155).lua @@ -0,0 +1 @@ +F.ax_on{SWALD_2 = "W"}
\ No newline at end of file |