GameMap¶
The pause menu's map. server.map is everyone's (players
joining later get it too); player.map is one player's.
Client scripts have their own, apart: sagl.map.
Ids are 1-32 characters. Colours are 0xRRGGBBAA or "#RRGGBB[AA]".
setMarker(id, options)¶
Adds a marker, or moves the one with that id.
| Parameter | Type | Description |
|---|---|---|
id |
string |
Its id. |
options.x, options.y |
number |
Where, in world coordinates. |
options.icon |
number |
The game's radar sprite, 1-63. 0 or left out: a diamond in color. |
options.color |
MapColor |
For the diamond. |
options.label |
string |
Shown beside it (up to 48 characters). |
Throws RangeError for a bad id.
server.map.setMarker("bank", { x: 1462, y: -1012, icon: 52, label: "Bank" });
player.map.setMarker("target", { x: 2000, y: -1500, color: "#ff3030", label: "Target" });
removeMarker(id)¶
setOverlay(id, options)¶
Puts an image over a world rectangle (custom terrain, a floor plan), or replaces the one with that id.
| Parameter | Type | Description |
|---|---|---|
id |
string |
Its id. |
options.x1, y1, x2, y2 |
number |
Two opposite corners, in world coordinates. |
options.file |
string |
A client file, PNG or JPEG (cached by players). |
options.image |
Buffer | string |
Or the image's bytes, or a path on the server (sent each time). |
options.opacity |
number |
0-1, default 1. |
options.layer |
number |
Higher draws on top. Default 0. |
Throws Error if file isn't a client file; TypeError with neither
file nor image.
server.map.setOverlay("airport", {
x1: 1400, y1: -2700, x2: 2200, y2: -2200,
file: "maps/airport.png", opacity: 0.8,
});
removeOverlay(id)¶
setWorld(visible, background?)¶
Shows or hides the game's own map under the markers and overlays.
| Parameter | Type | Description |
|---|---|---|
visible |
boolean |
false hides it. |
background |
MapColor |
What shows instead. Default black. |