CMapSpawner

Overview

ACMapSpawner is the main actor to place in a level for minimap generation. It inherits from ACAbstractSpawner and implements ICMapData. It reads its configuration from a DataTable row (FCMapMakerStruct), instantiates UCMapMaker and drives the build loop on tick.

Properties

Name Description
mapMakerRH FDataTableRowHandle pointing to a FCMapMakerStruct row (RowType = CMapStruct)
mapMaker Transient reference to the instantiated UCMapMaker

Lifecycle

Name Description
init Reads the DataTable row, validates data, instantiates UCMapMaker
Tick Calls mapMaker->buildASync when room is built and actor is ready. Stops ticking once the map is built
clean Destroys the map maker and its resources
storeSpawnerSingleton Registers this spawner as CNAME_Singleton_MapSpawner
// ACMapSpawner is placed in the level.
// Configure mapMakerRH to point to a DataTable row of type FCMapMakerStruct.

// init() is called by the spawner system (ACAbstractSpawner).
// It reads the row and instantiates UCMapMaker:
FCMapMakerStruct* data = getRowFromRH<FCMapMakerStruct>(mapMakerRH);
UCMapMaker::instantiate(GetRootComponent(), mapMaker, stream, *data);

// On Tick, the spawner waits for room data and actor readiness,
// then delegates to the map maker:
if (IsValid(mapMaker) && RoomUtility::roomBuilt() && ActorUtility::actorReady()) {
    if (!mapMaker->built) {
        mapMaker->buildASync(this);
    } else {
        SetActorTickEnabled(false);
    }
}