MCPcopy Create free account
hub / github.com/JACoders/OpenJK / NPC_RemoveBody

Function NPC_RemoveBody

code/game/NPC.cpp:205–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205void NPC_RemoveBody( gentity_t *self )
206{
207 self->nextthink = level.time + FRAMETIME/2;
208
209 //run physics at 20fps
210 CorpsePhysics( self );
211
212 if ( self->NPC->nextBStateThink <= level.time )
213 {//run logic at 10 fps
214 if( self->m_iIcarusID != IIcarusInterface::ICARUS_INVALID && !stop_icarus )
215 {
216 IIcarusInterface::GetIcarus()->Update( self->m_iIcarusID );
217 }
218 self->NPC->nextBStateThink = level.time + FRAMETIME;
219
220 if ( !G_OkayToRemoveCorpse( self ) )
221 {
222 return;
223 }
224
225 // I don't consider this a hack, it's creative coding . . .
226 // I agree, very creative... need something like this for ATST and GALAKMECH too!
227 if (self->client->NPC_class == CLASS_MARK1)
228 {
229 Mark1_dying( self );
230 }
231
232 // Since these blow up, remove the bounding box.
233 if ( self->client->NPC_class == CLASS_REMOTE
234 || self->client->NPC_class == CLASS_SENTRY
235 || self->client->NPC_class == CLASS_PROBE
236 || self->client->NPC_class == CLASS_INTERROGATOR
237 || self->client->NPC_class == CLASS_PROBE
238 || self->client->NPC_class == CLASS_MARK2 )
239 {
240 G_FreeEntity( self );
241 return;
242 }
243
244 //FIXME: don't ever inflate back up?
245 self->maxs[2] = self->client->renderInfo.eyePoint[2] - self->currentOrigin[2] + 4;
246 if ( self->maxs[2] < -8 )
247 {
248 self->maxs[2] = -8;
249 }
250
251 if ( (self->NPC->aiFlags&NPCAI_HEAL_ROSH) )
252 {//kothos twins' bodies are never removed
253 return;
254 }
255
256 if ( self->client->NPC_class == CLASS_GALAKMECH )
257 {//never disappears
258 return;
259 }
260
261 if ( self->NPC && self->NPC->timeOfDeath <= level.time )
262 {

Callers

nothing calls this directly

Calls 8

G_OkayToRemoveCorpseFunction · 0.85
DistanceSquaredFunction · 0.85
InFOVFromPlayerViewFunction · 0.85
CorpsePhysicsFunction · 0.70
Mark1_dyingFunction · 0.70
G_FreeEntityFunction · 0.70
NPC_ClearLOSFunction · 0.70
UpdateMethod · 0.45

Tested by

no test coverage detected