hex-world
    Preparing search index...

    Interface HexWorldEventMap

    Everything HexWorld.events can emit. Chunk streaming and unit events are re-emitted verbatim from ChunkManager.events and (once HexWorld.trackUnits is wired) UnitManager.events, so one subscription point covers the whole world.

    interface HexWorldEventMap {
        chunkLoaded: ChunkEvent;
        chunkUnloaded: ChunkEvent;
        unitAdded: { unit: HexUnit; object3D: Object3D };
        unitRemoved: { unit: HexUnit; object3D: Object3D };
        unitMoveStart: UnitEvent;
        unitCellEnter: UnitEvent;
        unitArrived: UnitEvent;
        unitMoveEnd: UnitEvent & { completed: boolean };
        unitEmbark: UnitEvent;
        unitDisembark: UnitEvent;
        frame: { dt: number };
        cellHover: { cell: CellRef | null; previous: CellRef | null };
        cellEnter: CellRef;
        cellLeave: CellRef;
        cellClick: CellPointerEvent;
        cellPointerDown: CellPointerEvent;
        mapChanged: { map: HexMap };
    }

    Hierarchy (View Summary)

    Index

    Properties

    chunkLoaded: ChunkEvent

    A chunk's meshes are in the scene and renderable. Fires from the same place for synchronous and worker builds, so chunkWorker: true doesn't change when (relative to the geometry existing) consumers hear about it — only how many frames later. Use it to place props, spawn decorations, or drive a "world loading" indicator.

    chunkUnloaded: ChunkEvent

    A chunk's meshes have been removed from the scene and disposed — because it streamed out of range, or because dispose() / setMap() tore everything down. Anything you parented to that chunk's region should go now.

    unitAdded: { unit: HexUnit; object3D: Object3D }

    A unit was registered and its Object3D added to the scene.

    unitRemoved: { unit: HexUnit; object3D: Object3D }

    A unit was removed from the scene and its fog contribution withdrawn.

    unitMoveStart: UnitEvent

    A unit began following a new path. col/row are where it set off from.

    unitCellEnter: UnitEvent

    A unit crossed into a new cell mid-path. Fires after the fog reveal for that cell, so a listener reading fogData sees the post-move visibility.

    unitArrived: UnitEvent

    A unit reached the end of its path. The event most turn logic wants: unlike unitMoveEnd it does not fire for an interrupted move.

    unitMoveEnd: UnitEvent & { completed: boolean }

    A unit stopped moving, whether it finished the path (completed: true) or HexUnit.stop cut it short. Pair with animation state.

    unitEmbark: UnitEvent

    A unit stepped from land onto a liquid cell. Only units given an isLiquid predicate report this. Fires before unitCellEnter.

    unitDisembark: UnitEvent

    A unit stepped from a liquid cell onto land. Fires before unitCellEnter.

    frame: { dt: number }

    Once per rendered frame, after chunks, picking, and the overlay layers have updated and before the draw call. The multi-subscriber form of HexWorld.onFrame, which still fires first.

    cellHover: { cell: CellRef | null; previous: CellRef | null }

    The cell under the pointer changed — including to and from null when the cursor leaves the map. One subscription that always knows what's under the cursor; use it for a status readout or a hover highlight that has to clear.

    cellEnter: CellRef

    The pointer moved onto this cell. Paired with cellLeave.

    cellLeave: CellRef

    The pointer moved off this cell. Fires before the matching cellEnter.

    cellClick: CellPointerEvent

    A press and release on the same cell without dragging past HexWorldOptions.clickTolerance. Fires for every button, so a right-click that isn't a camera pan reads as the cancel gesture it is.

    cellPointerDown: CellPointerEvent

    A button went down over a cell. Fires synchronously from the DOM handler, so pointer.preventDefault() still works — the hook for consuming an input before the camera controller acts on it.

    mapChanged: { map: HexMap }

    HexWorld.setMap swapped the map. Chunk events for the new map follow.