diff --git a/src/shared/NSEntity.h b/src/shared/NSEntity.h index 572f9e8f..2117edc0 100644 --- a/src/shared/NSEntity.h +++ b/src/shared/NSEntity.h @@ -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 diff --git a/src/shared/NSEntity.qc b/src/shared/NSEntity.qc index b6fb226d..65cf0442 100644 --- a/src/shared/NSEntity.qc +++ b/src/shared/NSEntity.qc @@ -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)