diff options
author | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 14:58:03 +0200 |
---|---|---|
committer | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 14:58:03 +0200 |
commit | 7b3ac07f3f9b9d92582aceb74050215a36646bc5 (patch) | |
tree | 3eda9d8e0a85b9d0daa53dd2887d154d9e0ef172 /auto_yards/nodes/(417,17,4).lua | |
parent | efa99edcbd392873d8ed78eae7760f8c0b23dc45 (diff) | |
download | luaatc_envs-7b3ac07f3f9b9d92582aceb74050215a36646bc5.tar.gz luaatc_envs-7b3ac07f3f9b9d92582aceb74050215a36646bc5.tar.bz2 luaatc_envs-7b3ac07f3f9b9d92582aceb74050215a36646bc5.zip |
State at 2023-03-26
Diffstat (limited to 'auto_yards/nodes/(417,17,4).lua')
-rw-r--r-- | auto_yards/nodes/(417,17,4).lua | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/auto_yards/nodes/(417,17,4).lua b/auto_yards/nodes/(417,17,4).lua new file mode 100644 index 0000000..b634cde --- /dev/null +++ b/auto_yards/nodes/(417,17,4).lua @@ -0,0 +1,62 @@ +if event.channel=="clock" then + local yard_id = event.msg + local info = S.yards[yard_id] + digiline_send("rwt_clock","Rwt Now:\n"..rwt.to_string(rwt.now())) + + if not S.yards[yard_id] then + digiline_send(yard_id.."_1",yard_id.." -- Not In Service") + digiline_send(yard_id.."_2"," ") + digiline_send(yard_id.."_NOTIFY"," ") + return + end + + local function getN(t) + local count = 0 + for _ in pairs(t) do + count = count+1 + end + return count + end + + + local txt = {} + local txt2 = {} + txt[#txt+1] = yard_id.." --"..info.yard_name.." Yard--" + txt[#txt+1] = "Active: " .. tostring(F.indicator(info.active_indicator_pos)) + + txt[#txt+1] = "Direction: " .. tostring(F.indicator(info.dir_indicator_pos)) + txt[#txt+1] = "Last Train: " .. tostring(info.last_id).." ("..tostring(info.arrival_length).."-"..tostring(info.departure_length)..")" + txt2[#txt2+1] = "Time: "..tostring(rwt.to_string(info.arrival_time)).."+"..tostring(rwt.to_string(rwt.diff(info.arrival_time,info.departure_time))) + digiline_send(yard_id.."_1",table.concat(txt,"\n")) + + + + + txt2[#txt2+1] = "RTS: "..tostring(info.rts) + txt2[#txt2+1] = "Error: ".. tostring(F.indicator(info.error_indicator_pos)) + txt2[#txt2+1] = "" + digiline_send(yard_id.."_2",table.concat(txt2,"\n")) + + local notifications = "" + if info.notify then + local nt = "" + if getN(info.notify) > 0 then + nt = "Notify: " + for k in pairs(info.notify) do + nt = nt..k..", " + end + else + nt = "Notify: No Notifications" + end + + local st_len = 26 + if nt:len() > st_len then + nt = nt:sub(1,st_len).."\n"..nt:sub(st_len+1) + end + notifications = nt + else + notifications = "Notify: Not Enabled" + end + digiline_send(yard_id.."_NOTIFY",notifications) + return +end
\ No newline at end of file |