Example #1
0
/*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE START_OFF SILENT
Pushes the player
"speed"		defaults to 1000
*/
void SP_trigger_push (edict_t *self)
{
	InitTrigger (self);
	windsound = gi.soundindex ("misc/windfly.wav");
	self->touch = trigger_push_touch;
	if (!self->speed)
		self->speed = 1000;

	if (self->targetname)
		self->use = trigger_push_use;
	
	gi.linkentity (self);
}
void ai_trigger_activate( gentity_t *self ) {
	if ( self->r.linked ) {
		return;
	}

	self->use = 0;
	self->AIScript_AlertEntity = 0;

	self->touch = AICast_Touch_Trigger;

	InitTrigger( self );
	trap_LinkEntity( self );
}
Example #3
0
/*
===============
SP_trigger_heal
===============
*/
void SP_trigger_heal(gentity_t * self)
{
	G_SpawnInt("heal", "5", &self->damage);

	self->touch = trigger_heal_touch;
	self->use = trigger_heal_use;

	InitTrigger(self);

	// link in to the world if starting active
	if(!(self->spawnflags & 1))
		trap_LinkEntity(self);
}
Example #4
0
/*QUAKED trigger_concussive_dust (.5 .5 .5) ?
Allows client side prediction of teleportation events.
Must point at a target_position, which will be the teleport destination.
*/
void SP_trigger_concussive_dust(gentity_t * self)
{
	InitTrigger(self);

	// unlike other triggers, we need to send this one to the client
//  self->r.svFlags &= ~SVF_NOCLIENT;
//  self->r.svFlags |= SVF_BROADCAST;

	self->s.eType = ET_CONCUSSIVE_TRIGGER;
	self->touch = trigger_concussive_touch;

	trap_LinkEntity(self);
}
Example #5
0
/*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE
Pushes the player
*/
void SP_trigger_push(  )
{
	if ( !CheckExistence(  ) )
	{
		dremove( self );
		return;
	}
	InitTrigger(  );
	trap_precache_sound( "ambience/windfly.wav" );
	self->s.v.touch = ( func_t ) trigger_push_touch;
	if ( !self->speed )
		self->speed = 1000;
}
Example #6
0
/*QUAKED trigger_push (.5 .5 .5) ?
Must point at a target_position, which will be the apex of the leap.
This will be client side predicted, unlike target_push
*/
void SP_trigger_push( gentity_t *self )
{
    InitTrigger( self );

    // unlike other triggers, we need to send this one to the client
    self->r.svFlags &= ~SVF_NOCLIENT;

    self->s.eType = ET_PUSH_TRIGGER;
    self->touch = trigger_push_touch;
    self->think = AimAtTarget;
    self->nextthink = level.time + FRAMETIME;
    trap_LinkEntity( self );
}
Example #7
0
void SP_trigger_gravity (edict_t *self)
{
	if (st.gravity == 0)
	{
		gi.dprintf(DEVELOPER_MSG_GAME, "trigger_gravity without gravity set at %s\n", vtos(self->s.origin));
		G_FreeEdict  (self);
		return;
	}

	InitTrigger (self);
	self->gravity = atoi(st.gravity);
	self->touch = trigger_gravity_touch;
}
Example #8
0
void
SP_trigger_monsterjump (edict_t * self)
{
  if (!self->speed)
    self->speed = 200;
  if (!st.height)
    st.height = 200;
  if (self->s.angles[YAW] == 0)
    self->s.angles[YAW] = 360;
  InitTrigger (self);
  self->touch = trigger_monsterjump_touch;
  self->movedir[2] = st.height;
}
Example #9
0
void SP_trigger_hurt( edict_t *self )
{
	InitTrigger( self );

	if( self->dmg > 300 ) // HACK: force KILL spawnflag for big damages
		self->spawnflags |= 32;

	if( self->spawnflags & 4 ) // SILENT
	{   
		self->noise_index = 0;
	}
	else if( st.noise )
	{
		self->noise_index = trap_SoundIndex( st.noise );
		G_PureSound( st.noise );
	}
	else if( self->spawnflags & 32 || self->spawnflags & 64 ) // KILL or FALL
	{   
		self->noise_index = trap_SoundIndex( S_PLAYER_FALLDEATH );
	}
	else
	{
		self->noise_index = 0;
	}

	// gameteam field from editor
	if( st.gameteam >= TEAM_SPECTATOR && st.gameteam < GS_MAX_TEAMS )
	{
		self->s.team = st.gameteam;
	}
	else
	{
		self->s.team = TEAM_SPECTATOR;
	}

	self->touch = hurt_touch;

	if( !self->dmg )
		self->dmg = 5;

	if( self->spawnflags & 16 || !self->wait )
		self->wait = 0.1f;

	if( self->spawnflags & 1 )
		self->r.solid = SOLID_NOT;
	else
		self->r.solid = SOLID_TRIGGER;

	if( self->spawnflags & 2 )
		self->use = hurt_use;
}
Example #10
0
void trigger_jumper ( )
{
    if ( CheckExistence ( ) == 0 )
    {
        dremove ( self);
        return;
    }

    InitTrigger ( );
    trap_precache_sound ( "misc/boing.wav");
    self->s.v.touch = ( func_t ) trigger_jumper_touch;
    if ( !self->speed )
        self->speed = 1000;
}
Example #11
0
/*QUAKED trigger_teleport (.5 .5 .5) ?
Allows client side prediction of teleportation events.
Must point at a target_position, which will be the teleport destination.
*/
void SP_trigger_teleport( gentity_t *self ) {
	InitTrigger (self);

	// unlike other triggers, we need to send this one to the client
	self->r.svFlags &= ~SVF_NOCLIENT;

	// make sure the client precaches this sound
	G_SoundIndex("sound/world/jumppad.wav");

	self->s.eType = ET_TELEPORT_TRIGGER;
	self->touch = trigger_teleporter_touch;

	trap_LinkEntity (self);
}
Example #12
0
/*QUAKED trigger_multiple (.1 .5 .1) ? CLIENTONLY FACING USE_BUTTON FIRE_BUTTON NPCONLY x x INACTIVE MULTIPLE
CLIENTONLY - 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)
FIRE_BUTTON - Won't fire unless player/NPC is in it and pressing fire button (in addition to any other conditions)
NPCONLY - only non-player NPCs can trigger this by touch
INACTIVE - Start off, has to be activated to be touchable/usable
MULTIPLE - multiple entities can touch this trigger in a single frame *and* if needed, the trigger can have a wait of > 0

"wait"		Seconds between triggerings, 0 default, number < 0 means one time only.
"random"	wait variance, default is 0
"delay"		how many seconds to wait to fire targets after tripped
"hiderange" As long as NPC's head is in this trigger, NPCs out of this hiderange cannot see him.  If you set an angle on the trigger, they're only hidden from enemies looking in that direction.  the player's crouch viewheight is 36, his standing viewheight is 54.  So a trigger thast should hide you when crouched but not standing should be 48 tall.
"target2"	The trigger will fire this only when the trigger has been activated and subsequently 'cleared'( once any of the conditions on the trigger have not been satisfied).  This will not fire the "target" more than once until the "target2" is fired (trigger field is 'cleared')
"speed"		How many seconds to wait to fire the target2, default is 1
"noise"		Sound to play when the trigger fires (plays at activator's origin)
"NPC_targetname"  Only the NPC with this NPC_targetname fires this trigger

Variable sized repeatable trigger.  Must be targeted at one or more entities.
so, the basic time between firing is a random time between
(wait - random) and (wait + random)

"team" - If set, only this team can trip this trigger
	0 - any
	1 - red
	2 - blue

"soundSet"	Ambient sound set to play when this trigger is activated

usetime		-	If specified (in milliseconds) along with the USE_BUTTON flag, will
				require a client to hold the use key for x amount of ms before firing.

Applicable only during Siege gametype:
teamuser	-	if 1, team 2 can't use this. If 2, team 1 can't use this.
siegetrig	-	if non-0, can only be activated by players carrying a misc_siege_item
				which is associated with this trigger by the item's goaltarget value.
teambalance	-	if non-0, is "owned" by the last team that activated. Can only be activated
				by the other team if the number of players on the other team inside	the
				trigger outnumber the number of players on the owning team inside the
				trigger.
target3		-	fire when activated by team1
target4		-	fire when activated by team2

idealclass	-	Can only be used by this class/these classes. You can specify use by
				multiple classes with the use of |, e.g.:
				"Imperial Medic|Imperial Assassin|Imperial Demolitionist"
*/
void SP_trigger_multiple( gentity_t *ent ) 
{
	char	*s;
	if ( G_SpawnString( "noise", "", &s ) ) 
	{
		if (s && s[0])
		{
			ent->noise_index = G_SoundIndex(s);
		}
		else
		{
			ent->noise_index = 0;
		}
	}

	G_SpawnInt("usetime", "0", &ent->genericValue7);

	//For siege gametype
	G_SpawnInt("siegetrig", "0", &ent->genericValue1);
    G_SpawnInt("teambalance", "0", &ent->genericValue2);

	G_SpawnInt("delay", "0", &ent->delay);

	if ( (ent->wait > 0) && (ent->random >= ent->wait) ) {
		ent->random = ent->wait - FRAMETIME;
		Com_Printf(S_COLOR_YELLOW"trigger_multiple has random >= wait\n");
	}

	ent->delay *= 1000;//1 = 1 msec, 1000 = 1 sec
	if ( !ent->speed && ent->target2 && ent->target2[0] )
	{
		ent->speed = 1000;
	}
	else
	{
		ent->speed *= 1000;
	}

	ent->touch = Touch_Multi;
	ent->use   = Use_Multi;

	if ( ent->team && ent->team[0] )
	{
		ent->alliedTeam = atoi(ent->team);
		ent->team = NULL;
	}

	InitTrigger( ent );
	trap->LinkEntity((sharedEntity_t *)ent);
}
Example #13
0
/*QUAKED trigger_deathCheck (.5 .5 .5) ? - GIBFLAG
GIBFLAG entity will never fire its target(s) if aiName entity was gibbed
aiName entity making alertentity call

this entity will test if aiName is in its volume

Must be targeted at one or more entities.
Once triggered, this entity is destroyed
*/
void SP_trigger_deathCheck( gentity_t *ent ) {
	VectorCopy( ent->s.angles, ent->s.angles2 );

	if ( !( ent->aiName ) ) {
		G_Error( "trigger_once_enabledeath does not have an aiName \n" );
	}

	ent->wait   = -1;           // this will remove itself after one use
	ent->AIScript_AlertEntity = Enable_Trigger_Touch;
	ent->use    = Use_Multi;

	InitTrigger( ent );

	trap_LinkEntity( ent );
}
void CBuyZone::Spawn()
{
	InitTrigger();
	SetTouch( &CBuyZone::BuyZoneTouch );

	// Support for legacy-style teamnums.
	if ( m_LegacyTeamNum == 1 )
	{
		ChangeTeam( TEAM_TERRORIST );
	}
	else if ( m_LegacyTeamNum == 2 )
	{
		ChangeTeam( TEAM_CT );
	}
}
Example #15
0
/*QUAKED trigger_multiple (.5 .5 .5) ?
"wait" : Seconds between triggerings, 0.5 default, -1 = one time only.
"random"	wait variance, default is 0
Variable sized repeatable trigger.  Must be targeted at one or more entities.
so, the basic time between firing is a random time between
(wait - random) and (wait + random)
*/
void SP_trigger_multiple( gentity_t *ent ) {
	G_SpawnFloat( "wait", "0.5", &ent->wait );
	G_SpawnFloat( "random", "0", &ent->random );

	if ( ent->random >= ent->wait && ent->wait >= 0 ) {
		ent->random = ent->wait - FRAMETIME;
		G_Printf( "trigger_multiple has random >= wait\n" );
	}

	ent->touch = Touch_Multi;
	ent->use = Use_Multi;

	InitTrigger( ent );
	trap_LinkEntity (ent);
}
Example #16
0
/*
===============
SP_trigger_ammo
===============
*/
void SP_trigger_ammo( gentity_t *self )
{
    G_SpawnInt( "ammo", "1", &self->damage );

    if( self->damage <= 0 )
    {
        self->damage = 1;
        G_Printf( S_COLOR_YELLOW "WARNING: trigger_ammo with negative ammo key\n" );
    }

    self->touch = trigger_ammo_touch;

    InitTrigger( self );
    trap_LinkEntity( self );
}
Example #17
0
/*QUAKED trigger_teleport (.1 .5 .1) ? SNAP_ANGLES NO_MISSILES NO_NPCS STASIS DEAD_OK x x INACTIVE
Allows client side prediction of teleportation events.
Must point at a target_position, which will be the teleport destination.

SNAP_ANGLES - Make the entity that passes through snap to the target_position's angles
NO_MISSILES - Missiles and thrown objects cannot pass through
NO_NPCS - NPCs cannot pass through
STASIS - will play stasis teleport sound and fx instead of starfleet
DEAD_OK - even if dead, you will teleport
*/
void SP_trigger_teleport( gentity_t *self ) 
{
	InitTrigger (self);

	// unlike other triggers, we need to send this one to the client
	self->svFlags &= ~SVF_NOCLIENT;

	self->s.eType = ET_TELEPORT_TRIGGER;
	self->e_TouchFunc = touchF_trigger_teleporter_touch;

	self->e_ThinkFunc = thinkF_trigger_teleporter_find_closest_portal;
	self->nextthink = level.time + START_TIME_LINK_ENTS;

	gi.linkentity (self);
}
Example #18
0
/*QUAKED trigger_monsterjump (.5 .5 .5) ?
Walking monsters that touch this will jump in the direction of the trigger's angle
"speed" default to 200, the speed thrown forward
"height" default to 200, the speed thrown upwards
*/
void SP_trigger_monsterjump()
{
	if ( !self->speed )
		self->speed = 200;

	if ( !self->height )
		self->height = 200;

	if ( self->s.v.angles[0] == 0 && self->s.v.angles[1] == 0
	     && self->s.v.angles[2] == 0 )
		SetVector( self->s.v.angles, 0, 360, 0 );

	InitTrigger();
	self->s.v.touch = ( func_t ) trigger_monsterjump_touch;
}
Example #19
0
/*QUAKED trigger_push (.5 .5 .5) ?
Must point at a target_position, which will be the apex of the leap.
This will be client side predicted, unlike target_push
*/
void SP_trigger_push( gentity_t *self ) {
	InitTrigger (self);

	// unlike other triggers, we need to send this one to the client
	self->r.svFlags &= ~SVF_NOCLIENT;

	// make sure the client precaches this sound
	G_SoundIndex("sounds/world/jumppad");

	self->s.eType = ET_PUSH_TRIGGER;
	self->touch = trigger_push_touch;
	self->think = AimAtTarget;
	self->nextthink = level.time + FRAMETIME;
	trap_LinkEntity (self);
}
Example #20
0
void SP_trigger_flagonly( gentity_t *ent ) {
	char *scorestring; // JPW NERVE
	ent->touch  = Touch_flagonly;

	InitTrigger( ent );

	// JPW NERVE -- if this trigger has a "score" field set, then completing an objective
	//  inside of this field will add "score" to the right player team.  storing this
	//  in ent->accuracy since that's unused.
	G_SpawnString( "score", "20", &scorestring );
	ent->accuracy = atof( scorestring );
	// jpw

	trap_LinkEntity( ent );
}
Example #21
0
void CTriggerPush::Spawn()
{
	if( pev->angles == g_vecZero )
		pev->angles.y = 360;
	InitTrigger();

	if( pev->speed == 0 )
		pev->speed = 100;

	if( FBitSet( pev->spawnflags, SF_TRIGGER_PUSH_START_OFF ) )// if flagged to Start Turned Off, make trigger nonsolid.
		pev->solid = SOLID_NOT;

	SetUse( &CTriggerPush::ToggleUse );

	UTIL_SetOrigin( pev, pev->origin );		// Link into the list
}
Example #22
0
/*QUAKED trigger_teleport (.5 .5 .5) ? SPECTATOR
Allows client side prediction of teleportation events.
Must point at a target_position, which will be the teleport destination.

If spectator is set, only spectators can use this teleport
Spectator teleporters are not normally placed in the editor, but are created
automatically near doors to allow spectators to move through them
*/
void SP_trigger_teleport(gentity_t *self) {

	InitTrigger(self);
	// unlike other triggers, we need to send this one to the client unless is a spectator trigger
	if (self->spawnflags & 1) {
		self->r.svFlags |= SVF_NOCLIENT;
	} else {
		self->r.svFlags &= ~SVF_NOCLIENT;
	}
	// make sure the client precaches this sound
	G_SoundIndex("sound/world/jumppad.wav");

	self->s.eType = ET_TELEPORT_TRIGGER;
	self->touch = Touch_TeleporterTrigger;

	trap_LinkEntity(self);
}
Example #23
0
/*QUAKED trigger_monsterjump (.5 .5 .5) ?
Walking monsters that touch this will jump in the direction of the trigger's angle
"speed" default to 200, the speed thrown forward
"height" default to 200, the speed thrown upwards
*/
void SP_trigger_monsterjump(  )
{
	if ( !CheckExistence(  ) )
	{
		dremove( self );
		return;
	}
	if ( !self->speed )
		self->speed = 200;

	if ( !self->height )
		self->height = 200;

	if ( VectorCompareF( self->s.v.angles, 0, 0, 0 ) )
		SetVector( self->s.v.angles, 0, 360, 0 );
	InitTrigger(  );
	self->s.v.touch = ( func_t ) trigger_monsterjump_touch;
}
Example #24
0
/*QUAKED trigger_flagonly_multiple (.5 .5 .5) ? RED_FLAG BLUE_FLAG
Player must be carrying the proper flag for it to trigger.
It will call the "death" function in the object's script.

"scriptName"	The object name in the script file

RED_FLAG -- only trigger if player is carrying red flag
BLUE_FLAG -- only trigger if player is carrying blue flag
*/
void SP_trigger_flagonly_multiple( gentity_t *ent ) {
	char *scorestring; // JPW NERVE
	ent->touch	= Touch_flagonly_multiple;

	InitTrigger( ent);

	// JPW NERVE -- if this trigger has a "score" field set, then completing an objective
	//  inside of this field will add "score" to the right player team.  storing this 
	//  in ent->accuracy since that's unused.
	G_SpawnString ("score", "20", &scorestring);
	ent->accuracy = atof (scorestring);
	ent->s.eType = ET_TRIGGER_FLAGONLY_MULTIPLE;
#ifdef VISIBLE_TRIGGERS
	ent->r.svFlags &= ~SVF_NOCLIENT;
#endif // VISIBLE_TRIGGERS

	trap_LinkEntity (ent);
}
void CMOD_Dynamic_Difficulty_Modifier_Trigger::Spawn( void )
{
	BaseClass::Spawn();

	InitTrigger();

	if (m_flWait == 0)
	{
		m_flWait = 0.2;
	}

	m_iTriggerFireCount = 0;
	m_iDifficultyLevelOfMarines = -1;
	m_hMarine = NULL;

	//ASSERTSZ(m_iHealth == 0, "trigger_multiple with health");
	SetTouch( &CMOD_Dynamic_Difficulty_Modifier_Trigger::PositionTouch );
}
Example #26
0
/*QUAKED trigger_multiple (.5 .5 .5) ? notouch
Variable sized repeatable trigger.  Must be targeted at one or more entities.  If "health" is set, the trigger must be killed to activate each time.
If "delay" is set, the trigger waits some time after activating before firing.
"wait" : Seconds between triggerings. (.2 default)
If notouch is set, the trigger is only fired by other entities, not by touching.
NOTOUCH has been obsoleted by trigger_relay!
sounds
1) secret
2) beep beep
3) large switch
4)
set "message" to text string
*/
void SP_trigger_multiple(  )
{
	if ( !CheckExistence(  ) )
	{
		dremove( self );
		return;
	}
	if ( self->s.v.sounds == 1 )
	{
		trap_precache_sound( "misc/secret.wav" );
		self->s.v.noise = "misc/secret.wav";
	} else if ( self->s.v.sounds == 2 )
	{
		trap_precache_sound( "misc/talk.wav" );
		self->s.v.noise = "misc/talk.wav";
	} else if ( self->s.v.sounds == 3 )
	{
		trap_precache_sound( "misc/trigger1.wav" );
		self->s.v.noise = "misc/trigger1.wav";
	}

	if ( !self->wait )
		self->wait = 0.2;
	self->s.v.use = ( func_t ) multi_use;

	InitTrigger(  );

	if ( self->s.v.health )
	{
		if ( ( int ) ( self->s.v.spawnflags ) & SPAWNFLAG_NOTOUCH )
			G_Error( "health and notouch don't make sense\n" );
		self->s.v.max_health = self->s.v.health;
		self->th_die = multi_killed;
		self->s.v.takedamage = DAMAGE_YES;
		self->s.v.solid = SOLID_BBOX;
		setorigin( self, PASSVEC3( self->s.v.origin ) );	// make sure it links into the world
	} else
	{
		if ( !( ( int ) ( self->s.v.spawnflags ) & SPAWNFLAG_NOTOUCH ) )
		{
			self->s.v.touch = ( func_t ) multi_touch;
		}
	}
}
Example #27
0
/*QUAKED trigger_multiple (.1 .5 .1) ? PLAYERONLY FACING USE_BUTTON FIRE_BUTTON NPCONLY LIMITED_PILOT 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)
FIRE_BUTTON - Won't fire unless player/NPC is in it and pressing fire button (in addition to any other conditions)
NPCONLY - only non-player NPCs can trigger this by touch
LIMITED_PILOT - only spawn if there are open pilot slots
INACTIVE - Start off, has to be activated to be touchable/usable
MULTIPLE - multiple entities can touch this trigger in a single frame *and* if needed, the trigger can have a wait of > 0

"wait"		Seconds between triggerings, 0 default, number < 0 means one time only.
"random"	wait variance, default is 0
"delay"		how many seconds to wait to fire targets after tripped
"hiderange" As long as NPC's head is in this trigger, NPCs out of this hiderange cannot see him.  If you set an angle on the trigger, they're only hidden from enemies looking in that direction.  the player's crouch viewheight is 36, his standing viewheight is 54.  So a trigger thast should hide you when crouched but not standing should be 48 tall.
"target2"	The trigger will fire this only when the trigger has been activated and subsequently 'cleared'( once any of the conditions on the trigger have not been satisfied).  This will not fire the "target" more than once until the "target2" is fired (trigger field is 'cleared')
"speed"		How many seconds to wait to fire the target2, default is 1
"noise"		Sound to play when the trigger fires (plays at activator's origin)
"max_pilots"	Number of pilots this spawner will allow

Variable sized repeatable trigger.  Must be targeted at one or more entities.
so, the basic time between firing is a random time between
(wait - random) and (wait + random)

"NPC_targetname" - If set, only an NPC with a matching NPC_targetname will trip this trigger
"team" - If set, only this team can trip this trigger
	player
	enemy
	neutral

"soundSet"	Ambient sound set to play when this trigger is activated
*/
void SP_trigger_multiple( gentity_t *ent ) 
{
	char	buffer[MAX_QPATH];
	char	*s;
	if ( G_SpawnString( "noise", "*NOSOUND*", &s ) ) 
	{
		Q_strncpyz( buffer, s, sizeof(buffer) );
		COM_DefaultExtension( buffer, sizeof(buffer), ".wav");
		ent->noise_index = G_SoundIndex(buffer);
	}
	
	G_SpawnFloat( "wait", "0", &ent->wait );//was 0.5 ... but that means wait can never be zero... we should probably put it back to 0.5, though...
	G_SpawnFloat( "random", "0", &ent->random );
	G_SpawnInt( "max_pilots", "2", &ent->lastInAirTime );


	if ( (ent->wait > 0) && (ent->random >= ent->wait) ) {
		ent->random = ent->wait - FRAMETIME;
		gi.Printf(S_COLOR_YELLOW"trigger_multiple has random >= wait\n");
	}

	ent->delay *= 1000;//1 = 1 msec, 1000 = 1 sec
	if ( !ent->speed && ent->target2 && ent->target2[0] )
	{
		ent->speed = 1000;
	}
	else
	{
		ent->speed *= 1000;
	}

	ent->e_TouchFunc = touchF_Touch_Multi;
	ent->e_UseFunc   = useF_Use_Multi;

	if ( ent->team && ent->team[0] )
	{
		ent->noDamageTeam = (team_t)GetIDForString( TeamTable, ent->team );
		ent->team = NULL;
	}

	InitTrigger( ent );
	gi.linkentity (ent);
}
Example #28
0
void SP_trigger_hurt( gentity_t *self )
{
    InitTrigger( self );

    self->noise_index = G_SoundIndex( "sound/misc/electro.wav" );
    self->touch = hurt_touch;

    if( self->damage <= 0 )
        self->damage = 5;

    self->r.contents = CONTENTS_TRIGGER;

    if( self->spawnflags & 2 )
        self->use = hurt_use;

    // link in to the world if starting active
    if( !( self->spawnflags & 1 ) )
        trap_LinkEntity( self );
}
Example #29
0
/*
===============
SP_trigger_heal
===============
*/
void SP_trigger_heal( gentity_t *self )
{
    G_SpawnInt( "heal", "5", &self->damage );

    if( self->damage <= 0 )
    {
        self->damage = 1;
        G_Printf( S_COLOR_YELLOW "WARNING: trigger_heal with negative damage key\n" );
    }

    self->touch = trigger_heal_touch;
    self->use = trigger_heal_use;

    InitTrigger( self );

    // link in to the world if starting active
    if( !( self->spawnflags & 1 ) )
        trap_LinkEntity( self );
}
Example #30
0
/*QUAKED trigger_hurt (.5 .5 .5) ? START_OFF - SILENT NO_PROTECTION SLOW
Any entity that touches this will be hurt.
It does dmg points of damage each server frame
Targeting the trigger will toggle its on/off state.

SILENT			suppresses playing the sound
SLOW			changes the damage rate to once per second
NO_PROTECTION	*nothing* stops the damage

"dmg"			default 5 (whole numbers only)
*/
void SP_trigger_hurt(gentity_t *self) {

	InitTrigger(self);

	self->noise_index = G_SoundIndex("sound/world/electro.wav");
	self->touch = Touch_HurtTrigger;

	if (!self->damage) {
		self->damage = 5;
	}

	self->use = Use_Trigger_Hurt;
	// link in to the world if starting active
	if (self->spawnflags & 1) {
		trap_UnlinkEntity(self);
	} else {
		trap_LinkEntity(self);
	}
}