Skip to main content

World Maps

Reference for world map helpers.

Members

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
The given map can be any object exposing worldX, worldY, widthPx, heightPx and optional tileWidth, tileHeight properties (e.g. your RpgMap instance or a WorldMapInfo).
  • Source: packages/common/src/rooms/WorldMaps.ts
  • Kind: method
  • Defined in: WorldMapsManager

Signature

Parameters

  • map: WorldMapSource
  • search: | { minX: number; minY: number; maxX: number; maxY: number } | { x: number; y: number } | number

Returns

Array of matching adjacent map infos

Examples

getAllMaps

Get all configured maps
  • Source: packages/common/src/rooms/WorldMaps.ts
  • Kind: method
  • Defined in: WorldMapsManager

Signature

Returns

Array of all world maps

getLocalPosition

Calculate local position from world position
  • Source: packages/common/src/rooms/WorldMaps.ts
  • Kind: method
  • Defined in: WorldMapsManager

Signature

Parameters

  • worldX: number
  • worldY: number
  • targetMap: WorldMapInfo

Returns

Local position in the target map

getMapByWorldCoordinates

Find map by world coordinates
  • Source: packages/common/src/rooms/WorldMaps.ts
  • Kind: method
  • Defined in: WorldMapsManager

Signature

Parameters

  • worldX: number
  • worldY: number

Returns

Map found or null

getMapInfo

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 found

Examples

getWorldPosition

Calculate absolute world position of a player
  • Source: packages/common/src/rooms/WorldMaps.ts
  • Kind: method
  • Defined in: WorldMapsManager

Signature

Parameters

  • map: WorldMapInfo
  • localX: number
  • localY: number

Returns

Absolute coordinates in the world

removeMap

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

Returns

True if a map was removed, false otherwise

Examples