Page 1 of 1

Events on_map_position_changed, on_zoom_level_changed, on_render_mode_changed

Posted: Sun Apr 07, 2019 9:01 am
by jarcionek
I am trying to revert zooming behaviour to what it was in version 0.15.10, when zooming was more aggressive and it was possible to zoom out farther: I have overridden what the following game controls do:
  • toggle-map
  • zoom-out
  • zoom-in
  • alt-zoom-out
  • alt-zoom-in
With the minor exceptions of the latter, where I sometimes don't override it, but instead only listen to when it happens.

However, there is plenty of cases when the game changes the render_mode and/or position and/or zoom_level that cannot be overridden and sometimes not even detected by a mod:
  • clicking on the minimap to open a map
  • clicking on 'Open this location in map.' in the train GUI
  • doing the above with the 'Toggle centering on locomotive' enabled
  • clicking on the alert
  • using move-up, move-down, move-left, move-right actions on the map
  • using drag-map action on the map
I don't need to be able to take a full control over all of the above, but if the game was able to notify my mod what are the current values, I would be able to work around with that.

Having the following events would be a great help:
  • on_map_position_changed
  • on_zoom_level_changed
  • on_render_mode_changed
It could be three events or it could be one with three properties. I am not sure what is the best/easiest solution for the map following the train as the position is constantly changing and firing an event every tick or so would be pointless - but maybe just a flag at on_map_position_changed saying that it is following a train? The only was to stop following the train is to drag a map (which currently can be detected, although without the position) or close the map with M or ESC (which both currently can be detected) - all these actions would be firing some of these three events already anyway.