UiPipOverlay
The UiPipOverlay class renders floating "pip" indicators above entities — resource gain/loss numbers and damage numbers. Pips briefly appear at the entity's screen position and auto-remove after 500ms.
UiPipOverlay private
Extends UiComponent.
Properties
| Name | Type | Description |
|---|---|---|
ui | Ui | Current Ui instance. Inherited from UiComponent. |
componentElem | HTMLElement | The root #hud-pip-overlay DOM element. Inherited from UiComponent. |
resourceGainElems | Record<number, HTMLElement> | Map of IDs to active resource gain pip elements. |
damageElems | Record<number, HTMLElement> | Map of IDs to active damage pip elements. |
lastPlayerTick | object | Cached previous player tick resource values. |
lastPetWoodGain | number | Last pet wood gain, to avoid double-counting. |
lastPetStoneGain | number | Last pet stone gain, to avoid double-counting. |
Methods
constructor()
function constructor(ui: Ui): voidRegisters listeners for playerTickUpdate, playerDidDamage, petDidDamage, petGainedWood, and petGainedStone.
showResourceGain()
function showResourceGain(uid: number, resourceName: string, value: number): voidCreates a floating pip showing the resource gain/loss above the entity. Filters values < 0.5. Auto-removes after 500ms.
showDamage()
function showDamage(uid: number, value: number): voidCreates a floating damage pip above the target entity. Auto-removes after 500ms.
onPlayerTickUpdate()
function onPlayerTickUpdate(playerTick: object): voidComputes resource deltas and shows pips. Excludes pet-attributed wood/stone gains.
onPlayerDidDamage()
function onPlayerDidDamage(playerTick: object): voidShows a damage pip on the player's last damage target.
onPetDidDamage()
function onPetDidDamage(playerTick: object): voidShows a damage pip on the pet's last damage target.
onPetGainedWood()
function onPetGainedWood(petTick: { uid: number, woodGain: number }): voidRecords pet wood gain and shows a pip on the pet.
onPetGainedStone()
function onPetGainedStone(petTick: { uid: number, stoneGain: number }): voidRecords pet stone gain and shows a pip on the pet.