diff --git a/src/p_enemy.c b/src/p_enemy.c index 21b280b2..ffde7229 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -944,6 +944,17 @@ static boolean P_LookForMonsters(mobj_t *actor, boolean allaround) current_actor = actor; current_allaround = allaround; + // There is a bug in cl11+ that causes the player to get added + // to the monster friend list when damaged to below 50% health. + // This causes all monsters to believe friend monsters exist. + // The search algorithm is expensive and massively so on maps with many monsters. + // We still need to match rng calls for demo sync, but PIT_FindTarget is a no op. + if (((mobj_t *) cap->cnext)->player && cap->cnext == cap->cprev) + { + P_Random(pr_friends); + return false; + } + // Search first in the immediate vicinity. if (!P_BlockThingsIterator(x, y, PIT_FindTarget))