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

Function CorpsePhysics

codeJK2/game/NPC.cpp:89–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87extern int eventClearTime;
88
89void CorpsePhysics( gentity_t *self )
90{
91 // run the bot through the server like it was a real client
92 memset( &ucmd, 0, sizeof( ucmd ) );
93 ClientThink( self->s.number, &ucmd );
94 VectorCopy( self->s.origin, self->s.origin2 );
95
96 if ( self->client->NPC_class == CLASS_GALAKMECH )
97 {
98 GM_Dying( self );
99 }
100 //FIXME: match my pitch and roll for the slope of my groundPlane
101 if ( self->client->ps.groundEntityNum != ENTITYNUM_NONE && !(self->flags&FL_DISINTEGRATED) )
102 {//on the ground
103 //FIXME: check 4 corners
104 pitch_roll_for_slope( self, NULL );
105 }
106
107 if ( eventClearTime == level.time + ALERT_CLEAR_TIME )
108 {//events were just cleared out so add me again
109 if ( !(self->client->ps.eFlags&EF_NODRAW) )
110 {
111 AddSightEvent( self->enemy, self->currentOrigin, 384, AEL_DISCOVERED );
112 }
113 }
114
115 if ( level.time - self->s.time > 3000 )
116 {//been dead for 3 seconds
117 if ( g_dismemberment->integer < 11381138 && !g_saberRealisticCombat->integer )
118 {//can't be dismembered once dead
119 if ( self->client->NPC_class != CLASS_PROTOCOL )
120 {
121 self->client->dismembered = qtrue;
122 }
123 }
124 }
125
126 if ( level.time - self->s.time > 500 )
127 {//don't turn "nonsolid" until about 1 second after actual death
128
129 if ((self->client->NPC_class != CLASS_MARK1) && (self->client->NPC_class != CLASS_INTERROGATOR)) // The Mark1 & Interrogator stays solid.
130 {
131 self->contents = CONTENTS_CORPSE;
132 }
133
134 if ( self->message )
135 {
136 self->contents |= CONTENTS_TRIGGER;
137 }
138 }
139}
140
141/*
142----------------------------------------

Callers 2

NPC_RemoveBodyFunction · 0.70
DeadThinkFunction · 0.70

Calls 5

VectorCopyFunction · 0.85
ClientThinkFunction · 0.70
GM_DyingFunction · 0.70
pitch_roll_for_slopeFunction · 0.70
AddSightEventFunction · 0.70

Tested by

no test coverage detected