summaryrefslogtreecommitdiff
path: root/auto_yards/init_code.lua
diff options
context:
space:
mode:
Diffstat (limited to 'auto_yards/init_code.lua')
-rw-r--r--auto_yards/init_code.lua26
1 files changed, 19 insertions, 7 deletions
diff --git a/auto_yards/init_code.lua b/auto_yards/init_code.lua
index e733797..595caa2 100644
--- a/auto_yards/init_code.lua
+++ b/auto_yards/init_code.lua
@@ -18,6 +18,10 @@ if event.init then
dir_indicator_pos = POS(-4025,12,-2665),
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),
@@ -32,6 +36,10 @@ if event.init then
dir_indicator_pos = POS(1177,16,3855),
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),
@@ -314,8 +322,8 @@ F.headshunt_yard = function(yard_id,this_dir) -- arrow points toward yard
F.add_rc({yard_id.."_PICKUP"})
atc_set_ars_disable(false)
return
- end --if at wrong end, do nothing. train will follow TY_AROUND ARS to relevant headshunt
- end -- if doesn't have TY_AROUND then let ARS classify the train
+ end --if at wrong end, do nothing. train will follow <yard_id>_AROUND ARS to relevant headshunt
+ end -- if doesn't have <yard_id>_AROUND then let ARS classify the train
atc_set_ars_disable(false)
end
@@ -363,9 +371,7 @@ F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard
F.remove_rc_match(yard_id.."_WAGONS_%d+")
if yard.notify_pos and yard.notify then
- if yard.notify[1] == true then
- interrupt_pos(yard.notify_pos,"notify")
- end
+ interrupt_pos(yard.notify_pos,"notify")
end
if F.has_rc(yard_id.."_HAS_RTS") then --reinsert the RTS flag to fully return RC list to starting
@@ -424,11 +430,17 @@ F.lane_EOL = function(yard_id,this_dir) -- arrow points towards headshunt
if F.indicator(yard.dir_indicator_pos) == this_dir then
local fc = F.get_rc_safe():match(yard_id.."_CLASS_(%S+)")
F.remove_rc_match(yard_id.."_CLASS_%S+")
- if not yard.notify or yard.notify_pos then return end
+ print(1)
+ if not yard.notify or not yard.notify_pos then return end
+ print(2)
if not fc then return end
+ print(3)
if fc == "*" then return end
+ print(4)
if F.has_rc(yard_id.."_COLLECT_"..fc) then return end
- table.insert(S.yards[yard_id].notify,fc)
+ print(5)
+ S.yards[yard_id].notify[fc] = true
+ print(6)
else --this should never come into play as it means the train has entered from the wrong end somehow
atc_send("BBOL") --stop the train and open the doors (if available) to signify assistance required
F.indicator(yard.error_indicator_pos,true)