summaryrefslogtreecommitdiff
path: root/auto_yards/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'auto_yards/nodes')
-rw-r--r--auto_yards/nodes/(-2004,2,-1101).lua23
-rw-r--r--auto_yards/nodes/(416,17,5).lua27
2 files changed, 50 insertions, 0 deletions
diff --git a/auto_yards/nodes/(-2004,2,-1101).lua b/auto_yards/nodes/(-2004,2,-1101).lua
new file mode 100644
index 0000000..c39016a
--- /dev/null
+++ b/auto_yards/nodes/(-2004,2,-1101).lua
@@ -0,0 +1,23 @@
+local yard_id = "BY"
+local subs = {
+ ['S27'] = POS(-1512,8,-2613)
+}
+if event.ext_int then
+ print(event)
+ local m = event.message
+ if m.command == "NOTIFY" then -- store the notifications in the yards's S table entry for mass-dispatch
+ if m.msg == "*" then return end -- no need to notify for the LHF train's collect moves
+ S.yards[yard_id].notify[m.msg] = true
+ return
+ end
+ if m.command == "COLLECTED" then
+ S.yards[yard_id].notify[m.msg] = nil
+ return
+ end
+ if m.command == "EXIT" then
+ for k in pairs(S.yards[yard_id].notify) do
+ if subs[k] then interrupt_pos(subs[k],{command="NOTIFY",msg=k}) end
+ end
+ return
+ end
+end \ No newline at end of file
diff --git a/auto_yards/nodes/(416,17,5).lua b/auto_yards/nodes/(416,17,5).lua
new file mode 100644
index 0000000..e8c1b0e
--- /dev/null
+++ b/auto_yards/nodes/(416,17,5).lua
@@ -0,0 +1,27 @@
+local stack = function(t,channel,num_screens)
+ for i=0,math.ceil(#t/4) do
+ local calc = i*4
+ local working_t = {t[calc+1],t[calc+2],t[calc+3],t[calc+4]}
+ local message = table.concat(working_t,"\n")
+ if i+1 > num_screens then return end
+ digiline_send(channel..i+1,message)
+ end
+end
+
+if event.channel=="clock" or event.punch then
+ local txt = {"-- AUTOMATIC YARD STATUS --","Railway Time: "..rwt.to_string(rwt.now(),true),"LHF Trains: 719814"," ========================"}
+ local s
+ for yard_id,info in pairs(S.yards) do
+ table.insert(txt, yard_id.." - Active: " .. tostring(F.indicator(info.active_indicator_pos)))
+ table.insert(txt," Direction: " .. tostring(F.indicator(info.dir_indicator_pos)))
+ table.insert(txt," Error: ".. tostring(F.indicator(info.error_indicator_pos)))
+ if info.notify and info.notify[1] then
+ table.insert(txt,"Notify: "..table.concat(info.notify,", "))
+ else
+ table.insert(txt,"Notify: N/A")
+ end
+ end
+
+ stack(txt,"yard_status",4)
+ return
+end \ No newline at end of file