void Touch_Multi (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) { if(other->client) { if (self->spawnflags & 2) return; } else if (other->svflags & SVF_MONSTER) { if (!(self->spawnflags & 1)) return; } else return; if (!VectorCompare(self->movedir, vec3_origin)) { vec3_t forward; AngleVectors(other->s.angles, forward, NULL, NULL); if (_DotProduct(forward, self->movedir) < 0) return; } self->activator = other; multi_trigger (self); }
void multi_touch( ) { gedict_t *te; if ( !other->s.v.classname ) return; if ( strneq( other->s.v.classname, "player" ) ) return; if ( !Activated( self, other ) ) { if ( self->else_goal ) { te = Findgoal( self->else_goal ); if ( te ) AttemptToActivate( te, other, self ); } return; } if ( !VectorCompareF( self->s.v.movedir, 0, 0, 0 ) ) { trap_makevectors( other->s.v.angles ); if ( DotProduct( g_globalvars.v_forward, self->s.v.movedir ) < 0 ) return; // not facing the right way } self->s.v.enemy = EDICT_TO_PROG( other ); multi_trigger( ); }
//QUAKED trigger_counter (.5 .5 .5) ? NOMESSAGE NOSOUNDS //Acts as an intermediary for an action that takes multiple inputs. Example: a sequence of several buttons to activate a event //-------- KEYS -------- //target : this points to the entity to activate. //targetname : activating trigger points to this. //count : number of actions to count (default 2) //noise_start : sound to play each time a event happens //noise_stop : sound to play at the last event in the count //notsingle : when set to 1, entity will not spawn in Single Player mode //notfree : when set to 1, entity will not spawn in "Free for all" and "Tournament" modes. //notduel : when set to 1, entity will not spawn in "Teamplay" and "CTF" modes. (jaltodo) //notteam : when set to 1, entity will not spawn in "Teamplay" and "CTF" modes. //notctf : when set to 1, entity will not spawn in "Teamplay" and "CTF" modes. (jaltodo) //-------- SPAWNFLAGS -------- //NOMESSAGE : &1 if not set, it will print "1 more.. " etc when triggered and "sequence complete" when finished. //NOSOUNDS : &2 if not set, it will try to play the noise_start and noise_stop sounds //-------- NOTES -------- //Sounds like this one should be a target and not a trigger, but well... static void trigger_counter_use( edict_t *self, edict_t *other, edict_t *activator ) { if( self->count == 0 ) return; self->count--; if( self->count ) { if( !( self->spawnflags & 1 ) ) G_CenterPrintMsg( activator, "%i more to go...", self->count ); if( !( self->spawnflags & 2 ) ) G_Sound( activator, CHAN_AUTO, self->moveinfo.sound_start, ATTN_NORM ); return; } if( !( self->spawnflags & 1 ) ) G_CenterPrintMsg( activator, "Sequence completed!" ); if( !( self->spawnflags & 2 ) ) G_Sound( activator, CHAN_AUTO, self->moveinfo.sound_end, ATTN_NORM ); self->activator = activator; multi_trigger( self ); }
void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace ) { if( !other->client && other->s.eType != ET_BUILDABLE ) return; multi_trigger( self, other ); }
void counter_use() { // char* junk; self->count = self->count - 1; if ( self->count < 0 ) return; if ( self->count != 0 ) { if ( streq( activator->s.v.classname, "player" ) && ( ( int ) ( self->s.v.spawnflags ) & SPAWNFLAG_NOMESSAGE ) == 0 ) { if ( self->count >= 4 ) G_centerprint( activator, "There are more to go..." ); else if ( self->count == 3 ) G_centerprint( activator, "Only 3 more to go..." ); else if ( self->count == 2 ) G_centerprint( activator, "Only 2 more to go..." ); else G_centerprint( activator, "Only 1 more to go..." ); } return; } if ( streq( activator->s.v.classname, "player" ) && ( ( int ) ( self->s.v.spawnflags ) & SPAWNFLAG_NOMESSAGE ) == 0 ) G_centerprint( activator, "Sequence completed!" ); self->s.v.enemy = EDICT_TO_PROG( activator ); multi_trigger(); }
void trigger_counter_use(edict_t *self, edict_t *other, edict_t *activator) { if (self->count == 0) return; self->count--; if (self->count) { if (! (self->spawnflags & 1)) { gi.centerprintf(activator, "%i more to go...", self->count); gi.sound (activator, CHAN_AUTO, gi.soundindex ("misc/talk1.wav"), 1, ATTN_NORM, 0); } return; } if (! (self->spawnflags & 1)) { gi.centerprintf(activator, "Sequence completed!"); gi.sound (activator, CHAN_AUTO, gi.soundindex ("misc/talk1.wav"), 1, ATTN_NORM, 0); } self->activator = activator; multi_trigger (self); }
void Touch_Multi(gentity_t *self, gentity_t *other, trace_t *trace) { if (!other->client) { return; } multi_trigger(self, other); }
void Use_Multi(edict_t *ent, edict_t *other /* unused */, edict_t *activator) { if (!ent || !activator) { return; } ent->activator = activator; multi_trigger(ent); }
void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace ) { if ( !other->client ) { return; } if ( !( self->spawnflags & 1 ) ) { // denotes AI_Touch flag if ( other->aiCharacter ) { return; } } multi_trigger( self, other ); }
void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace ) { if( !other->client ) { return; } if( self->spawnflags & 1 ) { if(other->client->sess.sessionTeam != TEAM_AXIS) { return; } } else if( self->spawnflags & 2 ) { if(other->client->sess.sessionTeam != TEAM_ALLIES) { return; } } if( self->spawnflags & 4 ) { if(other->r.svFlags & SVF_BOT) { return; } } if( self->spawnflags & 8 ) { if(!(other->r.svFlags & SVF_BOT)) { return; } } // START Mad Doc - TDF if (self->spawnflags & 16) { if (!(other->client->sess.playerType == PC_HEAVY)) { return; } } if (self->spawnflags & 128) { if (!(other->client->sess.playerType == PC_ASSAULT)) { return; } } if (self->spawnflags & 256) { if (!(other->client->sess.playerType == PC_RECON)) { return; } } // END Mad Doc - TDF multi_trigger( self, other ); }
static void Touch_Multi( edict_t *self, edict_t *other, cplane_t *plane, int surfFlags ) { if( other->r.client ) { if( self->spawnflags & 2 ) return; } else return; if( self->s.team && self->s.team != other->s.team ) return; self->activator = other; multi_trigger( self ); }
void Use_Multi (edict_t *ent, edict_t *other, edict_t *activator) { //PGM if(ent->spawnflags & TRIGGER_TOGGLE) { if(ent->solid == SOLID_TRIGGER) ent->solid = SOLID_NOT; else ent->solid = SOLID_TRIGGER; gi.linkentity (ent); } else { ent->activator = activator; multi_trigger (ent); } //PGM }
void Touch_Multi(gentity_t *self, gentity_t *other, trace_t *trace) { // Nico, silent GCC (void)trace; if (!other->client) { return; } if (self->spawnflags & 1) { if (other->client->sess.sessionTeam != TEAM_AXIS) { return; } } else if ((self->spawnflags & 2) && other->client->sess.sessionTeam != TEAM_ALLIES) { return; } if (self->spawnflags & 8) { return; } // START Mad Doc - TDF if ((self->spawnflags & 16) && !(other->client->sess.playerType == PC_SOLDIER)) { return; } if ((self->spawnflags & 32) && !(other->client->sess.playerType == PC_FIELDOPS)) { return; } if ((self->spawnflags & 64) && !(other->client->sess.playerType == PC_MEDIC)) { return; } if ((self->spawnflags & 128) && !(other->client->sess.playerType == PC_ENGINEER)) { return; } if ((self->spawnflags & 256) && !(other->client->sess.playerType == PC_COVERTOPS)) { return; } // END Mad Doc - TDF multi_trigger(self, other); }
void multi_touch() { if ( !other->s.v.classname ) return; if ( strneq( other->s.v.classname, "player" ) ) return; // if the trigger has an angles field, check player's facing direction if ( self->s.v.movedir[0] != 0 && self->s.v.movedir[1] != 0 && self->s.v.movedir[2] != 0 ) { makevectors( other->s.v.angles ); if ( DotProduct( g_globalvars.v_forward, self->s.v.movedir ) < 0 ) return; // not facing the right way } self->s.v.enemy = EDICT_TO_PROG( other ); multi_trigger(); }
void Touch_Multi (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) { if(other->client) { if (self->spawnflags & 2) return; } else if (other->svflags & SVF_MONSTER) { if (!(self->spawnflags & 1)) return; } else return; if (!VectorCompare(self->movedir, vec3_origin)) { vec3_t forward; AngleVectors(other->s.angles, forward, NULL, NULL); if (_DotProduct(forward, self->movedir) < 0) return; } //faf: mapper sets "trigger_multiple" or whatever to have an "obj_owner" // of 2 (allies) or 3 (axis). Then only the opposite team can // trigger it. (it's 2 or 3 because if it's set to 0, the usual // number for allied, then it's recognized as not being set at all). if (other->client && other->client->resp.team_on && self->obj_owner) { if (other->client->resp.team_on->index + 2 == (self->obj_owner)) return; } self->activator = other; multi_trigger (self); }
void multi_killed() { self->s.v.enemy = EDICT_TO_PROG( damage_attacker ); multi_trigger(); }
void Use_Multi( gentity_t *ent, gentity_t *other, gentity_t *activator ) { multi_trigger( ent, activator ); }
void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace ) { if( !other->client ) { return; } if ( self->svFlags & SVF_INACTIVE ) {//set by target_deactivate return; } if( self->noDamageTeam ) { if ( other->client->playerTeam != self->noDamageTeam ) { return; } } // moved to just above multi_trigger because up here it just checks if the trigger is not being touched // we want it to check any conditions set on the trigger, if one of those isn't met, the trigger is considered to be "cleared" // if ( self->e_ThinkFunc == thinkF_trigger_cleared_fire ) // {//We're waiting to fire our target2 first // self->nextthink = level.time + self->speed; // return; // } if ( self->spawnflags & 1 ) { if ( other->s.number != 0 ) { return; } } else { if ( self->spawnflags & 16 ) {//NPCONLY if ( other->NPC == NULL ) { return; } } if ( self->NPC_targetname && self->NPC_targetname[0] ) { if ( other->script_targetname && other->script_targetname[0] ) { if ( Q_stricmp( self->NPC_targetname, other->script_targetname ) != 0 ) {//not the right guy to fire me off return; } } else { return; } } } if ( self->spawnflags & 2 ) {//FACING vec3_t forward; if ( other->client ) { AngleVectors( other->client->ps.viewangles, forward, NULL, NULL ); } else { AngleVectors( other->currentAngles, forward, NULL, NULL ); } if ( DotProduct( self->movedir, forward ) < 0.5 ) {//Not Within 45 degrees return; } } if ( self->spawnflags & 4 ) {//USE_BUTTON if ( !other->client ) { return; } if( !( other->client->usercmd.buttons & BUTTON_USE ) ) {//not pressing use button return; } } if ( self->spawnflags & 8 ) {//FIRE_BUTTON if ( !other->client ) { return; } if( !( other->client->ps.eFlags & EF_FIRING /*usercmd.buttons & BUTTON_ATTACK*/ ) && !( other->client->ps.eFlags & EF_ALT_FIRING/*usercmd.buttons & BUTTON_ALT_ATTACK*/ ) ) {//not pressing fire button or altfire button return; } //FIXME: do we care about the sniper rifle or not? if( other->s.number == 0 && ( other->client->ps.weapon > MAX_PLAYER_WEAPONS || other->client->ps.weapon <= WP_NONE ) ) {//don't care about non-player weapons if this is the player return; } } if ( other->client && self->radius ) { vec3_t eyeSpot; //Only works if your head is in it, but we allow leaning out //NOTE: We don't use CalcEntitySpot SPOT_HEAD because we don't want this //to be reliant on the physical model the player uses. VectorCopy(other->currentOrigin, eyeSpot); eyeSpot[2] += other->client->ps.viewheight; if ( G_PointInBounds( eyeSpot, self->absmin, self->absmax ) ) { if( !( other->client->ps.eFlags & EF_FIRING ) && !( other->client->ps.eFlags & EF_ALT_FIRING ) ) {//not attacking, so hiding bonus //FIXME: should really have sound events clear the hiddenDist other->client->hiddenDist = self->radius; //NOTE: movedir HAS to be normalized! if ( VectorLength( self->movedir ) ) {//They can only be hidden from enemies looking in this direction VectorCopy( self->movedir, other->client->hiddenDir ); } else { VectorClear( other->client->hiddenDir ); } } } } if ( self->spawnflags & 4 ) {//USE_BUTTON NPC_SetAnim( other, SETANIM_TORSO, BOTH_BUTTON_HOLD, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); /* if ( !VectorLengthSquared( other->client->ps.velocity ) && !PM_CrouchAnim( other->client->ps.legsAnim ) ) { NPC_SetAnim( other, SETANIM_LEGS, BOTH_BUTTON_HOLD, SETANIM_FLAG_NORMAL|SETANIM_FLAG_HOLD ); } */ //other->client->ps.weaponTime = other->client->ps.torsoAnimTimer; } if ( self->e_ThinkFunc == thinkF_trigger_cleared_fire ) {//We're waiting to fire our target2 first self->nextthink = level.time + self->speed; return; } multi_trigger( self, other ); }
void multi_use() { self->s.v.enemy = EDICT_TO_PROG( activator ); multi_trigger(); }
static void Use_Multi( edict_t *ent, edict_t *other, edict_t *activator ) { ent->activator = activator; multi_trigger( ent ); }
void Use_Multi(gentity_t *ent, gentity_t *other, gentity_t *activator) { // Nico, silent GCC (void)other; multi_trigger(ent, activator); }
void Enable_Trigger_Touch( gentity_t *ent ) { gentity_t *targ; gentity_t *daent; trace_t tr; int mask = MASK_SHOT; int targTemp1, targTemp2; int entTemp1, entTemp2; vec3_t dir, forward, kvel; float angle; qboolean thisone = qfalse; // ent->touch = Touch_Multi; // find the client number that uses this entity targ = AICast_FindEntityForName( ent->aiName ); if ( !targ ) { return; } else { // bail if GIBFLAG and targ has been jibbed if ( targ->health <= GIB_HEALTH && ( ent->spawnflags & 2 ) ) { return; } // need to make the ent solid since it is a trigger entTemp1 = ent->clipmask; entTemp2 = ent->r.contents; ent->clipmask = CONTENTS_SOLID; ent->r.contents = CONTENTS_SOLID; trap_LinkEntity( ent ); // same with targ cause targ is dead targTemp1 = targ->clipmask; targTemp2 = targ->r.contents; targ->clipmask = CONTENTS_SOLID; targ->r.contents = CONTENTS_SOLID; trap_LinkEntity( targ ); trap_Trace( &tr, targ->client->ps.origin, targ->r.mins, targ->r.maxs, targ->client->ps.origin, targ->s.number, mask ); if ( tr.startsolid ) { daent = &g_entities[ tr.entityNum ]; if ( daent == ent ) { // wooo hooo multi_trigger( ent, targ ); thisone = qtrue; } } // ok were done set it contents back ent->clipmask = entTemp1; ent->r.contents = entTemp2; trap_LinkEntity( ent ); targ->clipmask = targTemp1; targ->r.contents = targTemp2; trap_LinkEntity( targ ); if ( ent->s.angles2[YAW] && thisone ) { angle = ent->s.angles2[YAW]; VectorClear( dir ); VectorClear( targ->client->ps.velocity ); dir[YAW] = angle; AngleVectors( dir, forward, NULL, NULL ); VectorScale( forward, 32, kvel ); VectorAdd( targ->client->ps.velocity, kvel, targ->client->ps.velocity ); } } }
void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace ) { if( !other->client ) { return; } if ( self->flags & FL_INACTIVE ) {//set by target_deactivate return; } #ifdef _PHASE1 if (self->spawnflags & 32 && jkg_arearestrictions.integer) { return; // eezstreet: Pande's orders } #endif if( self->alliedTeam ) { if ( other->client->sess.sessionTeam != self->alliedTeam ) { return; } } // moved to just above multi_trigger because up here it just checks if the trigger is not being touched // we want it to check any conditions set on the trigger, if one of those isn't met, the trigger is considered to be "cleared" // if ( self->e_ThinkFunc == thinkF_trigger_cleared_fire ) // {//We're waiting to fire our target2 first // self->nextthink = level.time + self->speed; // return; // } if ( self->spawnflags & 1 ) { if ( other->s.eType == ET_NPC ) { return; } } else { if ( self->spawnflags & 16 ) {//NPCONLY if ( other->NPC == NULL ) { return; } } if ( self->NPC_targetname && self->NPC_targetname[0] ) { if ( other->script_targetname && other->script_targetname[0] ) { if ( Q_stricmp( self->NPC_targetname, other->script_targetname ) != 0 ) {//not the right guy to fire me off return; } } else { return; } } } if ( self->spawnflags & 2 ) {//FACING vec3_t forward; AngleVectors( other->client->ps.viewangles, forward, NULL, NULL ); if ( DotProduct( self->movedir, forward ) < 0.5 ) {//Not Within 45 degrees return; } } if ( self->spawnflags & 4 ) {//USE_BUTTON if( !( other->client->pers.cmd.buttons & BUTTON_USE ) ) {//not pressing use button return; } if ((other->client->ps.weaponTime > 0 && other->client->ps.torsoAnim != BOTH_BUTTON_HOLD && other->client->ps.torsoAnim != BOTH_CONSOLE1) || other->health < 1 || (other->client->ps.pm_flags & PMF_FOLLOW) || other->client->sess.sessionTeam == TEAM_SPECTATOR || other->client->ps.forceHandExtend != HANDEXTEND_NONE) { //player has to be free of other things to use. return; } if (self->genericValue7) { //we have to be holding the use key in this trigger for x milliseconds before firing if (!G_PointInBounds( other->client->ps.origin, self->r.absmin, self->r.absmax )) { return; } else if (other->client->isHacking != self->s.number && other->s.number < MAX_CLIENTS ) { //start the hack other->client->isHacking = self->s.number; VectorCopy(other->client->ps.viewangles, other->client->hackingAngles); other->client->ps.hackingTime = level.time + self->genericValue7; other->client->ps.hackingBaseTime = self->genericValue7; if (other->client->ps.hackingBaseTime > 60000) { //don't allow a bit overflow other->client->ps.hackingTime = level.time + 60000; other->client->ps.hackingBaseTime = 60000; } return; } else if (other->client->ps.hackingTime < level.time) { //finished with the hack, reset the hacking values and let it fall through other->client->isHacking = 0; //can't hack a client other->client->ps.hackingTime = 0; } else { //hack in progress // UQ1: Added this code from below... It would never have gotten there before... if (other->client->ps.torsoAnim != BOTH_BUTTON_HOLD && other->client->ps.torsoAnim != BOTH_CONSOLE1) { G_SetAnim( other, NULL, SETANIM_TORSO, BOTH_BUTTON_HOLD, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); } else { other->client->ps.torsoTimer = 500; } other->client->ps.weaponTime = other->client->ps.torsoTimer; // UQ1: End added... return; } } } if ( self->spawnflags & 8 ) {//FIRE_BUTTON if( !( other->client->pers.cmd.buttons & BUTTON_ATTACK ) ) {//not pressing fire button or altfire button return; } } if ( self->radius ) { vec3_t eyeSpot; //Only works if your head is in it, but we allow leaning out //NOTE: We don't use CalcEntitySpot SPOT_HEAD because we don't want this //to be reliant on the physical model the player uses. VectorCopy(other->client->ps.origin, eyeSpot); eyeSpot[2] += other->client->ps.viewheight; if ( G_PointInBounds( eyeSpot, self->r.absmin, self->r.absmax ) ) { if( !( other->client->pers.cmd.buttons & BUTTON_ATTACK ) ) {//not attacking, so hiding bonus /* //FIXME: should really have sound events clear the hiddenDist other->client->hiddenDist = self->radius; //NOTE: movedir HAS to be normalized! if ( VectorLength( self->movedir ) ) {//They can only be hidden from enemies looking in this direction VectorCopy( self->movedir, other->client->hiddenDir ); } else { VectorClear( other->client->hiddenDir ); } */ //Not using this, at least not yet. } } } if ( self->spawnflags & 4 ) {//USE_BUTTON if (other->client->ps.torsoAnim != BOTH_BUTTON_HOLD && other->client->ps.torsoAnim != BOTH_CONSOLE1) { G_SetAnim( other, NULL, SETANIM_TORSO, BOTH_BUTTON_HOLD, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); } else { other->client->ps.torsoTimer = 500; } other->client->ps.weaponTime = other->client->ps.torsoTimer; } if ( self->think == trigger_cleared_fire ) {//We're waiting to fire our target2 first self->nextthink = level.time + self->speed; return; } multi_trigger( self, other ); }
void Touch_Multi(gentity_t *self, gentity_t *other, trace_t *trace) { if (!other->client) { return; } if (self->spawnflags & MULTI_TRIGGER_AXIS_ONLY) { if (other->client->sess.sessionTeam != TEAM_AXIS) { return; } } else if (self->spawnflags & MULTI_TRIGGER_ALLIED_ONLY) { if (other->client->sess.sessionTeam != TEAM_ALLIES) { return; } } if (self->spawnflags & MULTI_TRIGGER_NOBOT) { if (other->r.svFlags & SVF_BOT) { return; } } if (self->spawnflags & MULTI_TRIGGER_BOTONLY) { if (!(other->r.svFlags & SVF_BOT)) { return; } } if (self->spawnflags & MULTI_TRIGGER_SOLDIERONLY) { if (!(other->client->sess.playerType == PC_SOLDIER)) { return; } } if (self->spawnflags & MULTI_TRIGGER_FIELDOPSONLY) { if (!(other->client->sess.playerType == PC_FIELDOPS)) { return; } } if (self->spawnflags & MULTI_TRIGGER_MEDICONLY) { if (!(other->client->sess.playerType == PC_MEDIC)) { return; } } if (self->spawnflags & MULTI_TRIGGER_ENGINEERONLY) { if (!(other->client->sess.playerType == PC_ENGINEER)) { return; } } if (self->spawnflags & MULTI_TRIGGER_COVERTOPSONLY) { if (!(other->client->sess.playerType == PC_COVERTOPS)) { return; } } // legacy mod only spawnflags if (self->spawnflags & MULTI_TRIGGER_DISGUISEDSONLY) { if (!(other->client->ps.powerups[PW_OPS_DISGUISED])) { return; } } if (self->spawnflags & MULTI_TRIGGER_OBJECTIVEONLY) { if (!(other->client->ps.powerups[PW_BLUEFLAG] || other->client->ps.powerups[PW_REDFLAG])) { return; } } multi_trigger(self, other); }
void Touch_Multi(gentity_t *self, gentity_t *other, trace_t *trace) { if (!other->client) { return; } if (self->spawnflags & 1) { if (other->client->sess.sessionTeam != TEAM_AXIS) { return; } } else if (self->spawnflags & 2) { if (other->client->sess.sessionTeam != TEAM_ALLIES) { return; } } if (self->spawnflags & 4) { if (other->r.svFlags & SVF_BOT) { return; } } if (self->spawnflags & 8) { if (!(other->r.svFlags & SVF_BOT)) { return; } } if (self->spawnflags & 16) { if (!(other->client->sess.playerType == PC_SOLDIER)) { return; } } if (self->spawnflags & 32) { if (!(other->client->sess.playerType == PC_FIELDOPS)) { return; } } if (self->spawnflags & 64) { if (!(other->client->sess.playerType == PC_MEDIC)) { return; } } if (self->spawnflags & 128) { if (!(other->client->sess.playerType == PC_ENGINEER)) { return; } } if (self->spawnflags & 256) { if (!(other->client->sess.playerType == PC_COVERTOPS)) { return; } } multi_trigger(self, other); }