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

Function NPC_RemoveBody

codeJK2/game/NPC.cpp:151–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149#define REMOVE_DISTANCE_SQR (REMOVE_DISTANCE * REMOVE_DISTANCE)
150
151void NPC_RemoveBody( gentity_t *self )
152{
153 CorpsePhysics( self );
154
155 self->nextthink = level.time + FRAMETIME;
156
157 if ( self->NPC->nextBStateThink <= level.time )
158 {
159 if( self->taskManager && !stop_icarus )
160 {
161 self->taskManager->Update( );
162 }
163 }
164 self->NPC->nextBStateThink = level.time + FRAMETIME;
165
166 if ( self->message )
167 {//I still have a key
168 return;
169 }
170
171 // I don't consider this a hack, it's creative coding . . .
172 // I agree, very creative... need something like this for ATST and GALAKMECH too!
173 if (self->client->NPC_class == CLASS_MARK1)
174 {
175 Mark1_dying( self );
176 }
177
178 // Since these blow up, remove the bounding box.
179 if ( self->client->NPC_class == CLASS_REMOTE
180 || self->client->NPC_class == CLASS_SENTRY
181 || self->client->NPC_class == CLASS_PROBE
182 || self->client->NPC_class == CLASS_INTERROGATOR
183 || self->client->NPC_class == CLASS_PROBE
184 || self->client->NPC_class == CLASS_MARK2 )
185 {
186 if ( !self->taskManager || !self->taskManager->IsRunning() )
187 {
188 G_FreeEntity( self );
189 }
190 return;
191 }
192
193 //FIXME: don't ever inflate back up?
194 self->maxs[2] = self->client->renderInfo.eyePoint[2] - self->currentOrigin[2] + 4;
195 if ( self->maxs[2] < -8 )
196 {
197 self->maxs[2] = -8;
198 }
199
200 if ( self->client->NPC_class == CLASS_GALAKMECH )
201 {//never disappears
202 return;
203 }
204 if ( self->NPC && self->NPC->timeOfDeath <= level.time )
205 {
206 self->NPC->timeOfDeath = level.time + 1000;
207 // Only do all of this nonsense for Scav boys ( and girls )
208 /// if ( self->client->playerTeam == TEAM_SCAVENGERS || self->client->playerTeam == TEAM_KLINGON

Callers

nothing calls this directly

Calls 8

DistanceSquaredFunction · 0.85
CorpsePhysicsFunction · 0.70
Mark1_dyingFunction · 0.70
G_FreeEntityFunction · 0.70
InFOVFunction · 0.70
NPC_ClearLOSFunction · 0.70
UpdateMethod · 0.45
IsRunningMethod · 0.45

Tested by

no test coverage detected