diff --git a/env_setup-fahrplan.lua b/env_setup-fahrplan.lua index 2b7a26fbfa9022cd481c839ba0b992449486603a..86f5a6dfe5edfe1cc2c78e5e79190b7b332214ad 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 = {}