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

Place to post guides, observations, things related to modding that are not mods themselves.
User avatar
hgschmie
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Tue Feb 06, 2024 5:18 am
Contact:

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

Post 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?
User avatar
hgschmie
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Tue Feb 06, 2024 5:18 am
Contact:

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

Post 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.
Post Reply

Return to “Modding discussion”