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

Function ForceAbsorb

code/game/wp_saber.cpp:12144–12223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12142}
12143
12144void ForceAbsorb( gentity_t *self )
12145{
12146 if ( self->health <= 0 )
12147 {
12148 return;
12149 }
12150
12151 if (self->client->ps.forceAllowDeactivateTime < level.time &&
12152 (self->client->ps.forcePowersActive & (1 << FP_ABSORB)) )
12153 {
12154 WP_ForcePowerStop( self, FP_ABSORB );
12155 return;
12156 }
12157
12158 if ( !WP_ForcePowerUsable( self, FP_ABSORB, 0 ) )
12159 {
12160 return;
12161 }
12162
12163 // Make sure to turn off Force Rage and Force Protection.
12164 if (self->client->ps.forcePowersActive & (1 << FP_RAGE) )
12165 {
12166 WP_ForcePowerStop( self, FP_RAGE );
12167 }
12168
12169 WP_DebounceForceDeactivateTime( self );
12170
12171 WP_ForcePowerStart( self, FP_ABSORB, 0 );
12172
12173 if ( self->client->ps.saberLockTime < level.time )
12174 {
12175 if ( self->client->ps.forcePowerLevel[FP_ABSORB] < FORCE_LEVEL_3 )
12176 {//must animate
12177 int parts = SETANIM_BOTH;
12178 if ( self->client->ps.forcePowerLevel[FP_ABSORB] > FORCE_LEVEL_1 )
12179 {//level 2 only does it on torso (can keep running)
12180 parts = SETANIM_TORSO;
12181 }
12182 else
12183 {
12184 if ( self->client->ps.groundEntityNum != ENTITYNUM_NONE )
12185 {
12186 VectorClear( self->client->ps.velocity );
12187 }
12188 if ( self->NPC )
12189 {
12190 VectorClear( self->client->ps.moveDir );
12191 self->client->ps.speed = 0;
12192 }
12193 //FIXME: what if in air?
12194 }
12195 /*
12196 //if in air, only do on torso - NOTE: or moving?
12197 if ( self->client->ps.groundEntityNum == ENTITYNUM_NONE )//|| !VectorCompare( self->client->ps.velocity, vec3_origin ) )
12198 {
12199 parts = SETANIM_TORSO;
12200 }
12201 */

Callers 6

PM_CheckForceUseButtonFunction · 0.70
ClientCommandFunction · 0.70
ProcessGenericCmdFunction · 0.70
Jedi_CombatDistanceFunction · 0.70
NPC_Jedi_PainFunction · 0.70
WP_CheckForcedPowersFunction · 0.70

Calls 6

VectorClearFunction · 0.85
WP_ForcePowerStopFunction · 0.70
WP_ForcePowerUsableFunction · 0.70
WP_ForcePowerStartFunction · 0.70
NPC_SetAnimFunction · 0.70

Tested by

no test coverage detected