diff options
Diffstat (limited to 'far/init_code.lua')
-rw-r--r-- | far/init_code.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/far/init_code.lua b/far/init_code.lua index c9c0ece..a003420 100644 --- a/far/init_code.lua +++ b/far/init_code.lua @@ -2,6 +2,7 @@ if S.trains == nil then S.trains = {} end if S.d == nil then S.d = {} end if S.datetime == nil then S.datetime = "" end +if S.stop_display == nil then S.stop_display = false end F.print = function (str) if F.debug then print("".. (str or "nil") ) end end F.isempty = function (s) return s == nil or s == "" end @@ -62,7 +63,7 @@ F.save_train = function(pos) else pos_string = pos["x"] .. "," .. pos["y"] .. "," .. pos["z"] end - if F.has_rc("LILSHUNTER", F.get_rc_safe()) then + if F.has_rc("FAREAST", F.get_rc_safe()) 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(), ["pos"] = pos_string } -- F.print("Train ID: " .. S.trains[atc_id]["id"] .. " at " .. S.trains[atc_id]["pos"]) -- remote_track = POS(30919,13,1812) @@ -94,6 +95,17 @@ F.delete_train_info = function(train_id) end F.clear_main_depot_displays = function() for i = 1, F.max_displays, 1 do digiline_send("train_display" .. i, " ") end end +F.send_update_displays = function() for i = 1, F.max_displays, 1 do digiline_send("train_display" .. i, "Updating...") end end + +F.date_formatted = function() + date = os.date("%Y-%m-%d") + return date +end + +F.time_formatted = function() + time = os.date("*t") + return string.format("%02d:%02d:%02d %s", time.hour, time.min, time.sec, (time.isdst and "CEST") or "CET") +end F.list_trains = function(print_info) if S.trains then |