NSClient: add new method Transport(vector newPos, vector newAngles) and null out .customphysics when an NSEntity gets Destroy()d
This commit is contained in:
parent
7f55f1c868
commit
97a5d9d2cd
2 changed files with 19 additions and 0 deletions
|
@ -361,6 +361,8 @@ public:
|
|||
|
||||
/** Returns the absolute timestamp of when the entity had been spawned. */
|
||||
nonvirtual float GetSpawnTime(void);
|
||||
/** Move the entity to a new position, with updated angles. */
|
||||
nonvirtual void Transport(vector, vector);
|
||||
};
|
||||
|
||||
#ifdef CLIENT
|
||||
|
|
|
@ -798,6 +798,7 @@ void NSEntity::OnRemoveEntity( void ) {
|
|||
void NSEntity::Destroy( void ) {
|
||||
removed = 1; /* mark this as cleanly removed */
|
||||
OnRemoveEntity();
|
||||
customphysics = __NULL__;
|
||||
ScheduleThink(Util_Destroy, 0.0f );
|
||||
}
|
||||
|
||||
|
@ -912,6 +913,22 @@ NSEntity::GetSpawnTime(void)
|
|||
return m_flSpawnTime;
|
||||
}
|
||||
|
||||
void
|
||||
NSEntity::Transport(vector new_pos, vector new_ang)
|
||||
{
|
||||
float flSpeed = vlen(this.GetVelocity());
|
||||
makevectors(new_ang);
|
||||
SetVelocity(v_forward * flSpeed);
|
||||
|
||||
SetOrigin(new_pos);
|
||||
SetAngles(new_ang);
|
||||
|
||||
#ifdef SERVER
|
||||
if (flags & FL_CLIENT)
|
||||
Client_FixAngle(this, new_ang);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
NSEntity_ReadEntity(bool new)
|
||||
|
|
Loading…
Reference in a new issue