From af3756481931b496c0c89d7252803196cc99599b Mon Sep 17 00:00:00 2001 From: iLike80sRock Date: Fri, 1 Mar 2024 00:18:19 -0500 Subject: [PATCH] Fix infighting bug with unspawned monsters --- qc/misc.qc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qc/misc.qc b/qc/misc.qc index 062b6d0..a6c9fbd 100644 --- a/qc/misc.qc +++ b/qc/misc.qc @@ -1303,9 +1303,15 @@ spawnflag 2 = maintain activator, makes it so the player that triggers the infig float INFIGHT_MUTUAL = 1; float INFIGHT_PLAYER_ACTIVATION = 2; +float(entity ent) is_valid_infight_target = +{ + return ent.health > 0 && ent.movetype != MOVETYPE_NONE && ent.solid != SOLID_NOT; +} + void(entity t1, entity t2) make_angry_at = { - if (t2.health > 0 && t1.health > 0) { // checks if targets are alive + if (is_valid_infight_target(t1) && is_valid_infight_target(t2)) + { // checks if targets are alive if (t1.enemy.classname == "player") t1.oldenemy = t1.enemy; t1.enemy = t2;