scripted_sequence: Call .ReleaseThink() before moving monster within InitIdle()

This commit is contained in:
Marco Cawthorne 2023-09-22 14:37:43 -07:00
parent 4f699aae6e
commit a90296864b
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
1 changed files with 14 additions and 9 deletions

View File

@ -257,18 +257,18 @@ scripted_sequence::RunOnEntity(entity targ)
f.m_iSequenceState = SEQUENCESTATE_ACTIVE; f.m_iSequenceState = SEQUENCESTATE_ACTIVE;
/* seems to be active at all times? contrary to SS_TURNTOFACE existing? */ /* seems to be active at all times? contrary to SS_TURNTOFACE existing? */
f.m_vecSequenceAngle = angles; f.m_vecSequenceAngle = GetAngles();
f.m_iSequenceFlags = spawnflags; f.m_iSequenceFlags = spawnflags;
if (m_iMove == SS_NO) { if (m_iMove == SS_NO) {
NSLog("\tType: SS_NO (%i)", m_iMove); NSLog("\tType: SS_NO (%i)", m_iMove);
} else if (m_iMove == SS_WALK) { } else if (m_iMove == SS_WALK) {
f.RouteToPosition(origin); f.RouteToPosition(GetOrigin());
f.m_flSequenceSpeed = f.GetWalkSpeed(); f.m_flSequenceSpeed = f.GetWalkSpeed();
NSLog("\tType: SS_WALK (%i)", m_iMove); NSLog("\tType: SS_WALK (%i)", m_iMove);
return; return;
} else if (m_iMove == SS_RUN) { } else if (m_iMove == SS_RUN) {
f.RouteToPosition(origin); f.RouteToPosition(GetOrigin());
f.m_flSequenceSpeed = f.GetRunSpeed(); f.m_flSequenceSpeed = f.GetRunSpeed();
NSLog("\tType: SS_RUN (%i)", m_iMove); NSLog("\tType: SS_RUN (%i)", m_iMove);
return; return;
@ -348,7 +348,7 @@ scripted_sequence::InitIdle(void)
{ {
NSMonster f; NSMonster f;
NSLog("^2scripted_sequence::^3InitIdle^7: with spawnflags %d", spawnflags); NSLog("^2scripted_sequence::^3InitIdle^7: with spawnflags %d on %S", spawnflags, m_strMonster);
f = (NSMonster)find(world, ::targetname, m_strMonster); f = (NSMonster)find(world, ::targetname, m_strMonster);
/* target doesn't exist/hasn't spawned */ /* target doesn't exist/hasn't spawned */
@ -369,13 +369,18 @@ scripted_sequence::InitIdle(void)
} }
} }
/* FIXME: does this filter apply to other types as well? */ /* The entity may be configured to reposition itself on ::Respawn...*/
if (m_iMove != SS_NO) f.ReleaseThink();
setorigin(f, origin);
f.m_flSequenceEnd = frameforname(f.modelindex, m_strIdleAnim); /* FIXME: does this filter apply to other types as well? */
if (m_iMove != SS_NO) {
NSLog("^2scripted_sequence::^3InitIdle^7: Moving %S to %v", m_strMonster, GetOrigin());
setorigin(f, GetOrigin());
}
f.m_flSequenceEnd = frameforname(f.GetModelindex(), m_strIdleAnim);
f.m_iSequenceState = SEQUENCESTATE_ENDING; f.m_iSequenceState = SEQUENCESTATE_ENDING;
f.m_vecSequenceAngle = angles; f.m_vecSequenceAngle = GetAngles();
} }
void void