summaryrefslogtreecommitdiff
path: root/durt/init_code.lua
diff options
context:
space:
mode:
Diffstat (limited to 'durt/init_code.lua')
-rw-r--r--durt/init_code.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/durt/init_code.lua b/durt/init_code.lua
index 625353a..aa7e821 100644
--- a/durt/init_code.lua
+++ b/durt/init_code.lua
@@ -254,7 +254,7 @@ F.remove_rc = function(rc_list,arrow_mode)
-- false: against arrow direction
-- nil: ignores arrow direction
- if not event.train then return end
+ if not atc_id then return false end
if (arrow_mode == nil) or (atc_arrow == arrow_mode) then
local rc = F.get_rc_safe()
rc_list = rc_list or {}
@@ -263,7 +263,6 @@ F.remove_rc = function(rc_list,arrow_mode)
for _,v in pairs(rc_list) do
rc_remove[v] = true
end
-
-- remove codes from train's rc
local reinsert = {}
for token in rc:gmatch("[^%s]+") do
@@ -277,6 +276,15 @@ F.remove_rc = function(rc_list,arrow_mode)
return reinsert
end
+F.add_rc = function(rc_list)
+ if not atc_id then return false end
+ if type(rc_list) == "table" then
+ rc_list = table.concat(rc_list," ")
+ end
+ set_rc(F.get_rc_safe().." "..rc_list)
+ return true
+end
+
F.yard_road_count = function(yard,section_id,monitoring_light)
if not S.yards[yard][section_id] then S.yards[yard][section_id] = {['car_count'] = 0} end