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.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/auto_yards/init_code.lua b/auto_yards/init_code.lua
index 6286947..0664eb9 100644
--- a/auto_yards/init_code.lua
+++ b/auto_yards/init_code.lua
@@ -100,7 +100,7 @@ F.remove_rc = function(rc_list,arrow_mode) -- rc_list = string eg: "rc1 rc2 rc3"
-- prep rc_list to useable format
local rc_remove = {}
if type(rc_list) == "string" then
- for word in pairs(rc_list:gmatch("[^%s]+")) do
+ for word in rc_list:gmatch("[^%s]+") do
rc_remove[word] = true
end
elseif type(rc_list) == "table" then
@@ -146,15 +146,19 @@ F.yard_arrival = function(yard_id,this_dir) -- arrow points towards yard
local function enter_yard()
if not atc_id then
F.indicator(yard.error_indicator_pos,true)
+ return
end
F.indicator(yard.dir_indicator_pos,this_dir)
F.indicator(yard.active_indicator_pos,true)
F.add_rc({yard_id.."_ARRIVE"})
+ local rts = false
if F.has_rc(yard_id.."_RTS") then --save the RTS flag as it's removed during the arrival procedure
F.add_rc({yard_id.."_HAS_RTS"})
+ rts = true
end
atc_set_ars_disable(false)
atc_send("S6")
+ print("Train "..atc_id.." enters yard ".. yard_id.." from the "..tostring(this_dir).." direction and "..((rts and "will") or "won't").." return in the same direction")
return
end
@@ -357,7 +361,7 @@ F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard
schedule_in(";05","deactivate_check") -- wait a little to ensure train is clear from headshunt to deactivate yard
print(F.get_rc_safe())
return
- end
+ end -- if not _DEPART then let the train pass as extra space for the bounce back to the yard
else
atc_send("BBOL")
F.indicator(yard.error_indicator_pos,true)