Force an empty 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 `0`. `0` should be save, because that's the default and
and least SV_TestEntityPosition() handles `0` clip masks.

Suggested by @BjossiAlfreds.
This commit is contained in:
Yamagi 2022-02-05 16:49:42 +01:00
parent acf92bdd08
commit 9d827b13da

View file

@ -277,6 +277,10 @@ ThrowHead(edict_t *self, char *gibname, int damage, int type)
self->targetname = NULL;
self->die = gib_die;
// The entity still has the monsters clipmaks.
// Reset it to 0 to be on the save side.
self->clipmask = 0;
if (type == GIB_ORGANIC)
{
self->movetype = MOVETYPE_TOSS;
@ -335,6 +339,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 0 to be on the save side.
self->clipmask = 0;
self->movetype = MOVETYPE_BOUNCE;
VelocityForDamage(damage, vd);
VectorAdd(self->velocity, vd, self->velocity);