diff options
Diffstat (limited to 'ers')
66 files changed, 1190 insertions, 55 deletions
diff --git a/ers/init_code.lua b/ers/init_code.lua index 4fe8b87..18cdbc9 100644 --- a/ers/init_code.lua +++ b/ers/init_code.lua @@ -1,91 +1,623 @@ -- environment_ers.lua -F.debug = true +if S.trains == nil then S.trains = {} end +if S.train_duration == nil then S.train_duration = {} end +if S.yards == nil then S.yards = {} end -F.isempty = function (s) - return s == nil or s == '' +F.known_rcs = { + ["LILSHUNTER"] = "LILSHUNTER", + ["CRYSTAL"] = "CRYSTAL", + ["DEPOTUNLOADING"] = "DEPOTUNLOADING", + ["ERSBALLASTLOAD"] = "ERSBALLASTLOAD", + ["CORNUNLOAD"] = "CORNUNLOAD", + ["MEGACORNLOAD"] = "MEGACORNLOAD", + ["XERXES"] = "XERXES", + ["BLOCK"] = "BLOCK", + ["FERTILIZER"] = "FERTILIZER", + ["FERTRUNNER"] = "FERTRUNNER", + ["MULCH"] = "MULCH", + ["ERSTAZIDEPOTUNLOAD"] = "ERSTAZIDEPOTUNLOAD", + ["ERSTAZIDEPOT"] = "ERSTAZIDEPOT", + ["ERSSINENSISDEPOT"] = "ERSSINENSISDEPOT", + ["ERSTAZITST"] = "ERSTAZITST", + ["FACTORY"] = "FACTORY", + ["OILEXTRACT"] = "OILEXTRACT", + ["SHUNT04A"] = "SHUNT04A", + ["ERSTAZISHOP"] = "ERSTAZISHOP", + ["TYARD"] = "TYARD", + ["TY_COLLECT_SINESIS"] = "TY_COLLECT_SINESIS", + ["TY_RTS"] = "TY_RTS", +} + +F.print = function (str) if F.debug then print("".. (str or "nil") ) end end +F.isempty = function (s) return s == nil or s == "" end +F.get_rc_safe = function() return get_rc() or "" end +F.get_line_safe = function() return get_line() or "" end +F.get_train_length_safe = function() return train_length() or 0 end +F.avg = function(t) + local sum = 0 + local count = 0 + for k,v in pairs(t) do + if type(v) == "number" then + sum = sum + v + count = count + 1 + end + end + return (sum / count) +end + +if event.init then + F.debug = true + F.max_displays = 52 + F.print("Initialized") +end + +F.clear_main_depot_displays = function() for i = 1, F.max_displays, 1 do digiline_send("train_display" .. i, " ") end end + +--[[ + EXAMPLE: F.has_rc("LILSHUNTER", F.get_rc_safe() ) + Merged F.has_rc and F.does_train_have_rc + F.does_train_have_rc is deprecated +]] +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 + return false +end + +F.send_route = function(passive_name, route, show_print) + local message = "" + local return_value = false + if can_set_route(passive_name, route) then + set_route(passive_name, route) + message = passive_name .. " has been set to " .. route + return_value = true + else + message = route .. " cannot be set for " .. passive_name .. ". Try another." + return_value = false + end + if show_print == true then F.print(message) end + return return_value +end + +F.save_train = function() + if not atc_id then return end + if S.trains then + S.trains[atc_id] = { ["id"] = atc_id, ["rc"] = F.get_rc_safe(), ["ln"] = F.get_line_safe(), ["cars_count"] = F.get_train_length_safe() } + end +end + +F.get_real_split_count = function(train_length_count, split_count) + if split_count then + if split_count == "all" then + return 2 + else + F.print("train_length_count (" .. train_length_count .. ") - split_count (" .. split_count .. ")") + train_length_count = train_length_count + 1 + split_count = train_length_count - split_count + return split_count + end + else + return nil + end +end + +F.yard_siding_basic = function(yard, name, place) + if event.train then + if not atc_id then return end + F.save_train() + if place == "start" then + if atc_arrow then + atc_send("S5") + else + atc_send("B5S5") + end + elseif place == "end_alt" then + do_something = false + elseif place == "end" then + if atc_arrow then + atc_send("B0 W R") + end + else + F.print("Place for " .. name .. " has not been defined") + end + end +end + +F.yard_set_route = function(yard, train_id, atc_command) + if atc_command == nil then atc_command = "A1 S5" end + if S.yards[yard] and S.yards[yard]["state"] and S.yards[yard]["actions"] then + status = S.yards[yard]["state"]["status"] + current_sequence = S.yards[yard]["state"]["current"] + current_operation = S.yards[yard]["actions"][current_sequence]["operation"] + table_count = table.maxn(S.yards[yard]["actions"]) + next_sequence = current_sequence + 1 + -- F.print(next_sequence .. "/" .. table_count) + if next_sequence <= table_count and S.yards[yard]["actions"][next_sequence] and S.yards[yard]["actions"][next_sequence]["route"] then + next_route = S.yards[yard]["actions"][next_sequence]["route"] + next_operation = S.yards[yard]["actions"][next_sequence]["operation"] + use_this_signal = S.yards[yard]["actions"][next_sequence]["signal"] + atc_send_status = atc_send_to_train(train_id, atc_command) + if atc_send_status then + if use_this_signal == nil then + F.print(train_id .. " is waiting at: nil") + --[[ + Maybe change it so it shows which signal it is + waiting at when completed with this message: + F.print(train_id .. " has finished the sequences and is waiting.") + ]] + else + can_set_route_response = can_set_route(use_this_signal, next_route) + if can_set_route_response then + -- set_train_length_count = S.yards[yard]["state"]["train_length_count"] + -- S.yards[yard]["state"] = { status = "moving", current = next_sequence, train_length_count = set_train_length_count } + set_route(use_this_signal, next_route) + F.print("DIRECT COMMAND current_operation: " .. current_operation .. " next_operation: " .. next_operation) + F.print(train_id .. " is heading to " .. next_route .. " through " .. use_this_signal) + else + F.print(train_id .. " cannot go to " .. next_route .. " at " .. use_this_signal) + end + end + else + F.print(atc_command .. " command failed") + end + else + F.print("End of Operations for " .. train_id) + end + end +end + +F.yard_siding_next_operation = function(yard, train_id, current_sequence) + if S.yards[yard]["state"] then + if current_sequence == nil then current_sequence = S.yards[yard]["state"]['current'] end + local next_sequence = current_sequence + 1 + local set_train_length_count = S.yards[yard]["state"]["train_length_count"] + local table_count = table.maxn(S.yards[yard]["actions"]) + F.print(next_sequence .. "/" .. table_count) + S.yards[yard]["state"]["current"] = next_sequence + end +end + +F.yard_siding_operations_start = function(yard, train_id, place, current_operation, next_operation, current_split_count) + -- F.print("THIS IS " .. place) + if atc_arrow then + if current_operation == "split_at_engine" then + unset_autocouple() + -- split_off_locomotive("A0B0") + split_at_index(current_split_count, "S0") + F.yard_set_route(yard, train_id, atc_command) + F.yard_siding_next_operation(yard, train_id) + -- elseif current_operation == "reverse" then + -- unset_autocouple() + -- atc_send("B0 W R S5") + elseif next_operation == "split_at_engine" then + F.print("MAYBE SPLIT HERE AT " .. place .. " current: " .. current_operation .. " next: " .. next_operation) + F.yard_set_route(yard, train_id, atc_command) + F.yard_siding_next_operation(yard, train_id) + else + F.yard_set_route(yard, train_id, atc_command) + F.yard_siding_next_operation(yard, train_id) + end + else + if current_split_count == nil then + F.print("YARD SIDING " .. place .. " current_operation: " .. current_operation .. " next_operation: " .. next_operation) + end + if current_operation == "autocouple" then + set_autocouple() + elseif current_operation == "split_at_engine" then + set_autocouple() + else + unset_autocouple() + end + + if next_operation == "forward" then + F.print("at start and the next operation says forward") + F.yard_set_route(yard, train_id, atc_command) + F.yard_siding_next_operation(yard, train_id) + end + end +end + +F.yard_siding_operations_end = function(yard, train_id, place, current_operation, next_operation, current_split_count) + -- F.print("THIS IS " .. place) + if atc_arrow then + F.print("YARD SIDING " .. place .. " current_operation: " .. current_operation .. " next_operation: " .. next_operation) + if current_operation == "split_at_engine" then + -- split_at_index(2, "S0") + -- F.yard_set_route(yard, train_id, nil) + -- F.yard_siding_next_operation(yard, train_id) + unset_autocouple() + atc_send("B0 W R S5") + -- split_at_index(2, "S0") + elseif next_operation == "autocouple" then + unset_autocouple() + atc_send("B0 W R S5") + elseif next_operation == "reverse" then + unset_autocouple() + atc_send("B0 W R S5") + elseif next_operation == "forward" then + unset_autocouple() + F.yard_set_route(yard, train_id, nil) + F.yard_siding_next_operation(yard, train_id) + else + unset_autocouple() + atc_send("B0 W R S5") + end + else + if next_operation == "autocouple" then + set_autocouple() + end + if current_operation == "autocouple" then + set_autocouple() + end + -- if next_operation == "split_at_engine" then + -- F.yard_siding_next_operation(yard, train_id) + -- end + end end -F.print = function (str) - if F.debug then - print("PrntMsg: ".. (str or "nil") ) +F.yard_siding_operations_end_alt = function(yard, train_id, place, current_operation, next_operation, current_split_count) + -- F.print("THIS IS " .. place) + if atc_arrow then + if next_operation == "forward" or next_operation == "split_at_engine" then + unset_autocouple() + F.yard_set_route(yard, train_id, nil) + F.yard_siding_next_operation(yard, train_id) + elseif next_operation == "autocouple" then + set_autocouple() + F.yard_set_route(yard, train_id, nil) + F.yard_siding_next_operation(yard, train_id) + elseif next_operation == "reverse" then + unset_autocouple() + atc_send("B0 W R S5") + else + unset_autocouple() + -- atc_send("B0 W R S5") + F.print("At " .. place .. " and stopped because the command isn't programmed yet") + end + end +end + +F.yard_siding_operations = function(yard, train_id, place, current_operation, next_operation, current_split_count) + if place == "start" then + F.yard_siding_operations_start(yard, train_id, place, current_operation, next_operation, current_split_count) + elseif place == "end" then + F.yard_siding_operations_end(yard, train_id, place, current_operation, next_operation, current_split_count) + elseif place == "end_alt" then + F.yard_siding_operations_end_alt(yard, train_id, place, current_operation, next_operation, current_split_count) + else + F.print("Place for " .. name .. " has not been defined") + end +end + +F.yard_siding = function(yard, name, place) + if event.train then + if not atc_id then return end + if F.has_rc("LILSHUNTER", F.get_rc_safe() ) then + if S.yards[yard] and S.yards[yard]["state"] and S.yards[yard]["actions"] then + train_id = atc_id + S.yards[yard]["state"]["train_length_count"] = F.get_train_length_safe() + train_length_count = S.yards[yard]["state"]["train_length_count"] + status = S.yards[yard]["state"]["status"] + current_sequence = S.yards[yard]["state"]["current"] + current_operation = S.yards[yard]["actions"][current_sequence]["operation"] + current_split_count = S.yards[yard]["actions"][current_sequence]["split_count"] + current_split_count = F.get_real_split_count(train_length_count, current_split_count) + table_count = table.maxn(S.yards[yard]["actions"]) + next_sequence = current_sequence + 1 + if next_sequence <= table_count and S.yards[yard]["actions"][next_sequence] then + next_route = S.yards[yard]["actions"][next_sequence]["route"] + use_this_signal = S.yards[yard]["actions"][next_sequence]["signal"] + next_operation = S.yards[yard]["actions"][next_sequence]["operation"] + next_split_count = S.yards[yard]["actions"][next_sequence]["split_count"] + next_split_count = F.get_real_split_count(train_length_count, next_split_count) + F.yard_siding_operations(yard, train_id, place, current_operation, next_operation, current_split_count) + else + F.print("Went over the table count in F.yard_siding") + end + else + F.yard_siding_basic(yard, name, place) + end + else + F.yard_siding_basic(yard, name, place) + end + end + return +end + +F.yard_run = function(yard, section_id) -- section_id example: "723167" + if S.yards[yard] and type(S.yards[yard]) == "table" then + section_occuppied_by_table = section_occupancy(section_id) + section_occuppied_count = table.maxn(section_occuppied_by_table) + if section_occuppied_count == 1 then + train_id = section_occuppied_by_table[1] + F.print("train_id: " .. train_id) + F.yard_set_route(yard, train_id) + F.yard_siding_next_operation(yard, train_id) + else + F.print("HALT! More than one train is in the SHUNT01 section") + end + else + F.print("ERROR: S.yards[yard] needs to be a table") + end + return +end + +F.reset_trial_setup = function() + local yard = "ers_main" + if S.yards[yard] then + S.yards[yard] = {} + F.print(yard .. " has been reset!") + end +end + +F.trial_setup = function(type) + -- LILSHUNTER + local yard = "ers_main" + local section_id = "723167" + if type == nil then + F.print("Please, declare a type") + elseif type == "autocouple_1_4" then + S.yards[yard] = { + ["state"] = { status = "ready", current = 1, train_length_count = 1 }, + ["actions"] = { + [1] = {route = "SHUNT01", signal = nil, operation = "start"}, + [2] = {route = "SIDING01", signal = "SHUNT01_SIGNAL", operation = "autocouple"}, + [3] = {route = "HEADSHUNT01", signal = "SIDING01_SIGNAL", operation = "reverse"}, + [4] = {route = "SIDING02", signal = "HEADSHUNT01_SIGNAL", operation = "autocouple"}, + [5] = {route = "HEADSHUNT01", signal = "SIDING02_SIGNAL", operation = "reverse"}, + [6] = {route = "SIDING03", signal = "HEADSHUNT01_SIGNAL", operation = "autocouple"}, + [7] = {route = "HEADSHUNT01", signal = "SIDING03_SIGNAL", operation = "reverse"}, + [8] = {route = "SIDING04", signal = "HEADSHUNT01_SIGNAL", operation = "autocouple"}, + [9] = {route = "HEADSHUNT01", signal = "SIDING04_SIGNAL", operation = "reverse"}, + [10] = {route = "SIDING05", signal = "HEADSHUNT01_SIGNAL", operation = "split_at_engine", split_count = "all"}, + [11] = {route = "SHUNT01", signal = "SIDING05_SIGNAL", operation = "forward"}, + [12] = {route = "SHUNT01", signal = nil, operation = "end"} + } + } + elseif type == "split_train_1_4" then + S.yards[yard] = { + ["state"] = { status = "ready", current = 1, train_length_count = 1 }, + ["actions"] = { + [1] = {route = "SHUNT01", signal = nil, operation = "start"}, + [2] = {route = "SIDING05", signal = "SHUNT01_SIGNAL", operation = "autocouple"}, + [3] = {route = "HEADSHUNT01", signal = "SIDING05_SIGNAL", operation = "reverse"}, + [4] = {route = "SIDING04", signal = "HEADSHUNT01_SIGNAL", operation = "split_at_engine", split_count = 1}, + [5] = {route = "HEADSHUNT01", signal = "SIDING04_SIGNAL", operation = "reverse"}, + [6] = {route = "SIDING03", signal = "HEADSHUNT01_SIGNAL", operation = "split_at_engine", split_count = 1}, + [7] = {route = "HEADSHUNT01", signal = "SIDING03_SIGNAL", operation = "reverse"}, + [8] = {route = "SIDING02", signal = "HEADSHUNT01_SIGNAL", operation = "split_at_engine", split_count = 1}, + [9] = {route = "HEADSHUNT01", signal = "SIDING02_SIGNAL", operation = "reverse"}, + [10] = {route = "SIDING01", signal = "HEADSHUNT01_SIGNAL", operation = "split_at_engine", split_count = 1}, + [11] = {route = "SHUNT01", signal = "SIDING01_SIGNAL", operation = "reverse"}, + [12] = {route = "SHUNT01", signal = nil, operation = "end"} + } + } + elseif type == "loop_test" then + S.yards[yard] = { + ["state"] = { status = "ready", current = 1, train_length_count = 1 }, + ["actions"] = { + [1] = {route = "SHUNT01", signal = nil, operation = "start"}, + [2] = {route = "SIDING05", signal = "SHUNT01_SIGNAL", operation = "autocouple"}, + [3] = {route = "ALTSIDING01", signal = "SIDING05_SIGNAL", operation = "reverse"}, + [4] = {route = "SIDING05", signal = "ALTSIDING01_BACK", operation = "forward"}, + [5] = {route = "SHUNT01", signal = "SIDING05_SIGNAL", operation = "split_at_engine", split_count = 4}, + [6] = {route = "SHUNT01", signal = nil, operation = "end"} + } + } + elseif type == "loop_test1" then + S.yards[yard] = { + ["state"] = { status = "ready", current = 1, train_length_count = 1 }, + ["actions"] = { + [1] = {route = "SHUNT01", signal = nil, operation = "start"}, + [2] = {route = "SIDING05", signal = "SHUNT01_SIGNAL", operation = "autocouple"}, + [3] = {route = "ALTSIDING01", signal = "SIDING05_SIGNAL", operation = "reverse"}, + [4] = {route = "SIDING05", signal = "ALTSIDING01_BACK", operation = "forward"}, + [5] = {route = "SHUNT01", signal = "SIDING05_SIGNAL", operation = "split_at_engine", split_count = 4}, + [6] = {route = nil, signal = nil, operation = "forward"}, + [7] = {route = nil, signal = nil, operation = "end"} + } + } + elseif type == "loop_autocouple_1_4" then + S.yards[yard] = { + ["state"] = { status = "ready", current = 1, train_length_count = 1 }, + ["actions"] = { + [1] = {route = "SHUNT01", signal = nil, operation = "start"}, + [2] = {route = "ALTSIDING01", signal = "SHUNT01_SIGNAL", operation = "forward"}, + [3] = {route = "SIDING01", signal = "ALTSIDING01_BACK", operation = "autocouple"}, + [4] = {route = "ALTSIDING01", signal = "SIDING01_SIGNAL", operation = "forward"}, + [5] = {route = "SIDING02", signal = "ALTSIDING01_BACK", operation = "autocouple"}, + [6] = {route = "ALTSIDING01", signal = "SIDING02_SIGNAL", operation = "forward"}, + [7] = {route = "SIDING03", signal = "ALTSIDING01_BACK", operation = "autocouple"}, + [8] = {route = "ALTSIDING01", signal = "SIDING03_SIGNAL", operation = "forward"}, + [9] = {route = "SIDING04", signal = "ALTSIDING01_BACK", operation = "autocouple"}, + [10] = {route = nil, signal = nil, operation = "forward"}, + [11] = {route = "HEADSHUNT01", signal = "SIDING04_SIGNAL", operation = "reverse"}, + [12] = {route = "SIDING05", signal = "HEADSHUNT01_SIGNAL", operation = "forward"}, + [13] = {route = "SHUNT01", signal = "SIDING05_SIGNAL", operation = "split_at_engine", split_count = 4}, + [14] = {route = nil, signal = nil, operation = "forward"}, + [15] = {route = nil, signal = nil, operation = "end"} + } + } + elseif type == "loop_test_old" then + S.yards[yard] = { + ["state"] = { status = "ready", current = 1, train_length_count = 1 }, + ["actions"] = { + [1] = {route = "SHUNT01", signal = nil, operation = "start"}, + [2] = {route = "ALTSIDING01", signal = "SHUNT01_SIGNAL", operation = "forward"}, + [3] = {route = "SIDING01", signal = "ALTSIDING01_BACK", operation = "forward"}, + [4] = {route = "ALTSIDING01", signal = "SIDING01_SIGNAL", operation = "forward"}, + [5] = {route = "SIDING02", signal = "ALTSIDING01_BACK", operation = "forward"}, + [6] = {route = "SHUNT01", signal = "SIDING02_SIGNAL", operation = "forward"}, + [7] = {route = "SHUNT01", signal = nil, operation = "end"} + } + } + elseif type == "test" then + S.yards[yard] = { + ["state"] = { status = "ready", current = 1, train_length_count = 1 }, + ["actions"] = { + [1] = {route = "SHUNT01", signal = nil, operation = "start"}, + [2] = {route = "SIDING05", signal = "SHUNT01_SIGNAL", operation = "autocouple"}, + [3] = {route = "ALTSIDING01", signal = "SHUNT01_SIGNAL", operation = "forward"}, + [4] = {route = "SIDING01", signal = "ALTSIDING01_BACK", operation = "forward"}, + [5] = {route = "ALTSIDING01", signal = "SIDING01_SIGNAL", operation = "split_at_engine", split_count = 1}, + [6] = {route = "SIDING02", signal = "ALTSIDING01_BACK", operation = "forward"}, + [7] = {route = "SHUNT01", signal = "SIDING02_SIGNAL", operation = "forward"}, + [8] = {route = "SHUNT01", signal = nil, operation = "end"} + } + } + else + F.print("This type (" .. type .. ") is not defined") + end + F.yard_run(yard, section_id) +end + +F.delete_train_info = function(train_id) + if S.trains[train_id] then + S.trains[train_id] = nil + F.print("Deleted train id: " .. train_id) + end +end + +F.list_trains = function(number_of_displays) + if S.trains then + if number_of_displays == nil then number_of_displays = F.max_displays end + F.clear_main_depot_displays() + number_of_displays = number_of_displays + 1 + count_keys = 0 + trains_table = {} + for k in pairs(S.trains) do + table.insert(trains_table, k) + count_keys = count_keys + 1 + end + table.sort(trains_table) + x = number_of_displays - count_keys + for _, k in ipairs(trains_table) do + if S.trains[k] then + v = S.trains[k] + if F.has_rc("LILSHUNTER", v["rc"]) or F.has_rc("LIL", v["rc"]) then + F.delete_train_info(v["id"]) + else + if v["ln"] == nil or v["ln"] == "" then + line_number = "" + else + line_number = "| LN: [" .. v["ln"] .. "]" + end + if v["rc"] == nil or v["rc"] == "" then + rc_display = "" + else + rc_list = v["rc"] + rc_list_cleansed = "" + rc_list_unknown = "" + rc_list_table = {} + if F.has_rc("ERSTAZI", rc_list) and F.has_rc("FREIGHT", rc_list) then + rc_list_cleansed = "ERSTAZI FREIGHT |" + else + rc_list_cleansed = "NO E,F |" + end + for rc in rc_list:gmatch("[^%s]+") do + if rc == "ERSTAZI" or rc == "FREIGHT" then + -- leaving for future use + do_nothing = true + else + if F.known_rcs[rc] ~= nil then + rc_list_cleansed = rc_list_cleansed .. " " .. rc + else + rc_list_unknown = rc_list_unknown .. " " .. rc + end + end + end + rc_display = "| RC: " .. rc_list_cleansed + if not F.isempty(rc_list_unknown) then + rc_display = rc_display .. "| *URC*:" .. rc_list_unknown + end + end + if v["cars_count"] == nil or v["cars_count"] == "" then + cars_count_display = " Len: 0" + else + cars_count = tonumber(v["cars_count"]) + cars_count_display = " Len: " .. cars_count + end + message = " ID: " .. v["id"] .. cars_count_display .. rc_display .. line_number + if x > 0 then digiline_send("train_display" .. x, message) end + F.print(x .. ": " .. message) + x = x + 1 + end + end + end + else + F.print("no trains saved in S.trains") + end +end + +F.slow_train_down = function(id) + result = atc_send_to_train(id, "B1") + if result == false then + F.print("Train ID " .. id .. " does not exist") + else + F.print("Train ID " .. id .. " is slowed down to B1") end end -S.train_duration = {} F.train_duration = function(type) if not atc_id then return end local now = os.date("%H:%M:%S") - if F.isempty(type) then - type = "start" - end + if F.isempty(type) then type = "start" end if not S.train_duration[atc_id] then - S.train_duration[atc_id] = { ["train_id"] = atc_id, ["start"] = "", ["end"] = "" } + S.train_duration[atc_id] = { ["train_id"] = atc_id, ["start"] = "", ["end"] = "", ["start_sec"] = "", ["end_sec"] = "", ["diff"] = {} } end if type == "start" then - S.train_duration[atc_id]["end"] = "Nil" + S.train_duration[atc_id]["end"] = nil + S.train_duration[atc_id]["end_sec"] = nil end S.train_duration[atc_id][type] = now + S.train_duration[atc_id][type .. "_sec"] = os.time() + if + S.train_duration[atc_id]["start_sec"] ~= nil + and S.train_duration[atc_id]["start_sec"] ~= "" + and S.train_duration[atc_id]["end_sec"] ~= nil + and S.train_duration[atc_id]["end_sec"] ~= "" + then + if S.train_duration[atc_id]["diff"] == nil then S.train_duration[atc_id]["diff"] = {} end + -- Returns the difference, in seconds, from time t1 to time t2 (where the times are values returned by os.time) + difference_in_time = os.difftime(S.train_duration[atc_id]["end_sec"], S.train_duration[atc_id]["start_sec"]) + table.insert(S.train_duration[atc_id]["diff"], difference_in_time) + end end F.train_info = function (passive_name, show_print) local timestart = "" local timeend = "" local time_message = "" + local average_duration_message = "" if F.isempty(passive_name) or passive_name == "RESETALL" then - msg_atc_id = "No Train" + train_id_message = "No Train" if passive_name == "RESETALL" then S.train_duration = {} + -- Holding off on resetting the whole table of S.trains + -- S.trains = {} end else timestart = S.train_duration[atc_id]["start"] timeend = S.train_duration[atc_id]["end"] - msg_atc_id = atc_id + train_id_message = "Last Train: " .. atc_id end - local lcd_message = "" .. - msg_atc_id .. - "" - - if not F.isempty(timestart) and not F.isempty(timeend) then - time_message = "Time: | " .. timestart .. " to " .. timeend - elseif not F.isempty(timestart) and F.isempty(timeend) then - time_message = "Start Time: | " .. timestart + if timestart == nil and timeend == nil then + time_message = "Current Time: |" .. os.date("%H:%M:%S") + elseif timestart ~= nil and timeend == nil then + time_message = "Start: |" .. timestart else - time_message = "RegTime: | " .. os.date("%H:%M:%S") + time_message = "Time: |" .. timestart .. " to " .. timeend end - + average_duration_message = "|AVG: " .. math.ceil(F.avg(S.train_duration[atc_id]["diff"])) .. "s" + local lcd_message = "" .. + train_id_message .. "|" .. + time_message .. + average_duration_message .. + "" digiline_send("lcd", lcd_message) - digiline_send("time", time_message) local message = lcd_message .. " | " .. time_message - if show_print == true then F.print(message) end end - -F.does_train_have_rc = function(wanted_rc) - local rc = get_rc() or "" - if rc:match(wanted_rc) then - return true - else - return false - end -end - -F.send_route = function(passive_name, route, show_print) - if can_set_route(passive_name, route) then - set_route(passive_name, route) - if show_print == true then - F.print(passive_name .. " has been set to " .. route) - end - return true - else - if show_print == true then - F.print(route .. " cannot be set for " .. passive_name .. ". Try another") - end - return false - end -end - -if event.type == "init" then - F.print("Initialized") -end
\ No newline at end of file diff --git a/ers/nodes/(-3693,11,-3604).lua b/ers/nodes/(-3693,11,-3604).lua new file mode 100644 index 0000000..4aefac3 --- /dev/null +++ b/ers/nodes/(-3693,11,-3604).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(-3693,11,-3604) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W S1") + else + step_fc() + atc_send("SM") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(-3693,11,-3608).lua b/ers/nodes/(-3693,11,-3608).lua new file mode 100644 index 0000000..8f05fc4 --- /dev/null +++ b/ers/nodes/(-3693,11,-3608).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(-3693,11,-3608) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W S1") + else + step_fc() + atc_send("SM") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1595,-14,1496).lua b/ers/nodes/(1595,-14,1496).lua new file mode 100644 index 0000000..185f4ab --- /dev/null +++ b/ers/nodes/(1595,-14,1496).lua @@ -0,0 +1,13 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1595,-14,1496) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("S5") + else + atc_send("B5") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1605,14,1414).lua b/ers/nodes/(1605,14,1414).lua new file mode 100644 index 0000000..74a7f4b --- /dev/null +++ b/ers/nodes/(1605,14,1414).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1605,14,1414) + +local show_print = false +if event.train then + if atc_arrow then + F.save_train() + else + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1608,14,1414).lua b/ers/nodes/(1608,14,1414).lua new file mode 100644 index 0000000..a45cd5f --- /dev/null +++ b/ers/nodes/(1608,14,1414).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1608,14,1414) + +local show_print = false +if event.train then + if atc_arrow then + F.save_train() + else + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1636,4,1331).lua b/ers/nodes/(1636,4,1331).lua new file mode 100644 index 0000000..0f54c10 --- /dev/null +++ b/ers/nodes/(1636,4,1331).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1636,4,1331) + +local show_print = false +if event.train then + if atc_arrow then + F.save_train() + else + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1271).lua b/ers/nodes/(1656,2,1271).lua new file mode 100644 index 0000000..73a2466 --- /dev/null +++ b/ers/nodes/(1656,2,1271).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1271) + +F.yard_siding("ers_main", "ALTSIDING01", "end_alt")
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1279).lua b/ers/nodes/(1656,2,1279).lua new file mode 100644 index 0000000..9b25287 --- /dev/null +++ b/ers/nodes/(1656,2,1279).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1279) + +F.yard_siding("ers_main", "HEADSHUNT02", "end")
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1282).lua b/ers/nodes/(1656,2,1282).lua new file mode 100644 index 0000000..ac46839 --- /dev/null +++ b/ers/nodes/(1656,2,1282).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1282) + +F.yard_siding("ers_main", "SIDING06", "end")
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1285).lua b/ers/nodes/(1656,2,1285).lua new file mode 100644 index 0000000..a81ba9f --- /dev/null +++ b/ers/nodes/(1656,2,1285).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1285) + +F.yard_siding("ers_main", "SIDING05", "end")
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1294).lua b/ers/nodes/(1656,2,1294).lua new file mode 100644 index 0000000..4a37559 --- /dev/null +++ b/ers/nodes/(1656,2,1294).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1294) + +F.yard_siding("ers_main", "SIDING02", "end")
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1297).lua b/ers/nodes/(1656,2,1297).lua new file mode 100644 index 0000000..0bdb8aa --- /dev/null +++ b/ers/nodes/(1656,2,1297).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1297) + +F.yard_siding("ers_main", "SIDING01", "end")
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1300).lua b/ers/nodes/(1656,2,1300).lua new file mode 100644 index 0000000..132e944 --- /dev/null +++ b/ers/nodes/(1656,2,1300).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1656,2,1300) + +F.yard_siding("ers_main", "ALTSIDING02", "end")
\ No newline at end of file diff --git a/ers/nodes/(1656,2,1308).lua b/ers/nodes/(1656,2,1308).lua new file mode 100644 index 0000000..dd97581 --- /dev/null +++ b/ers/nodes/(1656,2,1308).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1656,2,1308) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1657,6,1237).lua b/ers/nodes/(1657,6,1237).lua index 0cb6ef7..747e816 100644 --- a/ers/nodes/(1657,6,1237).lua +++ b/ers/nodes/(1657,6,1237).lua @@ -1,6 +1,6 @@ -- luaoperatingpanel_depot_01.lua local show_print = false if event.type == "punch" then - F.train_info("RESETALL", show_print) +-- F.train_info("RESETALL", show_print) return end
\ No newline at end of file diff --git a/ers/nodes/(1658,1,1238).lua b/ers/nodes/(1658,1,1238).lua new file mode 100644 index 0000000..c9e2edb --- /dev/null +++ b/ers/nodes/(1658,1,1238).lua @@ -0,0 +1,40 @@ +-- luaatctrack_main_depot_01.lua +local show_print = false +if event.train then + if atc_arrow then + local passive_name = "ErsDepotTurnaround" + local track_route = "01 EXTRA" + local can_do_route1 = false + local can_do_route2 = false + local rc_list = F.get_rc_safe() + F.save_train() + F.train_duration("start") + F.train_info(passive_name, show_print) + if F.has_rc("ERSTAZIDEPOTUNLOAD", rc_list) + or F.has_rc("DEPOTUNLOADING", rc_list) + or F.has_rc("FERTRUNNER", rc_list) + then + track_route = "03 UNLOADING TRACK" + elseif F.has_rc("DEPOTLOADING", rc_list) + or F.has_rc("ERSTAZITST", rc_list) + then + track_route = "02 LOADING TRACK" + end + + can_do_route1 = F.send_route(passive_name, track_route, show_print) + if can_do_route1 == false then + track_route = "01 EXTRA" + can_do_route2 = F.send_route(passive_name, track_route, show_print) + if can_do_route2 == false then + track_route = "04 EXTRA" + F.send_route(passive_name, track_route, show_print) + end + end + else + F.save_train() + local passive_name = "ErsDepotTurnaround" + F.train_duration("end") + F.train_info(passive_name, show_print) + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1658,2,1304).lua b/ers/nodes/(1658,2,1304).lua new file mode 100644 index 0000000..f2096ca --- /dev/null +++ b/ers/nodes/(1658,2,1304).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1658,2,1304) + +F.yard_siding("ers_main", "LOAD/UNLOAD TURNAROUND", "end")
\ No newline at end of file diff --git a/ers/nodes/(1658,6,1237).lua b/ers/nodes/(1658,6,1237).lua new file mode 100644 index 0000000..9017b1b --- /dev/null +++ b/ers/nodes/(1658,6,1237).lua @@ -0,0 +1,13 @@ +-- luaoperatingpanel_depot_02.lua +local show_print = false +if event.type == "punch" then + +-- F.delete_train_info("337564") +-- F.delete_train_info("450511") + +-- F.list_trains(12) +-- F.list_trains(32) + F.list_trains(36) +-- F.list_trains(52) + return +end
\ No newline at end of file diff --git a/ers/nodes/(1661,2,1273).lua b/ers/nodes/(1661,2,1273).lua new file mode 100644 index 0000000..3b255c0 --- /dev/null +++ b/ers/nodes/(1661,2,1273).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1661,2,1273) + +F.yard_siding("ers_main", "SHUNT02", "end")
\ No newline at end of file diff --git a/ers/nodes/(1670,-3,1499).lua b/ers/nodes/(1670,-3,1499).lua new file mode 100644 index 0000000..485bce3 --- /dev/null +++ b/ers/nodes/(1670,-3,1499).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1670,-3,1499) + +local show_print = false +if event.train then + if atc_arrow then + F.save_train() + else + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1670,2,1244).lua b/ers/nodes/(1670,2,1244).lua new file mode 100644 index 0000000..6c6e030 --- /dev/null +++ b/ers/nodes/(1670,2,1244).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1670,2,1244) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W R") + -- atc_send("S5") + -- else + -- atc_send("B3 S3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1670,2,1247).lua b/ers/nodes/(1670,2,1247).lua new file mode 100644 index 0000000..71325a7 --- /dev/null +++ b/ers/nodes/(1670,2,1247).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1670,2,1247) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W R") + -- atc_send("S5") + -- else + -- atc_send("B3 S3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1670,2,1250).lua b/ers/nodes/(1670,2,1250).lua new file mode 100644 index 0000000..600d6d5 --- /dev/null +++ b/ers/nodes/(1670,2,1250).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1670,2,1250) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W R") + -- atc_send("S5") + -- else + -- atc_send("B3 S3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1670,2,1253).lua b/ers/nodes/(1670,2,1253).lua new file mode 100644 index 0000000..5d0b7e0 --- /dev/null +++ b/ers/nodes/(1670,2,1253).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1670,2,1253) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W R") + -- atc_send("S5") + -- else + -- atc_send("B3 S3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1670,2,1256).lua b/ers/nodes/(1670,2,1256).lua new file mode 100644 index 0000000..e1a2576 --- /dev/null +++ b/ers/nodes/(1670,2,1256).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1670,2,1256) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W R") + -- atc_send("S5") + -- else + -- atc_send("B3 S3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1670,2,1262).lua b/ers/nodes/(1670,2,1262).lua new file mode 100644 index 0000000..8d45c19 --- /dev/null +++ b/ers/nodes/(1670,2,1262).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1670,2,1262) + +local show_print = false +if event.train then + F.save_train() + if atc_arrow then + atc_send("B0 W R") + -- atc_send("S5") + -- else + -- atc_send("B3 S3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1682,-14,1402).lua b/ers/nodes/(1682,-14,1402).lua new file mode 100644 index 0000000..d911294 --- /dev/null +++ b/ers/nodes/(1682,-14,1402).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1682,-14,1402) + +local show_print = false +if event.train then + if atc_arrow then + F.save_train() + else + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1693,2,1270).lua b/ers/nodes/(1693,2,1270).lua new file mode 100644 index 0000000..25583e8 --- /dev/null +++ b/ers/nodes/(1693,2,1270).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1693,2,1270) + +F.yard_siding("ers_main", "SHUNT01", "start")
\ No newline at end of file diff --git a/ers/nodes/(1694,2,1300).lua b/ers/nodes/(1694,2,1300).lua new file mode 100644 index 0000000..5fb4e1d --- /dev/null +++ b/ers/nodes/(1694,2,1300).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1694,2,1300) + +F.yard_siding("ers_main", "ALTSIDING02", "start")
\ No newline at end of file diff --git a/ers/nodes/(1695,2,1273).lua b/ers/nodes/(1695,2,1273).lua new file mode 100644 index 0000000..1c9ec2c --- /dev/null +++ b/ers/nodes/(1695,2,1273).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1695,2,1273) + +F.yard_siding("ers_main", "SHUNT02", "start")
\ No newline at end of file diff --git a/ers/nodes/(1695,2,1297).lua b/ers/nodes/(1695,2,1297).lua new file mode 100644 index 0000000..dcf7700 --- /dev/null +++ b/ers/nodes/(1695,2,1297).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1695,2,1297) + +F.yard_siding("ers_main", "SIDING01", "start")
\ No newline at end of file diff --git a/ers/nodes/(1699,2,1262).lua b/ers/nodes/(1699,2,1262).lua new file mode 100644 index 0000000..51211ee --- /dev/null +++ b/ers/nodes/(1699,2,1262).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1699,2,1262) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1699,2,1276).lua b/ers/nodes/(1699,2,1276).lua new file mode 100644 index 0000000..63aab36 --- /dev/null +++ b/ers/nodes/(1699,2,1276).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1699,2,1276) + +F.yard_siding("ers_main", "HEADSHUNT01", "start")
\ No newline at end of file diff --git a/ers/nodes/(1699,2,1279).lua b/ers/nodes/(1699,2,1279).lua new file mode 100644 index 0000000..a63d6fe --- /dev/null +++ b/ers/nodes/(1699,2,1279).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1699,2,1279) + +F.yard_siding("ers_main", "HEADSHUNT02", "start")
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1244).lua b/ers/nodes/(1700,2,1244).lua new file mode 100644 index 0000000..ff6154a --- /dev/null +++ b/ers/nodes/(1700,2,1244).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1700,2,1244) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1247).lua b/ers/nodes/(1700,2,1247).lua new file mode 100644 index 0000000..f52056b --- /dev/null +++ b/ers/nodes/(1700,2,1247).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1700,2,1247) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1250).lua b/ers/nodes/(1700,2,1250).lua new file mode 100644 index 0000000..5daad5a --- /dev/null +++ b/ers/nodes/(1700,2,1250).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1700,2,1250) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1253).lua b/ers/nodes/(1700,2,1253).lua new file mode 100644 index 0000000..75b1559 --- /dev/null +++ b/ers/nodes/(1700,2,1253).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1700,2,1253) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1259).lua b/ers/nodes/(1700,2,1259).lua new file mode 100644 index 0000000..e989e66 --- /dev/null +++ b/ers/nodes/(1700,2,1259).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1700,2,1259) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1282).lua b/ers/nodes/(1700,2,1282).lua new file mode 100644 index 0000000..be4cd88 --- /dev/null +++ b/ers/nodes/(1700,2,1282).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1700,2,1282) + +F.yard_siding("ers_main", "SIDING06", "start")
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1285).lua b/ers/nodes/(1700,2,1285).lua new file mode 100644 index 0000000..8e60f0b --- /dev/null +++ b/ers/nodes/(1700,2,1285).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1700,2,1285) + +F.yard_siding("ers_main", "SIDING05", "start")
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1288).lua b/ers/nodes/(1700,2,1288).lua new file mode 100644 index 0000000..30a6a77 --- /dev/null +++ b/ers/nodes/(1700,2,1288).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1700,2,1288) + +F.yard_siding("ers_main", "SIDING04", "start")
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1291).lua b/ers/nodes/(1700,2,1291).lua new file mode 100644 index 0000000..b1aa450 --- /dev/null +++ b/ers/nodes/(1700,2,1291).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1700,2,1291) + +F.yard_siding("ers_main", "SIDING03", "start")
\ No newline at end of file diff --git a/ers/nodes/(1700,2,1304).lua b/ers/nodes/(1700,2,1304).lua new file mode 100644 index 0000000..ab8bcf3 --- /dev/null +++ b/ers/nodes/(1700,2,1304).lua @@ -0,0 +1,4 @@ +-- luaatctrack_yard_check_01.lua +-- POS(1700,2,1304) + +F.yard_siding("ers_main", "LOAD/UNLOAD TURNAROUND", "start")
\ No newline at end of file diff --git a/ers/nodes/(1701,2,1256).lua b/ers/nodes/(1701,2,1256).lua new file mode 100644 index 0000000..1fa8fb0 --- /dev/null +++ b/ers/nodes/(1701,2,1256).lua @@ -0,0 +1,14 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1701,2,1256) + +local show_print = false +if event.train then + if atc_arrow then + atc_send("S5") + F.save_train() + else + atc_send("B3 S3") + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1702,2,1269).lua b/ers/nodes/(1702,2,1269).lua new file mode 100644 index 0000000..851d36f --- /dev/null +++ b/ers/nodes/(1702,2,1269).lua @@ -0,0 +1,8 @@ +-- luaatctrack_run_sequence_01.lua +local show_print = false +if event.type == "punch" then + F.trial_setup("split_train_1_4") +-- F.trial_setup("loop_test1") +-- F.trial_setup("loop_autocouple_1_4") + return +end
\ No newline at end of file diff --git a/ers/nodes/(1702,2,1270).lua b/ers/nodes/(1702,2,1270).lua new file mode 100644 index 0000000..823ad84 --- /dev/null +++ b/ers/nodes/(1702,2,1270).lua @@ -0,0 +1,6 @@ +-- luaatctrack_run_sequence_01.lua +local show_print = false +if event.type == "punch" then + F.trial_setup("autocouple_1_4") + return +end
\ No newline at end of file diff --git a/ers/nodes/(1704,2,1269).lua b/ers/nodes/(1704,2,1269).lua new file mode 100644 index 0000000..05766c3 --- /dev/null +++ b/ers/nodes/(1704,2,1269).lua @@ -0,0 +1,6 @@ +-- luaatctrack_run_sequence_01.lua + +if event.type == "punch" then + F.reset_trial_setup() + return +end
\ No newline at end of file diff --git a/ers/nodes/(1747,-14,1440).lua b/ers/nodes/(1747,-14,1440).lua new file mode 100644 index 0000000..cdc0a34 --- /dev/null +++ b/ers/nodes/(1747,-14,1440).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1747,-14,1440) + +local show_print = false +if event.train then + if atc_arrow then + F.save_train() + else + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1750,-14,1449).lua b/ers/nodes/(1750,-14,1449).lua new file mode 100644 index 0000000..a909162 --- /dev/null +++ b/ers/nodes/(1750,-14,1449).lua @@ -0,0 +1,12 @@ +-- luaatctrack_spot_check_01.lua +-- POS(1750,-14,1449) + +local show_print = false +if event.train then + if atc_arrow then + F.save_train() + else + F.save_train() + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1929,3,7928).lua b/ers/nodes/(1929,3,7928).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/ers/nodes/(1929,3,7928).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/ers/nodes/(1932,3,7927).lua b/ers/nodes/(1932,3,7927).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/ers/nodes/(1932,3,7927).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/ers/nodes/(1935,3,7924).lua b/ers/nodes/(1935,3,7924).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/ers/nodes/(1935,3,7924).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/ers/nodes/(1938,3,7921).lua b/ers/nodes/(1938,3,7921).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/ers/nodes/(1938,3,7921).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/ers/nodes/(1944,3,7915).lua b/ers/nodes/(1944,3,7915).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/ers/nodes/(1944,3,7915).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/ers/nodes/(1947,3,7912).lua b/ers/nodes/(1947,3,7912).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/ers/nodes/(1947,3,7912).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/ers/nodes/(1950,3,7909).lua b/ers/nodes/(1950,3,7909).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/ers/nodes/(1950,3,7909).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/ers/nodes/(1986,2,1743).lua b/ers/nodes/(1986,2,1743).lua new file mode 100644 index 0000000..8e797a9 --- /dev/null +++ b/ers/nodes/(1986,2,1743).lua @@ -0,0 +1,14 @@ +-- luaatctrack_docking_ferry_01.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + if atc_arrow then + -- atc_send("B0 W R OL A1") + atc_send("B0 W R OR A1") + else + do_something = false + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1986,2,1759).lua b/ers/nodes/(1986,2,1759).lua new file mode 100644 index 0000000..af6446c --- /dev/null +++ b/ers/nodes/(1986,2,1759).lua @@ -0,0 +1,13 @@ +-- luaatctrack_docking_ferry_leaving_dock.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + if atc_arrow then + atc_send("OC A1 S5") + else + atc_send("OC A0 B3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1991,2,1794).lua b/ers/nodes/(1991,2,1794).lua new file mode 100644 index 0000000..b81d9e1 --- /dev/null +++ b/ers/nodes/(1991,2,1794).lua @@ -0,0 +1,28 @@ +-- luaatctrack_docking_ferry_01.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + local passive_name = "DOCKSIGNAL" + if atc_arrow then + local can_do_route = false + atc_send("B0 W R OC D1 S5") + can_do_route = F.send_route(passive_name, "DOCK 5", show_print) + if can_do_route == false then + can_do_route = F.send_route(passive_name, "DOCK 4", show_print) + if can_do_route == false then + can_do_route = F.send_route(passive_name, "DOCK 3", show_print) + if can_do_route == false then + can_do_route = F.send_route(passive_name, "DOCK 2", show_print) + if can_do_route == false then + can_do_route = F.send_route(passive_name, "DOCK 1", show_print) + end + end + end + end + else + do_something = false + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1993,2,1743).lua b/ers/nodes/(1993,2,1743).lua new file mode 100644 index 0000000..ca383df --- /dev/null +++ b/ers/nodes/(1993,2,1743).lua @@ -0,0 +1,14 @@ +-- luaatctrack_docking_ferry_01.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + if atc_arrow then + atc_send("B0 W R OL A1") + -- atc_send("B0 W R OR A1") + else + do_something = false + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(1993,2,1759).lua b/ers/nodes/(1993,2,1759).lua new file mode 100644 index 0000000..af6446c --- /dev/null +++ b/ers/nodes/(1993,2,1759).lua @@ -0,0 +1,13 @@ +-- luaatctrack_docking_ferry_leaving_dock.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + if atc_arrow then + atc_send("OC A1 S5") + else + atc_send("OC A0 B3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(2001,2,1759).lua b/ers/nodes/(2001,2,1759).lua new file mode 100644 index 0000000..af6446c --- /dev/null +++ b/ers/nodes/(2001,2,1759).lua @@ -0,0 +1,13 @@ +-- luaatctrack_docking_ferry_leaving_dock.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + if atc_arrow then + atc_send("OC A1 S5") + else + atc_send("OC A0 B3") + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(2016,2,1743).lua b/ers/nodes/(2016,2,1743).lua new file mode 100644 index 0000000..8e797a9 --- /dev/null +++ b/ers/nodes/(2016,2,1743).lua @@ -0,0 +1,14 @@ +-- luaatctrack_docking_ferry_01.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + if atc_arrow then + -- atc_send("B0 W R OL A1") + atc_send("B0 W R OR A1") + else + do_something = false + end + return +end
\ No newline at end of file diff --git a/ers/nodes/(2016,2,1759).lua b/ers/nodes/(2016,2,1759).lua new file mode 100644 index 0000000..af6446c --- /dev/null +++ b/ers/nodes/(2016,2,1759).lua @@ -0,0 +1,13 @@ +-- luaatctrack_docking_ferry_leaving_dock.lua +local show_print = false +local do_something = false +if event.train then + atc_set_text_outside(nil) + atc_set_text_inside(nil) + if atc_arrow then + atc_send("OC A1 S5") + else + atc_send("OC A0 B3") + end + return +end
\ No newline at end of file |