Skip to content

Commit

Permalink
Merge pull request #15 from jjelliott/jjelliott/issue8
Browse files Browse the repository at this point in the history
Fix infighting bug with unspawned monsters
  • Loading branch information
dumptruckDS committed Mar 1, 2024
2 parents 55960e8 + af37564 commit edcb098
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion qc/misc.qc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit edcb098

Please sign in to comment.