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

Function SP_trigger_once

code/game/g_trigger.cpp:503–529  ·  view source on GitHub ↗

QUAKED trigger_once (.5 1 .5) ? PLAYERONLY FACING USE_BUTTON FIRE_BUTTON NPCONLY x x INACTIVE MULTIPLE PLAYERONLY - only a player can trigger this by touch FACING - Won't fire unless triggering ent's view angles are within 45 degrees of trigger's angles (in addition to any other conditions) USE_BUTTON - Won't fire unless player is in it and pressing use button (in addition to any other conditions)

Source from the content-addressed store, hash-verified

501"soundSet" Ambient sound set to play when this trigger is activated
502*/
503void SP_trigger_once( gentity_t *ent )
504{
505 char buffer[MAX_QPATH];
506 char *s;
507 if ( G_SpawnString( "noise", "*NOSOUND*", &s ) )
508 {
509 Q_strncpyz( buffer, s, sizeof(buffer) );
510 COM_DefaultExtension( buffer, sizeof(buffer), ".wav");
511 ent->noise_index = G_SoundIndex(buffer);
512 }
513
514 ent->wait = -1;
515
516 ent->e_TouchFunc = touchF_Touch_Multi;
517 ent->e_UseFunc = useF_Use_Multi;
518
519 if ( ent->team && ent->team[0] )
520 {
521 ent->noDamageTeam = (team_t)GetIDForString( TeamTable, ent->team );
522 ent->team = NULL;
523 }
524
525 ent->delay *= 1000;//1 = 1 msec, 1000 = 1 sec
526
527 InitTrigger( ent );
528 gi.linkentity (ent);
529}
530
531
532/*QUAKED trigger_bidirectional (.1 .5 .1) ? PLAYER_ONLY x x x x x x INACTIVE

Callers

nothing calls this directly

Calls 6

Q_strncpyzFunction · 0.85
G_SpawnStringFunction · 0.70
G_SoundIndexFunction · 0.70
InitTriggerFunction · 0.70
COM_DefaultExtensionFunction · 0.50
GetIDForStringFunction · 0.50

Tested by

no test coverage detected