diff options
author | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 14:51:45 +0200 |
---|---|---|
committer | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 14:51:45 +0200 |
commit | 0b14726c5539782a60d2f4beaed2cfca74a50f7a (patch) | |
tree | 1de6e16c565f7bb9806552fc587d7eac870b6b00 /subway/nodes/(-14,3,4).lua | |
download | luaatc_envs-0b14726c5539782a60d2f4beaed2cfca74a50f7a.tar.gz luaatc_envs-0b14726c5539782a60d2f4beaed2cfca74a50f7a.tar.bz2 luaatc_envs-0b14726c5539782a60d2f4beaed2cfca74a50f7a.zip |
State at 2019-12-13
Diffstat (limited to 'subway/nodes/(-14,3,4).lua')
-rw-r--r-- | subway/nodes/(-14,3,4).lua | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/subway/nodes/(-14,3,4).lua b/subway/nodes/(-14,3,4).lua new file mode 100644 index 0000000..825989c --- /dev/null +++ b/subway/nodes/(-14,3,4).lua @@ -0,0 +1,71 @@ +-- digiline_send("l14w", "SIS Variant 2 - v1.4 | No info avaliable") + + +local appr_time = {[1]=15, [4]=15} +if not appr_tmr then appr_tmr = 0 end +local setint = false +if event.ext_int then + if event.message == "dep4" then + next_appr = 4 + appr_tmr = appr_time[4] + nwaiting = nnwaiting + nnwaiting = nil + setint=true + elseif event.message == "dep1" then + next_appr = 1 + appr_tmr = appr_time[1] + nwaiting = nnwaiting + nnwaiting = nil + setint=true + elseif event.message == "arr1" then + if nwaiting then nnwaiting = 1 else nwaiting = 1 end + elseif event.message == "arr4" then + if nwaiting then nnwaiting = 4 else nwaiting = 4 end + elseif event.message == "depo" then + next_appr = nil + end +elseif event.int then + appr_tmr = appr_tmr - 5 + setint=true +else + next_appr = nil + nwaiting = nil + nnwaiting = nil + digiline_send("l14w", "SIS Variant 2 - v1.4 | Please Wait") + return +end + +-- calculate time for nwaiting train +local nwt = 0 +if nwaiting then + nwt = appr_tmr + 10 + appr_time[nwaiting] +end +--display +local seconds = appr_tmr +if appr_tmr <= 0 then + seconds = "" +end +local txt = { + [1] = "Palm Bay", + [4] = "Apple Grove", +} +local line1, line2, line3 = "", "", "" +if next_appr then + line1 = "Line "..next_appr + line2 = txt[next_appr] + line3 = "in " .. seconds.."s" + if seconds == "" then + line3 = "now" + end +end +local line4 = "" +if nwt>0 then + line4 = "Line "..nwaiting.." - "..nwt.."s" +end +digiline_send("l14w", line1.." | "..line2.." | "..line3.." | ----------- | "..line4) + +digiline_send("l14wint", "Appr: "..(next_appr or "-").." "..appr_tmr.."s".." | nwaiting: "..(nwaiting or "-").." | nnwaiting: "..(nnwaiting or "-").. " | "..event.type.." | "..(event.message or "-")) + +if appr_tmr > 0 and setint then + interrupt(5, "appr") +end
\ No newline at end of file |