A function on Player objects to open the map view at a given position

Post Reply
beiju
Inserter
Inserter
Posts: 42
Joined: Thu Feb 02, 2017 3:52 pm
Contact:

A function on Player objects to open the map view at a given position

Post by beiju »

I have a few ideas that would benefit from a way to open the map view for a specific player at a specific location. Suggested API:

player.open_map(location, scale)

Location is the coordinates of the position that will be centered in map view
Scale is an optional parameter for the map scale, with the default value being the same scale the player would get if they opened the map normally

Scale isn't really necessary for my uses, so if it's complicated then never mind that part. Some additional parameters could include whether or not to show the zoomed-out view at appropriate zoom levels, or which of the map view overlays to show.

Example uses:
  • Add a command "/find-player <name>" that would open the map view at the named player's location (for watching your friends in multiplayer)
  • Player chooses an item from a list and is shown where the item is produced on the map
  • An improved version of VideoGameGeek's Text Plate Search mod that shows the search result on the map instead of adding a map marker (which the user then has to find)
  • During mod development, automatically snapping the view to the location of something interesting (e.g. a biter attack)

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: A function on Player objects to open the map view at a given position

Post by Bilka »

Okay, added for 0.17.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

beiju
Inserter
Inserter
Posts: 42
Joined: Thu Feb 02, 2017 3:52 pm
Contact:

Re: A function on Player objects to open the map view at a given position

Post by beiju »

Thanks!

Btw, I'm a big fan of the script rendering API. Thanks for that too!

Post Reply

Return to “Implemented mod requests”