From 50070b031b1bed8611b28680db41985a01a4ef52 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Thu, 26 May 2022 15:24:08 -0700 Subject: [PATCH] NSMonster: Add MSF_HORDE flag. That marks a monster as constantly being aware and finding the nearest player for attack. --- src/gs-entbase/shared/NSMonster.h | 3 ++- src/gs-entbase/shared/NSMonster.qc | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gs-entbase/shared/NSMonster.h b/src/gs-entbase/shared/NSMonster.h index 56d0c583..611c3cdf 100644 --- a/src/gs-entbase/shared/NSMonster.h +++ b/src/gs-entbase/shared/NSMonster.h @@ -117,7 +117,8 @@ typedef enumflags MSF_PREDISASTER, MSF_FADECORPSE, MSF_MULTIPLAYER, - MSF_FALLING + MSF_FALLING, + MSF_HORDE } monsterFlag_t; /* movement states */ diff --git a/src/gs-entbase/shared/NSMonster.qc b/src/gs-entbase/shared/NSMonster.qc index b9b17ac6..cebeaf76 100644 --- a/src/gs-entbase/shared/NSMonster.qc +++ b/src/gs-entbase/shared/NSMonster.qc @@ -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))