From f97f46f91d39c49d69a2fce45a40cde40f755b01 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sat, 5 Feb 2022 17:14:48 +0100 Subject: [PATCH] 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. --- src/g_misc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/g_misc.c b/src/g_misc.c index d71f370..11eeb3d 100644 --- a/src/g_misc.c +++ b/src/g_misc.c @@ -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);