World Maps
Reference for world map helpers.Members
- configure
- getAdjacentMaps
- getAllMaps
- getLocalPosition
- getMapByWorldCoordinates
- getMapInfo
- getWorldPosition
- removeMap
configure
Configure the world maps- Source:
packages/common/src/rooms/WorldMaps.ts - Kind:
method - Defined in:
WorldMapsManager
Signature
Parameters
configs:WorldMapConfig[]
Examples
getAdjacentMaps
Find adjacent maps based on various search strategies Supports three search modes:- PositionBox: collect maps intersecting the given box
- Direction: collect maps adjacent in the given direction
- Point: collect the map containing the given world point
map can be any object exposing worldX, worldY, width, height properties
(e.g. your RpgMap instance or a WorldMapInfo).
- Source:
packages/common/src/rooms/WorldMaps.ts - Kind:
method - Defined in:
WorldMapsManager
Signature
Parameters
map:{ worldX: number; worldY: number; widthPx: number; heightPx: number }search:| { minX: number; minY: number; maxX: number; maxY: number } | { x: number; y: number } | number
Returns
Array of matching adjacent map infosExamples
getAllMaps
Get all configured maps- Source:
packages/common/src/rooms/WorldMaps.ts - Kind:
method - Defined in:
WorldMapsManager
Signature
Returns
Array of all world mapsgetLocalPosition
Calculate local position from world position- Source:
packages/common/src/rooms/WorldMaps.ts - Kind:
method - Defined in:
WorldMapsManager
Signature
Parameters
worldX:numberworldY:numbertargetMap:WorldMapInfo
Returns
Local position in the target mapgetMapByWorldCoordinates
Find map by world coordinates- Source:
packages/common/src/rooms/WorldMaps.ts - Kind:
method - Defined in:
WorldMapsManager
Signature
Parameters
worldX:numberworldY:number
Returns
Map found or nullgetMapInfo
Get map information by ID- Source:
packages/common/src/rooms/WorldMaps.ts - Kind:
method - Defined in:
WorldMapsManager
Signature
Parameters
mapId:string
Returns
Map information or null if not foundExamples
getWorldPosition
Calculate absolute world position of a player- Source:
packages/common/src/rooms/WorldMaps.ts - Kind:
method - Defined in:
WorldMapsManager
Signature
Parameters
map:WorldMapInfolocalX:numberlocalY:number
Returns
Absolute coordinates in the worldremoveMap
Remove a map from the world by its id Deletes the map from the internal registry and spatial index.- Source:
packages/common/src/rooms/WorldMaps.ts - Kind:
method - Defined in:
WorldMapsManager
Signature
Parameters
mapId:string