Barrel suicide

Because of a bug in the implementation of monster infighting, if some monsters in v1.1 (or earlier) of Doom injured themselves by destroying barrels, they would commit suicide.

The likely cause of this can be seen in the Doom source code. In the  function in  p_inter.c is the following code:

if ( (!target->threshold || target->type == MT_VILE)        && source && source != target         && source->type != MT_VILE) {       // if not intent on another player, // chase after this one target->target = source; target->threshold = BASETHRESHOLD; if (target->state == &states[target->info->spawnstate]           && target->info->seestate != S_NULL) P_SetMobjState (target, target->info->seestate); }

This code is executed when an object is damaged by another object; this includes barrel explosions. The variable  is a reference to the object which caused the damage, while the variable   is a reference to the object on which damage is inflicted. When a barrel is destroyed, any affected enemies are injured with  equal to the player or enemy which caused the explosion.

The above code is supposed to cause monsters to retaliate against players which attack them. However, when a monster injures itself through a barrel explosion, both  and   will reference the monster. It is likely that the code in bold type was not present in version 1.1. As a result, the monster's target (, the object it is currently chasing/attacking) is set to itself. The result is that it attacks itself.

A variation on this bug can still be induced in later versions of Doom, by using DeHackEd to give a non-boss monster an explosive weapon. If the monster is hurt by its own blast radius (e.g. by accidentally firing into an obstacle), it will attack itself.