NSMonster: Add MSF_HORDE flag. That marks a monster as constantly being aware and finding the nearest player for attack.

This commit is contained in:
Marco Cawthorne 2022-05-26 15:24:08 -07:00
parent 643211efae
commit 50070b031b
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
2 changed files with 11 additions and 1 deletions

View File

@ -117,7 +117,8 @@ typedef enumflags
MSF_PREDISASTER,
MSF_FADECORPSE,
MSF_MULTIPLAYER,
MSF_FALLING
MSF_FALLING,
MSF_HORDE
} monsterFlag_t;
/* movement states */

View File

@ -180,6 +180,15 @@ NSMonster::SeeThink(void)
m_flSeeTime = time + 0.25f;
/* a horse type monster always knows where the nearest player is */
if (m_iFlags & MSF_HORDE) {
m_eEnemy = Entity_FindClosest(this, "player");
if (m_eEnemy)
NewRoute(m_eEnemy.origin);
return;
}
for (entity w = world; (w = findfloat(w, ::takedamage, DAMAGE_YES));) {
/* prevent them from shooting non-sentient stuff */
if (!(w.flags & FL_MONSTER) && !(w.flags & FL_CLIENT))