diff options
Diffstat (limited to 'auto_yards')
-rw-r--r-- | auto_yards/init_code.lua | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/auto_yards/init_code.lua b/auto_yards/init_code.lua index f0a62da..92b69bd 100644 --- a/auto_yards/init_code.lua +++ b/auto_yards/init_code.lua @@ -68,7 +68,6 @@ F.has_rc = function(query,rc_list) -- query = string, single entry for word in rc_list:gmatch("[^%s]+") do if word == query then return true end end - -- print(F.get_rc_safe()) return false end @@ -95,7 +94,6 @@ F.add_rc = function(rc_list) -- rc_list = string or table, eg: {"rc1","rc2"} OR rc_list = table.concat(rc_list," ") end set_rc(F.get_rc_safe().." "..rc_list) - -- print(F.get_rc_safe()) return true end @@ -132,7 +130,6 @@ F.remove_rc = function(rc_list,arrow_mode) -- rc_list = string eg: "rc1 rc2 rc3" -- insert new string to train's rc set_rc(table.concat(reinsert," ")) end - -- print(F.get_rc_safe()) return reinsert end @@ -144,7 +141,6 @@ F.remove_rc_match = function(rc_list) -- rc_list = pattern string, single entry, table.insert(rm,v) end F.remove_rc(rm) - -- print(F.get_rc_safe()) return rm end @@ -172,8 +168,8 @@ F.yard_arrival = function(yard_id,this_dir) -- arrow points towards yard atc_send("S6") print(rwt.to_string(rwt.now())) - print("YARD: "..yard_id..": Train "..atc_id.." enters from the "..tostring(this_dir).." direction and "..((rts and "will") or "won't").." return in the same direction") - print("YARD: "..yard_id..": Length "..train_length()) + print("YARD "..yard_id..": Train "..atc_id.." enters from the "..tostring(this_dir).." direction and "..((rts and "will") or "won't").." return in the same direction") + print("YARD "..yard_id..": Length "..train_length()) return end @@ -187,7 +183,7 @@ F.yard_arrival = function(yard_id,this_dir) -- arrow points towards yard if event.train and atc_arrow then if F.indicator(yard.active_indicator_pos) then print(rwt.to_string(rwt.now())) - print("YARD: "..yard_id..": Train "..atc_id.." has arrived and has to wait for the yard to deactivate.") + print("YARD "..yard_id..": Train "..atc_id.." has arrived and has to wait for the yard to deactivate.") schedule_in(";10","recheck") return else @@ -293,8 +289,6 @@ F.headshunt_yard = function(yard_id,this_dir) -- arrow points toward yard schedule_in(";01",atc_id) return else - print(rwt.to_string(rwt.now())) - print("Preparing train "..atc_id.." to depart "..yard_id.." yard.") if get_line() ~= "LHF" then -- LHF trains will always only collect the * lane for that direction. This code is for other trains local collect = F.get_rc_safe():match(yard_id.."_COLLECT_(%S+)") -- will only match to the first _COLLECT RC to avoid excessively long trains in the headshunt if collect then --train needs to collect a rake from the yard before departing @@ -359,19 +353,15 @@ F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard if atc_arrow and (F.indicator(yard.dir_indicator_pos) == this_dir) then if F.has_rc(yard_id.."_DEPART") then print(rwt.to_string(rwt.now())) - print("YARD: "..yard_id..": Train "..atc_id.." has a length of "..train_length()) - print("YARD: "..yard_id..": It will depart in the "..tostring(this_dir).." direction.") + print("YARD "..yard_id..": Train "..atc_id.." has a length of "..train_length()) + print("YARD "..yard_id..": It will depart in the "..tostring(this_dir).." direction.") unset_autocouple() F.remove_rc({yard_id.."_FINAL_COLLECT",yard_id.."_DEPART"}) F.remove_rc_match(yard_id.."_LOCOS_%d+") F.remove_rc_match(yard_id.."_WAGONS_%d+") if yard.notify_pos then - print(yard.notify) 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 @@ -382,7 +372,6 @@ F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard atc_set_ars_disable(false) atc_send("S6D10SM") 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 -- if not _DEPART then let the train pass as extra space for the bounce back to the yard else @@ -396,7 +385,7 @@ F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard if not atc_id then F.indicator(yard.active_indicator_pos,false) print(rwt.to_string(rwt.now())) - print(yard_id.." yard Disabled") + print("YARD "..yard_id..": yard Disabled") else schedule_in(";05","deactivate_check") return @@ -430,17 +419,11 @@ 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+") - 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 - 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) |