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

Function G_CheckCharmed

code/game/NPC_utils.cpp:1524–1551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1522*/
1523extern void G_AddVoiceEvent( gentity_t *self, int event, int speakDebounceTime );
1524void G_CheckCharmed( gentity_t *self )
1525{
1526 if ( self
1527 && self->client
1528 && self->client->playerTeam == TEAM_PLAYER
1529 && self->NPC
1530 && self->NPC->charmedTime
1531 && (self->NPC->charmedTime < level.time ||self->health <= 0) )
1532 {//we were charmed, set us back!
1533 //NOTE: presumptions here...
1534 team_t savTeam = self->client->enemyTeam;
1535 self->client->enemyTeam = self->client->playerTeam;
1536 self->client->playerTeam = savTeam;
1537 self->client->leader = NULL;
1538 self->NPC->charmedTime = 0;
1539 if ( self->health > 0 )
1540 {
1541 if ( self->NPC->tempBehavior == BS_FOLLOW_LEADER )
1542 {
1543 self->NPC->tempBehavior = BS_DEFAULT;
1544 }
1545 G_ClearEnemy( self );
1546 //say something to let player know you've snapped out of it
1547 G_AddVoiceEvent( self, Q_irand(EV_CONFUSE1, EV_CONFUSE3), 2000 );
1548 }
1549 }
1550
1551}
1552
1553void G_GetBoltPosition( gentity_t *self, int boltIndex, vec3_t pos, int modelIndex = 0 )
1554{

Callers 2

player_dieFunction · 0.85
NPC_RunBehaviorFunction · 0.85

Calls 3

Q_irandFunction · 0.85
G_ClearEnemyFunction · 0.70
G_AddVoiceEventFunction · 0.70

Tested by

no test coverage detected