scripted_sequence & NSMonster: support for spawnflags LEAVECORPSE. Also safely position monsters upon spawning to avoid them getting stuck in the floor.
This commit is contained in:
parent
f5308f6e08
commit
5f7ea594b8
3 changed files with 24 additions and 5 deletions
|
@ -302,7 +302,9 @@ scripted_sequence::RunOnEntity(entity targ)
|
|||
|
||||
f.m_iSequenceState = SEQUENCESTATE_ENDING;
|
||||
|
||||
if (HasSpawnFlags(SSFL_NOSCRIPTMOVE))
|
||||
if (HasSpawnFlags(SSFL_LEAVECORPSE))
|
||||
f.SetThink(NSMonster::FreeStateDead);
|
||||
else if (HasSpawnFlags(SSFL_NOSCRIPTMOVE))
|
||||
f.SetThink(NSMonster::FreeState);
|
||||
else
|
||||
f.SetThink(NSMonster::FreeStateMoved);
|
||||
|
@ -312,7 +314,6 @@ scripted_sequence::RunOnEntity(entity targ)
|
|||
/* make sure we're forgetting about enemies and attack states in sequence */
|
||||
f.m_eEnemy = __NULL__;
|
||||
f.m_iMState = MONSTER_IDLE;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -386,6 +386,8 @@ public:
|
|||
virtual void FreeState(void);
|
||||
/** Internal use only. Called when a sequence is done. */
|
||||
virtual void FreeStateMoved(void);
|
||||
/** Internal use only. Called when a sequence is done and we leave a corpse. */
|
||||
virtual void FreeStateDead(void);
|
||||
/** Internal use only. Called when a movement route is done. */
|
||||
virtual void RouteEnded(void);
|
||||
/** Internal use only. Called every frame to progress through a route. */
|
||||
|
|
|
@ -1177,6 +1177,23 @@ NSMonster::FreeStateMoved(void)
|
|||
FreeState();
|
||||
}
|
||||
|
||||
void
|
||||
NSMonster::FreeStateDead(void)
|
||||
{
|
||||
vector new_origin;
|
||||
|
||||
new_origin = gettaginfo(this, 1);
|
||||
NSMonster_Log("^2%s::^3FreeStateMoved^7: moved to %v", classname, new_origin);
|
||||
SetOrigin(new_origin);
|
||||
DropToFloor();
|
||||
|
||||
RemoveFlags(FL_MONSTER);
|
||||
SetMovetype(MOVETYPE_NONE);
|
||||
SetSolid(SOLID_CORPSE);
|
||||
SetState(MONSTER_DEAD);
|
||||
FreeState();
|
||||
}
|
||||
|
||||
void
|
||||
NSMonster::RouteEnded(void)
|
||||
{
|
||||
|
@ -1681,7 +1698,8 @@ NSMonster::Respawn(void)
|
|||
SetMovetype(MOVETYPE_WALK);
|
||||
SetModel(GetSpawnModel());
|
||||
SetSize(base_mins, base_maxs);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
//SetOrigin();
|
||||
setorigin_safe(this, GetSpawnOrigin());
|
||||
SetEyePos([0, 0, m_flEyeHeight]);
|
||||
|
||||
DropToFloor();
|
||||
|
@ -2060,8 +2078,6 @@ NSMonster::ReceiveEntity(float flNew, float flChanged)
|
|||
setsize(this, mins * scale, maxs * scale);
|
||||
if (flChanged & MONFL_CHANGED_BODY)
|
||||
_UpdateGeomset();
|
||||
|
||||
setorigin(this, origin);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue