Torque2D Reference
Loading...
Searching...
No Matches
Sim Namespace Reference

Functions

 ImplementNamedSet (ActiveActionMapSet) ImplementNamedSet(GhostAlwaysSet) ImplementNamedSet(BehaviorSet) ImplementNamedSet(AchievementSet)
 DeclareNamedSet (ActiveActionMapSet) DeclareNamedSet(GhostAlwaysSet) DeclareNamedSet(BehaviorSet) DeclareNamedSet(AchievementSet) DeclareNamedGroup(ActionMapGroup) DeclareNamedGroup(ClientGroup) DeclareNamedGroup(GuiGroup) DeclareNamedGroup(GuiDataGroup) DeclareNamedGroup(TCPGroup) DeclareNamedGroup(ClientConnectionGroup) DeclareNamedGroup(ChunkFileGroup)
void init ()
void shutdown ()
bool isShuttingDown ()
SimDataBlockGroupgetDataBlockGroup ()
SimGroupgetRootGroup ()
SimObjectfindObject (SimObjectId)
SimObjectfindObject (const char *name)
template<class T>
bool findObject (SimObjectId id, T *&t)
template<class T>
bool findObject (const char *pObjectName, T *&t)
template<class T>
T * findObject (SimObjectId id)
template<class T>
T * findObject (const char *pObjectName)
void advanceToTime (SimTime time)
void advanceTime (SimTime delta)
SimTime getCurrentTime ()
SimTime getTargetTime ()
U32 postEvent (SimObject *, SimEvent *, U32 targetTime)
 a target time of 0 on an event means current event
U32 postEvent (SimObjectId iD, SimEvent *evt, U32 targetTime)
U32 postEvent (const char *objectName, SimEvent *evt, U32 targetTime)
U32 postCurrentEvent (SimObject *obj, SimEvent *evt)
U32 postCurrentEvent (SimObjectId obj, SimEvent *evt)
U32 postCurrentEvent (const char *obj, SimEvent *evt)
void cancelEvent (U32 eventId)
bool isEventPending (U32 eventId)
U32 getEventTimeLeft (U32 eventId)
U32 getTimeSinceStart (U32 eventId)
U32 getScheduleDuration (U32 eventId)
bool saveObject (SimObject *obj, Stream *stream)
SimObjectloadObjectStream (Stream *stream)
bool saveObject (SimObject *obj, const char *filename)
SimObjectloadObjectStream (const char *filename)
void initEventQueue ()
void shutdownEventQueue ()
void cancelPendingEvents (SimObject *obj)
void initRoot ()
void shutdownRoot ()

Variables

SimIdDictionarygIdDictionary
SimTime gCurrentTime
SimTime gTargetTime
void * gEventQueueMutex
SimEventgEventQueue
U32 gEventSequence
SimGroupgRootGroup = NULL
SimManagerNameDictionarygNameDictionary
U32 gNextObjectId
SimDataBlockGroupgDataBlockGroup

Function Documentation

◆ advanceTime()

void advanceTime ( SimTime delta)

◆ advanceToTime()

void advanceToTime ( SimTime time)

◆ cancelEvent()

void cancelEvent ( U32 eventSequence)

cancel a previously scheduled event.

Parameters
eventSequenceThe numeric ID of a previously scheduled event.
Returns
No return value.
See also
getEventTimeLeft, getScheduleDuration, getTimeSinceStart, isEventPending, schedule, obj.schedule

◆ cancelPendingEvents()

void cancelPendingEvents ( SimObject * obj)

◆ DeclareNamedSet()

DeclareNamedSet ( ActiveActionMapSet )

◆ findObject() [1/6]

SimObject * findObject ( const char * name)

◆ findObject() [2/6]

template<class T>
T * findObject ( const char * pObjectName)
inline

◆ findObject() [3/6]

template<class T>
bool findObject ( const char * pObjectName,
T *& t )
inline

◆ findObject() [4/6]

template<class T>
T * findObject ( SimObjectId id)
inline

◆ findObject() [5/6]

template<class T>
bool findObject ( SimObjectId id,
T *& t )
inline

◆ findObject() [6/6]

SimObject * findObject ( SimObjectId id)

◆ getCurrentTime()

U32 getCurrentTime ( )

get the time, in ticks, that has elapsed since the engine started executing.

Returns
the time in ticks since the engine was started.
See also
getRealTime

◆ getDataBlockGroup()

SimDataBlockGroup * getDataBlockGroup ( )

◆ getEventTimeLeft()

U32 getEventTimeLeft ( U32 eventSequence)

determines how much time remains until the event specified by eventID occurs.

Parameters
eventIDThe numeric ID of a previously scheduled event.
Returns
a non-zero integer value equal to the milliseconds until the event specified by eventID will occur. However, if eventID is invalid, or the event has passed, this function will return zero.
See also
cancel, getScheduleDuration, getTimeSinceStart, isEventPending, schedule, SimObject::schedule

◆ getRootGroup()

SimGroup * getRootGroup ( )

◆ getScheduleDuration()

U32 getScheduleDuration ( U32 eventSequence)

Determines how long the event associated with eventID was scheduled for.

Parameters
eventIDThe numeric ID of a previously scheduled event.
Returns
a non-zero integer value equal to the milliseconds used in the schedule call that created this event. However, if eventID is invalid, this function will return zero.
See also
cancel, getEventTimeLeft, getTimeSinceStart, isEventPending, schedule, SimObject::schedule

◆ getTargetTime()

U32 getTargetTime ( )

◆ getTimeSinceStart()

U32 getTimeSinceStart ( U32 eventSequence)

Determines how much time has passed since the event specified by eventID was scheduled.

Parameters
eventIDThe numeric ID of a previously scheduled event.
Returns
a non-zero integer value equal to the milliseconds that have passed since this event was scheduled. However, if eventID is invalid, or the event has passed, this function will return zero.
See also
cancel, getEventTimeLeft, getScheduleDuration, isEventPending, schedule, SimObject::schedule

◆ ImplementNamedSet()

ImplementNamedSet ( ActiveActionMapSet )

◆ init()

void init ( )

◆ initEventQueue()

void initEventQueue ( )

◆ initRoot()

void initRoot ( )

◆ isEventPending()

bool isEventPending ( U32 eventSequence)

see if the event associated with eventID is still pending.

When an event passes, the eventID is removed from the event queue, becoming invalid, so there is no discernable difference between a completed event and a bad event ID.

Parameters
eventIDThe numeric ID of a previously scheduled event.
Returns
true if this event is still outstanding and false if it has passed or eventID is invalid.
See also
cancel, getEventTimeLeft, getScheduleDuration, getTimeSinceStart, schedule, obj.schedule

◆ isShuttingDown()

bool isShuttingDown ( )

True once Sim::shutdown() has begun tearing the root group down. At that point every object is being destroyed in an arbitrary order, so "X was deleted while Y still referenced it" is expected rather than a mistake - diagnostics that would otherwise flag it should stay quiet.

◆ loadObjectStream() [1/2]

SimObject * loadObjectStream ( const char * filename)

◆ loadObjectStream() [2/2]

SimObject * loadObjectStream ( Stream * stream)

◆ postCurrentEvent() [1/3]

U32 postCurrentEvent ( const char * obj,
SimEvent * evt )
inline

◆ postCurrentEvent() [2/3]

U32 postCurrentEvent ( SimObject * obj,
SimEvent * evt )
inline

◆ postCurrentEvent() [3/3]

U32 postCurrentEvent ( SimObjectId obj,
SimEvent * evt )
inline

◆ postEvent() [1/3]

U32 postEvent ( const char * objectName,
SimEvent * evt,
U32 targetTime )
inline

◆ postEvent() [2/3]

U32 postEvent ( SimObject * destObject,
SimEvent * event,
U32 targetTime )

a target time of 0 on an event means current event

◆ postEvent() [3/3]

U32 postEvent ( SimObjectId iD,
SimEvent * evt,
U32 targetTime )
inline

◆ saveObject() [1/2]

bool saveObject ( SimObject * obj,
const char * filename )

◆ saveObject() [2/2]

bool saveObject ( SimObject * obj,
Stream * stream )

◆ shutdown()

void shutdown ( )

◆ shutdownEventQueue()

void shutdownEventQueue ( )

◆ shutdownRoot()

void shutdownRoot ( )

Variable Documentation

◆ gCurrentTime

SimTime gCurrentTime

◆ gDataBlockGroup

SimDataBlockGroup* gDataBlockGroup

◆ gEventQueue

SimEvent* gEventQueue

◆ gEventQueueMutex

void* gEventQueueMutex

◆ gEventSequence

U32 gEventSequence

◆ gIdDictionary

SimIdDictionary * gIdDictionary

◆ gNameDictionary

SimManagerNameDictionary * gNameDictionary

◆ gNextObjectId

U32 gNextObjectId

◆ gRootGroup

SimGroup* gRootGroup = NULL

◆ gTargetTime

SimTime gTargetTime