Page 1 of 1

[2.0.x] How to set the zoom for a remote view map?

Posted: Fri Nov 08, 2024 2:18 am
by hgschmie
So player.zoom_to_world(position, zoom) is gone and I figured out that I can replace it with
player.set_controller {
type = defines.controllers.remote,
position = entity.position,
surface = entity.surface,
}
all good. But the map opens at a fixed zoom factor. In the old code, I could set the zoom factor (see above). How do I do that in 2.0?

Re: [2.0.x] How to set the zoom for a remote view map?

Posted: Fri Nov 29, 2024 7:09 am
by hgschmie
[answering my own question]

use "player.zoom". Using

Code: Select all

3 * math.exp(-1.05 * zoom_level)
in 0.1 steps from 0 up works really well to match the zoom levels in the GUI.