WorldMap
constWorldMap:object
Defined in: client/api.d.ts:1375
Client controls for the in-game world map and its GPS waypoint.
Type Declaration
Section titled “Type Declaration”calculateRoute()
Section titled “calculateRoute()”calculateRoute(
startX,startY,startZ,endX,endY,endZ):Vector3[] |null
Computes the road route between two world positions with the same road graph the minimap GPS uses, without touching the player’s own waypoint. Both ends snap to the nearest road, so routes follow the road network and never cut across terrain or through interiors. The route spans at most 128 road segments.
Parameters
Section titled “Parameters”startX
Section titled “startX”number
World-space X coordinate of the route start.
startY
Section titled “startY”number
World-space Y coordinate of the route start.
startZ
Section titled “startZ”number
World-space Z coordinate of the route start.
number
World-space X coordinate of the route destination.
number
World-space Y coordinate of the route destination.
number
World-space Z coordinate of the route destination.
Returns
Section titled “Returns”Vector3[] | null
The route as world-space points, an empty array when no route connects the two positions, or null while the road graph is unavailable (in the menu, or before the city has streamed in).
Example
Section titled “Example”const route = WorldMap.calculateRoute(px, py, pz, tx, ty, tz);if (route && route.length) { // route[0] is on the road nearest the start, route[route.length - 1] nearest the destination.}clearWaypoint()
Section titled “clearWaypoint()”clearWaypoint():
void
Removes the active GPS waypoint and its route.
Returns
Section titled “Returns”void
close()
Section titled “close()”close():
boolean
Closes the in-game world map.
Returns
Section titled “Returns”boolean
True when the close request succeeded.
isOpen()
Section titled “isOpen()”isOpen():
boolean
Checks whether the in-game world map is currently open.
Returns
Section titled “Returns”boolean
True while the map screen is active.
open()
Section titled “open()”open():
boolean
Opens the in-game world map.
Returns
Section titled “Returns”boolean
True when the map was opened successfully.
setWaypoint()
Section titled “setWaypoint()”setWaypoint(
x,y):void
Sets or replaces the local GPS waypoint and computes its route. Routing uses the map’s two-dimensional road graph, so there is no Z coordinate. Placing one this way does not raise a manual placement to the server.
Parameters
Section titled “Parameters”number
World-space X coordinate of the destination.
number
World-space Y coordinate of the destination.
Returns
Section titled “Returns”void
