From 803bd1c2a28499125d5b1fb49e5595a033e07d39 Mon Sep 17 00:00:00 2001 From: orwell Date: Tue, 17 Jun 2025 23:42:55 +0200 Subject: [CH merge] Adapt code after rebase, emulate/copy some code from CH --- advtrains_line_automation/station_announcement.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'advtrains_line_automation/station_announcement.lua') diff --git a/advtrains_line_automation/station_announcement.lua b/advtrains_line_automation/station_announcement.lua index c4ee162..c075597 100644 --- a/advtrains_line_automation/station_announcement.lua +++ b/advtrains_line_automation/station_announcement.lua @@ -1,12 +1,22 @@ local al = advtrains.lines local F = core.formspec_escape -local ifthenelse = assert(ch_core.ifthenelse) +local ch_core = al.ch_core +--[[ +Jednoduchá funkce, která vyhodnotí condition jako podmínku +a podle výsledku vrátí buď true_result, nebo false_result. +]] +local function ifthenelse(condition, true_result, false_result) + if condition then + return true_result + else + return false_result + end +end local rwt = assert(advtrains.lines.rwt) local def local function CF(s) if s ~= nil then return F(s) else return "" end end -local has_ch_time = core.get_modpath("ch_time") local has_signs_api = core.get_modpath("signs_api") local has_unifieddyes = core.get_modpath("unifieddyes") local rozhlas_node_name = "advtrains_line_automation:stanicni_rozhlas" @@ -1011,12 +1021,6 @@ local function update_ann(stn, epos, signs, records, rwtime) end end end - if has_ch_time then - local cas = ch_time.aktualni_cas() - any_line.HH = string.format("%02d", cas.hodina) - any_line.MM = string.format("%02d", cas.minuta) - any_line.SS = string.format("%02d", cas.sekunda) - end local lines = {} for _, record in ipairs(records) do assert(record.start ~= nil) -- cgit v1.2.3