From ef6736062f784c36b85f20f8678d274070a6d44f Mon Sep 17 00:00:00 2001 From: autocommitter Date: Mon, 22 Apr 2024 15:00:36 +0200 Subject: State at 2023-07-23 --- far/init_code.lua | 14 +++++++++++++- far/nodes/(2066,9,1459).lua | 8 ++++++++ far/nodes/(28048,8,1612).lua | 8 ++++++++ far/nodes/(30834,16,1863).lua | 33 +++++++++++++++++++++++++++++++++ far/nodes/(30848,15,1852).lua | 25 +++++++++++++++++++++++++ far/nodes/(30870,15,1800).lua | 11 ----------- 6 files changed, 87 insertions(+), 12 deletions(-) create mode 100644 far/nodes/(2066,9,1459).lua create mode 100644 far/nodes/(28048,8,1612).lua create mode 100644 far/nodes/(30834,16,1863).lua create mode 100644 far/nodes/(30848,15,1852).lua 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 diff --git a/far/nodes/(2066,9,1459).lua b/far/nodes/(2066,9,1459).lua new file mode 100644 index 0000000..d3d6fe7 --- /dev/null +++ b/far/nodes/(2066,9,1459).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS(2066,9,1459) + F.save_train(posTable) + return +end \ No newline at end of file diff --git a/far/nodes/(28048,8,1612).lua b/far/nodes/(28048,8,1612).lua new file mode 100644 index 0000000..3f12a6c --- /dev/null +++ b/far/nodes/(28048,8,1612).lua @@ -0,0 +1,8 @@ +-- far_luaatctrack_spot_check_01.lua + +local show_print = false +if event.train then + local posTable = POS( 28048,8,1612 ) + F.save_train(posTable) + return +end \ No newline at end of file diff --git a/far/nodes/(30834,16,1863).lua b/far/nodes/(30834,16,1863).lua new file mode 100644 index 0000000..ef8bd02 --- /dev/null +++ b/far/nodes/(30834,16,1863).lua @@ -0,0 +1,33 @@ +-- far_luaatctrack_farcom_op_01.lua + + +if event.type == "punch" then +-- F.delete_train_info("298909") + S.stop_display = false + + F.send_update_displays() + + if S.stop_display then + date = F.date_formatted() + time = F.time_formatted() + digiline_send("time", " FAR COM\n\n " .. date .. "\n " .. time) + F.list_trains(false) + else + local pos = POS(30848,15,1852) + interrupt_pos(pos, "display") + end + + return +end + +if event.type == "digiline" then + if event.channel == "display" then + if event.msg == "update" then + date = F.date_formatted() + time = F.time_formatted() + digiline_send("time", " FAR COM\n\n " .. date .. "\n " .. time) + F.list_trains(false) + end + end + return +end diff --git a/far/nodes/(30848,15,1852).lua b/far/nodes/(30848,15,1852).lua new file mode 100644 index 0000000..e55e17b --- /dev/null +++ b/far/nodes/(30848,15,1852).lua @@ -0,0 +1,25 @@ +-- far_luaatctrack_spot_check_01.lua + +if event.type == "train" then + local posTable = POS(30848,15,1852) + F.save_train(posTable) + digiline_send("display", "update") + return +end + +if event.type == "ext_int" then + if event.message == "display" then + interrupt(30,"update_display") + end + return +end + + +if event.type == "int" then + if event.msg == "update_display" then + if S.stop_display == true then return end + digiline_send("display", "update") + interrupt(60,"update_display") + end + return +end \ No newline at end of file diff --git a/far/nodes/(30870,15,1800).lua b/far/nodes/(30870,15,1800).lua index 153ef38..b50e6aa 100644 --- a/far/nodes/(30870,15,1800).lua +++ b/far/nodes/(30870,15,1800).lua @@ -5,15 +5,4 @@ if event.train then local posTable = POS(30870,15,1800) F.save_train(posTable) return -end - - --- INSIDE A STUPID FUCKING LUA TRACK --- DONT TOUCH OR ELSE -if event.type == "ext_int" then - if event.message == "display" then - header() - disp_data() - end - return end \ No newline at end of file -- cgit v1.2.3