From: Mario Date: Thu, 2 Jun 2022 02:28:39 +0000 (+1000) Subject: Adjust the way monsters test their target to make them less likely to drop them and... X-Git-Tag: xonotic-v0.8.5~7^2~1^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b87c91cd1c9e6df890385b0317c65b4a10e1982b;p=xonotic%2Fxonotic-data.pk3dir.git Adjust the way monsters test their target to make them less likely to drop them and find them again immediately, fixes some cases of spammy behaviour --- diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 483f6a1ac..fc1681a91 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -590,20 +590,6 @@ vector Monster_Move_Target(entity this, entity targ) { vector targ_origin = ((this.enemy.absmin + this.enemy.absmax) * 0.5); targ_origin = WarpZone_RefSys_TransformOrigin(this.enemy, this, targ_origin); // origin of target as seen by the monster (us) - WarpZone_TraceLine(this.origin, targ_origin, MOVE_NOMONSTERS, this); - - // cases where the enemy may have changed their state (don't need to check everything here) - if( (IS_DEAD(this.enemy) || GetResource(this.enemy, RES_HEALTH) < 1) - || (STAT(FROZEN, this.enemy)) - || (this.enemy.flags & FL_NOTARGET) - || (this.enemy.alpha < 0.5 && this.enemy.alpha != 0) - || (this.enemy.takedamage == DAMAGE_NO) - || (vdist(this.origin - targ_origin, >, this.target_range)) - || ((trace_fraction < 1) && (trace_ent != this.enemy)) - ) - { - this.enemy = NULL; - } if(this.enemy) { @@ -1202,7 +1188,28 @@ void Monster_Frozen_Think(entity this) void Monster_Enemy_Check(entity this) { if(this.enemy) - return; + { + vector targ_origin = ((this.enemy.absmin + this.enemy.absmax) * 0.5); + targ_origin = WarpZone_RefSys_TransformOrigin(this.enemy, this, targ_origin); // origin of target as seen by the monster (us) + WarpZone_TraceLine(this.origin, targ_origin, MOVE_NOMONSTERS, this); + + // cases where the enemy may have changed their state (don't need to check everything here) + if( (IS_DEAD(this.enemy) || GetResource(this.enemy, RES_HEALTH) < 1) + || (STAT(FROZEN, this.enemy)) + || (this.enemy.flags & FL_NOTARGET) + || (this.enemy.alpha < 0.5 && this.enemy.alpha != 0) + || (this.enemy.takedamage == DAMAGE_NO) + || (vdist(this.origin - targ_origin, >, this.target_range)) + || ((trace_fraction < 1) && (trace_ent != this.enemy)) + ) + { + this.enemy = NULL; + } + else + { + return; + } + } this.enemy = Monster_FindTarget(this); if(this.enemy)