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.

However, in MAP23: Barrels o' Fun of Doom 2, the mancubus that fires at the player with barrels in the way kills itself despite the code revision.