A function on Player objects to open the map view at a given position
Posted: Sun Jan 27, 2019 12:09 am
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:
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)