UiMap
The UiMap class renders a minimap showing the positions of party member players and player-owned buildings relative to the world dimensions.
UiMap private
Extends UiComponent.
Properties
| Name | Type | Description |
|---|---|---|
ui | Ui | Current Ui instance. Inherited from UiComponent. |
componentElem | HTMLElement | The root #hud-map DOM element. Inherited from UiComponent. |
playerElems | Record<string, { index: number, marker: HTMLElement }> | Map of player UIDs to their marker data (party index + DOM element). |
buildingElems | Record<string, HTMLElement> | Map of building UIDs to their .hud-map-building DOM elements. |
Methods
constructor()
function constructor(ui: Ui): voidInitializes the minimap, registers a renderer tick callback for player position updates, and listens for buildingsUpdate and partyMembersUpdated events.
update()
function update(): voidUpdates player marker positions every frame. For each tracked player, retrieves their network entity, converts world position to a percentage of the map dimensions, and sets the marker's left/top CSS. Hides markers for players whose entities no longer exist.
onBuildingsUpdate()
function onBuildingsUpdate(buildings: Record<string, { x: number, y: number }>): voidSynchronizes building markers with the current buildings data. Creates new .hud-map-building elements for new buildings (positioned as a percentage of world dimensions) and removes elements for buildings that no longer exist.
onPartyMembersUpdate()
function onPartyMembersUpdate(partyMembers: Array<{ playerUid: number }>): voidSynchronizes player markers with the current party members. Creates new .hud-map-player elements with data-index attributes for new members and removes markers for members who have left the party.