Force an MASK_SHOT clip mask for thrown heads.

The ThrowHead() and ThrowClientHead() functions are special. They
transform the entity given in `self` (mostly the caller itself) into a
ripped off head. They don't reset the entities clip mask, which may
cause problems in interactions with other entities. Fix that by reseting
the clip mask to `MASK_SHOT`.

Suggested by @BjossiAlfreds.
This commit is contained in:
Yamagi 2022-02-05 17:14:48 +01:00
parent dfd2224bbf
commit f97f46f91d

View file

@ -261,6 +261,10 @@ ThrowHead(edict_t *self, char *gibname, int damage, int type)
self->takedamage = DAMAGE_YES;
self->die = gib_die;
// The entity still has the monsters clipmaks.
// Reset it to MASK_SHOT to be on the save side.
self->clipmask = MASK_SHOT;
if (type == GIB_ORGANIC)
{
self->movetype = MOVETYPE_TOSS;
@ -442,6 +446,10 @@ ThrowClientHead(edict_t *self, int damage)
self->s.sound = 0;
self->flags |= FL_NO_KNOCKBACK;
// The entity still has the monsters clipmaks.
// Reset it to MASK_SHOT to be on the save side.
self->clipmask = MASK_SHOT;
self->movetype = MOVETYPE_BOUNCE;
VelocityForDamage(damage, vd);
VectorAdd(self->velocity, vd, self->velocity);