From 5ecf1844f59e1ac1670a3c167cfececc4d0e7118 Mon Sep 17 00:00:00 2001 From: Skgland <bb-github@t-online.de> Date: Wed, 2 Feb 2022 21:34:02 +0100 Subject: [PATCH] use approach in plattform_exit_trigger --- env_setup-fahrplan.lua | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/env_setup-fahrplan.lua b/env_setup-fahrplan.lua index 2b7a26f..86f5a6d 100644 --- a/env_setup-fahrplan.lua +++ b/env_setup-fahrplan.lua @@ -163,9 +163,6 @@ S.callbacks = { -- deactivate everything? S.deactivated = false --- enable approach callback mode in both directions -__approach_callback_mode = 2 - -- debugging stuff S.debug_train_id = "259435" S.check_line_data = {} @@ -325,6 +322,7 @@ F.platform_exit_trigger = function(station, platform, event, atc_arrow, get_line if S.deactivated then return end + __approach_callback_mode = 2 if event.train then local line = get_line() if line ~= nil then @@ -335,6 +333,11 @@ F.platform_exit_trigger = function(station, platform, event, atc_arrow, get_line F.enter_platform(station, platform, line, true) end end + elseif event.approach and not atc_arrow then + local line = get_line() + if line ~= nil then + F.approach_station(station, entry, line, true) + end end end @@ -450,6 +453,16 @@ F.enter_platform = function(station, platform, line, announce_changes) end end +F.approach_platform = function(station, platform, line, announce_changes) + if S.deactivated then + return + end + + if event.id ~= S.debug_train_id then + return enter_platform(station, platform, line, announce_changes) + end +end + -- When a train leaves the platform F.exit_platform = function(station, platform, line, announce_changes) if S.deactivated then @@ -723,7 +736,6 @@ F.util.multidisplay_print = function(displayarray,text,line_break,screen_width,s local screen_height = screen_height or 2 local line_break = line_break or " | " - local multi_screen_width = #displayarray[1] * (screen_width) local multi_screen_lines = {} @@ -743,7 +755,6 @@ F.util.multidisplay_print = function(displayarray,text,line_break,screen_width,s print(F.util.pretty(multi_screen_lines)) end - local display_line = 1 local lcd_strings = {} -- GitLab