Merge pull request #706 from BjossiAlfreds/shark-bbox

Shark bbox fix and added check for inuse after entity thinking
This commit is contained in:
Yamagi 2021-04-27 08:59:53 +02:00 committed by GitHub
commit 4cacd4a0c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View file

@ -924,6 +924,12 @@ SV_Physics_Toss(edict_t *ent)
/* regular thinking */
SV_RunThink(ent);
/* entities are very often freed during thinking */
if (!ent->inuse)
{
return;
}
/* if not a team captain, so movement
will be handled elsewhere */
if (ent->flags & FL_TEAMSLAVE)

View file

@ -356,13 +356,24 @@ flipper_pain(edict_t *self, edict_t *other /* unused */,
void
flipper_dead(edict_t *self)
{
vec3_t p;
trace_t tr;
if (!self)
{
return;
}
VectorSet(self->mins, -16, -16, -24);
VectorSet(self->maxs, 16, 16, -8);
/* original dead bbox was wrong - and make sure the bbox adjustment stays in solidity */
p[0] = self->s.origin[0];
p[1] = self->s.origin[1];
p[2] = self->s.origin[2] - 8;
tr = gi.trace(self->s.origin, self->mins, self->maxs, p, self, self->clipmask);
self->mins[2] = tr.endpos[2] - self->s.origin[2];
self->movetype = MOVETYPE_TOSS;
self->svflags |= SVF_DEADMONSTER;
self->nextthink = 0;