NSEntity: add GetSpawnAge() and GetSpawnTime() methods, which communicate when an instance of an entity was brought into the world.
This commit is contained in:
parent
baadd35ffd
commit
638825af56
2 changed files with 20 additions and 0 deletions
|
@ -51,6 +51,7 @@ what you are doing. Otherwise, you will deal with loss of savegames and much mor
|
|||
class NSEntity:NSTrigger
|
||||
{
|
||||
private:
|
||||
float m_flSpawnTime;
|
||||
bool m_bHidden; /**< decides whether the entity is visible or not, without affecting collision */
|
||||
vector m_vecMins; /**< REAL min bounding box value, without .scale affecting it */
|
||||
vector m_vecMaxs; /**< REAL max bounding box value, without .scale affecting it */
|
||||
|
@ -354,6 +355,12 @@ public:
|
|||
|
||||
/** Returns either true or false depending on if this entity is facing the entity in question. */
|
||||
nonvirtual bool IsFacing(entity);
|
||||
|
||||
/** Returns the time that's passed since the entity has been spawned. */
|
||||
nonvirtual float GetSpawnAge(void);
|
||||
|
||||
/** Returns the absolute timestamp of when the entity had been spawned. */
|
||||
nonvirtual float GetSpawnTime(void);
|
||||
};
|
||||
|
||||
#ifdef CLIENT
|
||||
|
|
|
@ -24,6 +24,7 @@ static void droptofloorwrapper( entity foo ) {
|
|||
|
||||
void NSEntity::NSEntity( void ) {
|
||||
identity = 1;
|
||||
m_flSpawnTime = time;
|
||||
}
|
||||
|
||||
void NSEntity::Spawned( void ) {
|
||||
|
@ -899,6 +900,18 @@ bool NSEntity::IsFacing(entity target)
|
|||
return ((vecDiff * v_forward) > 0 ) ? true : false;
|
||||
}
|
||||
|
||||
float
|
||||
NSEntity::GetSpawnAge(void)
|
||||
{
|
||||
return time - m_flSpawnTime;
|
||||
}
|
||||
|
||||
float
|
||||
NSEntity::GetSpawnTime(void)
|
||||
{
|
||||
return m_flSpawnTime;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
NSEntity_ReadEntity(bool new)
|
||||
|
|
Loading…
Reference in a new issue