Skip to content

Overview

The Simulation class manages all SimObject instances in the game. It provides functions to create, destroy, and track simulation objects.

Members

MembersDescription
mSimObjectsStores all active simulation objects.
mSimObjectsToBeDeletedStores objects queued for deletion.
mSimObjectsToBeDeletedRecursivelyStores objects queued for recursive deletion.
mpLocalPlayerA safe pointer to the local player object.
m_aCurrentDestructingObjectsStores currently destructing objects.

Methods

MethodDescription
InstanceReturns the singleton instance of the Simulation class.
CreateSimObjectCreates a new simulation object with the specified name.
DestroyAllSimObjectsDestroys all active simulation objects.
DestroyQueuedSimObjectsDestroys all simulation objects that have been queued for deletion.
DestroySimComponentDestroys a specific simulation component.
DestroySimObjectDestroys a specific simulation object.
GenerateUniqueNameGenerates a unique name based on the provided root symbol.
GenerateUniqueNameGenerates a unique name based on the provided root string.
GetSimObjectRetrieves a simulation object by its qSymbol name.
GetSimObjectRetrieves a simulation object by its u32 unique identifier.
QueueSimObjectToBeDestroyedQueues a simulation object for deletion.
QueueSimObjectToBeDestroyedRecursiveQueues a simulation object for recursive deletion.
QueueTrackedSimObjectToBeDestroyedQueues a tracked simulation object for deletion.
TrackSimObjectTracks a simulation object.
UntrackSimObjectStops tracking a simulation object and returns whether the untracking was successful.

Instance

const char* Instance();

CreateSimObject

SimObject* CreateSimObject(const qSymbol& name);

DestroyAllSimObjects

void DestroyAllSimObjects();

DestroyQueuedSimObjects

void DestroyQueuedSimObjects();

DestroySimComponent

void DestroySimComponent(SimComponent* component);

DestroySimObject

void DestroySimObject(SimObject* object);

GenerateUniqueName

qSymbol GenerateUniqueName(const qSymbol& root);

GenerateUniqueName

qSymbol GenerateUniqueName(const char* root);

GetSimObject

SimObject* GetSimObject(const qSymbol& name);

GetSimObject

SimObject* GetSimObject(u32 name_uid);

QueueSimObjectToBeDestroyed

void QueueSimObjectToBeDestroyed(SimObject* pSimObj);

QueueSimObjectToBeDestroyedRecursive

void QueueSimObjectToBeDestroyedRecursive(SimObject* pSimObj);

QueueTrackedSimObjectToBeDestroyed

void QueueTrackedSimObjectToBeDestroyed(SimObject* pSimObj);

TrackSimObject

void TrackSimObject(SimObject* pSimObj);

UntrackSimObject

bool UntrackSimObject(SimObject* pSimObj)

Notes

  • This class is primarily used to manage game entities dynamically.
  • It provides an efficient way to handle object creation, tracking, and destruction within a simulated environment.