Skip to content

Profectus / game/layers / addLayer

Function: addLayer() ​

addLayer(layer, player): void

Enables a layer object, so it will be updated every tick. Note that accessing a layer/its properties does NOT require it to be enabled. For dynamic layers you can call this function and removeLayer as necessary. Just make sure data/projEntry.getInitialLayers will provide an accurate list of layers based on the player data object. For static layers just make data/projEntry.getInitialLayers return all the layers.

Parameters ​

layer ​

Layer

The layer to add.

player ​

The player data object, which will have a data object for this layer.

layers ​

Record<string, Record<string, unknown>>

Returns ​

void

Defined in ​

profectus/src/game/layers.tsx:311