summaryrefslogtreecommitdiff
path: root/auto_yards
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-04-22 14:57:53 +0200
committerautocommitter <autocommitter@linux-forks.de>2024-04-22 14:57:53 +0200
commit7ac61207f5e208d1d70871a714218465b3025d16 (patch)
tree93d95ec02df16419ea5e09b7ec3b1adc1018984e /auto_yards
parent8fa52d91d54f9b55272b872434fa2add447a0da2 (diff)
downloadluaatc_envs-7ac61207f5e208d1d70871a714218465b3025d16.tar.gz
luaatc_envs-7ac61207f5e208d1d70871a714218465b3025d16.tar.bz2
luaatc_envs-7ac61207f5e208d1d70871a714218465b3025d16.zip
State at 2022-07-03
Diffstat (limited to 'auto_yards')
-rw-r--r--auto_yards/init_code.lua13
-rw-r--r--auto_yards/nodes/(-2004,2,-1101).lua27
-rw-r--r--auto_yards/nodes/(-2004,3,-1099).lua7
-rw-r--r--auto_yards/nodes/(-2006,3,-1099).lua5
4 files changed, 20 insertions, 32 deletions
diff --git a/auto_yards/init_code.lua b/auto_yards/init_code.lua
index 595caa2..4a66f6e 100644
--- a/auto_yards/init_code.lua
+++ b/auto_yards/init_code.lua
@@ -19,9 +19,6 @@ if event.init then
error_indicator_pos = POS(-4025,13,-2671),
headshunt_max = 5,
- --temporary while testing
- notify = {},
- notify_pos = POS(-2006,3,-1099)
},
BY = {
active_indicator_pos = POS(-2002,3,-1099),
@@ -29,7 +26,7 @@ if event.init then
error_indicator_pos = POS(-1999,3,-1099),
headshunt_max = 5,
notify = {},
- notify_pos = POS(-2006,3,-1099)
+ notify_pos = POS(-2004,2,-1101)
},
IP = {
active_indicator_pos = POS(1179,16,3848),
@@ -37,9 +34,6 @@ if event.init then
error_indicator_pos = POS(1179,16,3850),
headshunt_max = 5,
- --temporary while testing
- notify = {},
- notify_pos = POS(-2006,3,-1099)
},
-- HY = {
-- active_indicator_pos = POS(-4025,14,-2659),
@@ -370,8 +364,11 @@ F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard
F.remove_rc_match(yard_id.."_LOCOS_%d+")
F.remove_rc_match(yard_id.."_WAGONS_%d+")
- if yard.notify_pos and yard.notify then
+ if yard.notify_pos then
interrupt_pos(yard.notify_pos,"notify")
+ print("init notifications")
+ else
+ print("No notification panel configured")
end
if F.has_rc(yard_id.."_HAS_RTS") then --reinsert the RTS flag to fully return RC list to starting
diff --git a/auto_yards/nodes/(-2004,2,-1101).lua b/auto_yards/nodes/(-2004,2,-1101).lua
index c39016a..6ff3fbf 100644
--- a/auto_yards/nodes/(-2004,2,-1101).lua
+++ b/auto_yards/nodes/(-2004,2,-1101).lua
@@ -1,23 +1,14 @@
local yard_id = "BY"
local subs = {
- ['S27'] = POS(-1512,8,-2613)
+ ['S27'] = POS(-1512,8,-2613),
+ ['no_match_anywhere'] = POS(-2006,3,-1099),
}
-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
+
+if event.ext_int or event.punch then
+ for fc, pos in pairs(subs) do
+ if S.yards[yard_id].notify[fc] then
+ interrupt_pos(pos,"notify")
end
- return
end
-end \ No newline at end of file
+ S.yards[yard_id].notify = {}
+end
diff --git a/auto_yards/nodes/(-2004,3,-1099).lua b/auto_yards/nodes/(-2004,3,-1099).lua
index bc283b9..69ad077 100644
--- a/auto_yards/nodes/(-2004,3,-1099).lua
+++ b/auto_yards/nodes/(-2004,3,-1099).lua
@@ -1,3 +1,6 @@
-local s = rwt.to_string(rwt.now()).."\n--"..table.concat(S.yards.BY.notify,", ").."--"
-print(s)
+local s = rwt.to_string(rwt.now()).."\n--"
+for k in pairs(S.yards.BY.notify) do
+ s = s ..k..", "
+end
+s = s.."--"
digiline_send("",s) \ No newline at end of file
diff --git a/auto_yards/nodes/(-2006,3,-1099).lua b/auto_yards/nodes/(-2006,3,-1099).lua
index f920c5a..d774476 100644
--- a/auto_yards/nodes/(-2006,3,-1099).lua
+++ b/auto_yards/nodes/(-2006,3,-1099).lua
@@ -1,5 +1,2 @@
if event.digiline then return end
-print(event)
-print("BY YARD: ") print(S.yards.BY.notify)
-print("IP YARD: ") print(S.yards.IP.notify)
-print("TY YARD: ") print(S.yards.TY.notify) \ No newline at end of file
+print("Notification Sent") \ No newline at end of file