Returns the int index of this unit. A missing or stale association is a critical error. Can be configured by the user to supply a custom unit indexer which won’t break other stdlib components, as long as it keeps firing onUnitIndex and onUnitDeindex: UnitSpatialIndex, for one, registers units only through them.
public function shouldIndex(unit _u) returns booleanDeclaration shown above.
Configurable. Override it in your map’s config package.
public function unit.peekIndex() returns intRead-only lifecycle/diagnostic observation. Zero means no association exists. Never allocates or dispatches; normal consumers require getIndex instead.
Configurable. Override it in your map’s config package.
public function unit.isIndexCurrent(int expectedIndex) returns booleanValidates deferred work captured while indexed. Absence means the old lifetime ended, rather than requesting a replacement identity for the unit. Never allocates.
public function unit.getIndex() returns intDeclaration shown above.
Configurable. Override it in your map’s config package.
public function unit.toUnitIndex() returns UnitIndexReturns the existing UnitIndex. Lookup never creates an index or fires onUnitIndex.
Configurable. Override it in your map’s config package.
public function getIndexingUnit() returns unitReturns the currently indexing unit. That’s the last indexed unit or the one about to be deindexed.
public function onUnitDeindex(code func)Adds a function to be called before a unit is deindexed. Use the getIndexingUnit() function to refer to the deindexing unit.
public function onUnitIndex(code func)Adds a function to be called after a unit is indexed. Use the getIndexingUnit() function to refer to the indexed unit.
public function unit.deindex() returns boolDeindexes a unit. Returns false if the unit is unindexed or a deindex hook is already releasing it.