diff options
-rw-r--r-- | Crossroads/nodes/(1755,27,943).lua | 10 | ||||
-rw-r--r-- | durt/nodes/(-4117,16,-5770).lua | 1 | ||||
-rw-r--r-- | durt/nodes/(-4129,16,-5745).lua | 16 | ||||
-rw-r--r-- | durt/nodes/(-4129,16,-5802).lua | 26 |
4 files changed, 49 insertions, 4 deletions
diff --git a/Crossroads/nodes/(1755,27,943).lua b/Crossroads/nodes/(1755,27,943).lua index 135d7ab..227e164 100644 --- a/Crossroads/nodes/(1755,27,943).lua +++ b/Crossroads/nodes/(1755,27,943).lua @@ -1,5 +1,7 @@ local head = { "V TRAIN LINE STATION ", " " } local length = 18 +local sformat = string.format + if event.type=="digiline" or event.type=="punch" then if event.channel=="upd_main" or event.type=="punch" then local table = table @@ -17,8 +19,8 @@ if event.type=="digiline" or event.type=="punch" then 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 = 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) + local n = sformat("[%s] %s", st.t or "?", F.stnlist[st.s] or st.s) + la[i][#la[i]+1] = sformat("%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 @@ -32,7 +34,7 @@ if event.type=="digiline" or event.type=="punch" then local lagavg = 0 for i = 1, #S.lagrec, 1 do lagavg = lagavg + S.lagrec[i] end lagavg = lagavg / #S.lagrec - digiline_send("lag1", "DEBUG\nTRAINS: " .. counter .. "\nTS: " .. os.time()) - digiline_send("lag2", "CUR " .. (end_t - start_t) .. "\nMIN " .. S.lagrec[1] .. "\nMAX " .. S.lagrec[#S.lagrec] .. "\nAVG " .. lagavg) + digiline_send("lag1", sformat("DEBUG\nTRAINS: %d\nTS: %d", counter, os.time())) + digiline_send("lag2", sformat("CUR %f\nMIN %f\nMAX %f\nAVG %f", end_t - start_t, S.lagrec[1], S.lagrec[#S.lagrec], lagavg)) end end
\ No newline at end of file diff --git a/durt/nodes/(-4117,16,-5770).lua b/durt/nodes/(-4117,16,-5770).lua new file mode 100644 index 0000000..ee1ea3f --- /dev/null +++ b/durt/nodes/(-4117,16,-5770).lua @@ -0,0 +1 @@ +print(get_aspect(POS(-4119,18,-5770)))
\ No newline at end of file diff --git a/durt/nodes/(-4129,16,-5745).lua b/durt/nodes/(-4129,16,-5745).lua new file mode 100644 index 0000000..23d7e85 --- /dev/null +++ b/durt/nodes/(-4129,16,-5745).lua @@ -0,0 +1,16 @@ +local signal = POS(-4128,16,-5754) +if event.train and atc_arrow then + for _,key in pairs({"DLG_shunt_platforms"}) do + local rc = (get_rc() or "") + if rc:match(key) then + atc_send("B0WD2A0RS3CplS1") + if rc:match("DLG_shunt_Platform1") then + set_route(signal,"SHUNT Platform 1") + return + elseif rc:match("DLG_shunt_Platform2") then + set_route(signal,"SHUNT Platform 2") + return + end + end + end +end
\ No newline at end of file diff --git a/durt/nodes/(-4129,16,-5802).lua b/durt/nodes/(-4129,16,-5802).lua new file mode 100644 index 0000000..5e0892e --- /dev/null +++ b/durt/nodes/(-4129,16,-5802).lua @@ -0,0 +1,26 @@ +local split_indicator = POS(-4128,17,-5768) +__approach_callback_mode = 1 + +if event.approach and not event.has_entered then + if get_line() ~= "DLG_OFB" then return end + + atc_set_ars_disable(true) + atc_set_lzb_tsr(1) +end + +if event.train then + if get_line() ~= "DLG_OFB" then return end + if not atc_arrow then return end + local state = getstate(split_indicator) + if state == "red" then + split_off_locomotive("A0B0OL",1) + atc_send("S3") + atc_set_ars_disable(false) + setstate(split_indicator,"green") + set_rc((get_rc() or "").." DLG_around DLG_shunt_platforms DLG_shunt_Platform2") + elseif state == "green" then + atc_send("B0WRA1D2S4D10SM") + setstate(split_indicator,"red") + F.remove_rc({"DLG_around","DLG_shunt_platforms","DLG_shunt_Platform2"}) + end +end
\ No newline at end of file |