I've been trying to get a train-like "follow vehicle" display, except using the chart view (where you can zoom in and out, switch to chart_zoomed_in, and perform other actions like selecting alternative vehicles, etc
Currently I was doing the following, but this revealed the following problem (bug?): "player closed follow view" doesn't ever trigger! Since you queue up a "render_mode" change, you always overwrite player actions, and this leaves the game in a UI-locked state (ESC, M, etc don't work, since they all cancel the map view, and this brings it back... you cannot even open the menu) And trying to scroll out/in doesn't work for the same reason (chart to chart_zoomed_in render_mode is overwritten before I can read that its changed)
So I've found no alternatives so far, and UI-locking feels like a bug
Code: Select all
if player.render_mode == defines.render_mode.game then
-- Player closed follow view
global.follow_vehicle[player.index] = nil
elseif player.render_mode == defines.render_mode.chart then
-- Minimap view, stay in the same view + zoom level
player.open_map(vehicle.position)
elseif player.render_mode == defines.render_mode.chart_zoomed_in then
-- Minimap-Enhanced mode, stay in the same view + zoom level
player.zoom_to_world(vehicle.position)
end