// Electrocute whoever's in the water void ToasterElec ( ) { gedict_t *te; self->s.v.effects = 4; sound(self, 1, "weapons/lhit.wav", 1, 1); if ( self->s.v.waterlevel > 0 ) { te = findradius( world, self->s.v.origin, 950 ); while ( te ) { if ( streq( te->s.v.classname, "player" ) && te->s.v.waterlevel > 1 ) { if ( te->radsuit_finished < g_globalvars.time ) { mtf_deathmsg( 7 ); TF_T_Damage( te, self, PROG_TO_EDICT( self->s.v.owner ), 250, 2, 0 ); } } te = findradius( te, self->s.v.origin, 950 ); } dremove( self ); } else { dremove( self ); return; } }
void SP_misc_explobox( ) { float oldz; if ( !CheckExistence( ) ) { dremove( self ); return; } self->s.v.solid = SOLID_BBOX; self->s.v.movetype = MOVETYPE_NONE; trap_precache_model( "maps/b_explob.bsp" ); setmodel( self, "maps/b_explob.bsp" ); setsize( self, 0, 0, 0, 32, 32, 64 ); trap_precache_sound( "weapons/r_exp3.wav" ); self->s.v.health = 20; self->th_die = barrel_explode; self->s.v.takedamage = DAMAGE_AIM; self->s.v.origin[2] += 2; oldz = self->s.v.origin[2]; droptofloor( self ); if ( oldz - self->s.v.origin[2] > 250 ) { G_dprintf( "item fell out of level at '%f %f %f'\n", PASSVEC3( self->s.v.origin ) ); dremove( self ); } }
//========================================================================= // Think function for the timer which checks the distance between the // Engineer and the building he's using void CheckDistance( ) { vec3_t dist; gedict_t *owner, *enemy; owner = PROG_TO_EDICT( self->s.v.owner ); enemy = PROG_TO_EDICT( self->s.v.enemy ); // Check to see if the Engineer's spanner'ed a different building // without leaving the area of this one. if ( owner->building != enemy ) { dremove( self ); return; } VectorSubtract( enemy->s.v.origin, owner->s.v.origin, dist ); if ( vlen( dist ) > 64 ) { CenterPrint( owner, "\n" ); owner->menu_count = MENU_REFRESH_RATE; owner->current_menu = MENU_DEFAULT; owner->building = world; dremove( self ); return; } self->s.v.nextthink = g_globalvars.time + 0.3; }
void Vote_ChangeMap_No() { gedict_t* p; int f1, f2; // withdraw one's vote if(!k_vote || !self->k_voted) return; G_bprint(2, "%s would rather play this map\n",self->s.v.netname); self->k_voted = 0; k_vote--; if(!k_vote) { G_bprint(3, "Voting is closed\n"); p = trap_find(world, FOFS(s.v.classname), "voteguard"); if(p) { p->s.v.classname = ""; dremove(p); } current_vote = -1; return; } f1 = CountPlayers(); f2 = (f1 / 2) + 1; f1 = f2 - k_vote; if(f1 > 1) G_bprint(2, "%d more votes needed\n",f1); else G_bprint(2, "%d more vote needed\n",f1); }
/*QUAKED trigger_teleport (.5 .5 .5) ? PLAYER_ONLY SILENT Any object touching this will be transported to the corresponding info_teleport_destination entity. You must set the "target" field, and create an object with a "targetname" field that matches. If the trigger_teleport has a targetname, it will only teleport entities when it has been fired. */ void SP_trigger_teleport( ) { vec3_t o; if ( !CheckExistence( ) ) { dremove( self ); return; } InitTrigger( ); self->s.v.touch = ( func_t ) teleport_touch; // find the destination if ( !self->s.v.target ) G_Error( "no target" ); self->s.v.use = ( func_t ) teleport_use; if ( !( ( int ) ( self->s.v.spawnflags ) & SILENT ) ) { trap_precache_sound( "ambience/hum1.wav" ); VectorAdd( self->s.v.mins, self->s.v.maxs, o ); VectorScale( o, 0.5, o ); //o = (self.mins + self.maxs)*0.5; trap_ambientsound( PASSVEC3( o ), "ambience/hum1.wav", 0.5, ATTN_STATIC ); } }
void tdeath_touch( ) { // gedict_t *spot; if ( other == PROG_TO_EDICT( self->s.v.owner ) ) return; if ( streq( other->s.v.classname, "player" ) ) { if ( other->invincible_finished > g_globalvars.time ) { self->s.v.classname = "teledeath2"; } if ( strneq( PROG_TO_EDICT( self->s.v.owner )->s.v.classname, "player" ) ) { T_Damage( PROG_TO_EDICT( self->s.v.owner ), self, self, 5000 ); return; } } if ( other->s.v.health ) { T_Damage( other, self, self, 5000 ); } if ( other->s.v.think == ( func_t ) TeamFortress_DetpackExplode ) { other->s.v.solid = SOLID_NOT; other->s.v.nextthink = g_globalvars.time + 1 + g_random( ) * 2; dremove( other->oldenemy ); G_bprint( 1, "%s's detpack was telefragged by %s\n", other->real_owner->s.v.netname, PROG_TO_EDICT( self->s.v.owner )->s.v.netname ); } }
void Laser_Touch( ) { vec3_t org; if ( other == PROG_TO_EDICT( self->s.v.owner ) ) return; // don't explode on owner if ( trap_pointcontents( PASSVEC3( self->s.v.origin ) ) == CONTENT_SKY ) { ent_remove( self ); return; } sound( self, CHAN_WEAPON, "enforcer/enfstop.wav", 1, ATTN_STATIC ); normalize( self->s.v.velocity, org ); VectorScale( org, 8, org ); VectorSubtract( self->s.v.origin, org, org ); //org = self->s.v.origin - 8*normalize(self->s.v.velocity); if ( other->s.v.health ) { SpawnBlood( org, 15 ); TF_T_Damage( other, self, PROG_TO_EDICT( self->s.v.owner ), 15, 0, TF_TD_ELECTRICITY ); } else { TempEffectCount( org, TE_GUNSHOT, 5); } dremove( self ); }
/*QUAKED trigger_secret (.5 .5 .5) ? secret counter trigger sounds 1) secret 2) beep beep 3) 4) set "message" to text string */ void SP_trigger_secret( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } g_globalvars.total_secrets = g_globalvars.total_secrets + 1; self->wait = -1; if ( !self->s.v.message ) self->s.v.message = "You found a secret area!"; if ( !self->s.v.sounds ) self->s.v.sounds = 1; 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"; } SP_trigger_multiple( ); }
void Vote_Elect_No() { gedict_t* p; int f1, needed_votes; // withdraw one's vote if(!k_vote || !self->k_voted) return; G_bprint(2, "%s withdraws his vote\n",self->s.v.netname); self->k_voted = 0; k_vote--; if(!k_vote) { G_bprint(3, "Voting is closed\n"); p = trap_find(world, FOFS(s.v.classname), "voteguard"); if(p) { p->s.v.classname = ""; dremove(p); } current_vote = -1; return; } f1 = CountPlayers(); needed_votes = (int)(f1 * elect_percentage / 100)+1 - k_vote; if(needed_votes > 1) G_bprint(2, "%d more votes needed\n",needed_votes); else G_bprint(2, "%d more vote needed\n",needed_votes); }
/*QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8) This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages. */ void SP_trigger_relay( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } self->s.v.use = ( func_t ) SUB_UseTargets; }
/*QUAKED path_corner (0.5 0.3 0) (-8 -8 -8) (8 8 8) Monsters will continue walking towards the next target corner. */ void SP_path_corner( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } movetarget_f( ); }
/*QUAKED air_bubbles (0 .5 .8) (-8 -8 -8) (8 8 8) testing air bubbles */ void SP_air_bubbles( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } ent_remove( self ); }
/*QUAKED trigger_once (.5 .5 .5) ? notouch Variable sized trigger. Triggers once, then removes itself. You must set the key "target" to the name of another object in the level that has a matching "targetname". If "health" is set, the trigger must be killed to activate. If notouch is set, the trigger is only fired by other entities, not by touching. if "killtarget" is set, any objects that have a matching "target" will be removed when the trigger is fired. if "angle" is set, the trigger will only fire when someone is facing the direction of the angle. Use "360" for an angle of 0. sounds 1) secret 2) beep beep 3) large switch 4) set "message" to text string */ void SP_trigger_once( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } self->wait = -1; SP_trigger_multiple( ); }
void Sentry_Explode( ) { ThrowGib( "progs/tgib1.mdl", -70 ); ThrowGib( "progs/tgib2.mdl", -70 ); ThrowGib( "progs/tgib3.mdl", -70 ); if ( self->real_owner->has_disconnected != 1 ) { tf_data.deathmsg = DMSG_SG_EXPLODION; T_RadiusDamage( self, self->real_owner, 75 + self->s.v.ammo_rockets * 8, self ); } if ( streq( self->s.v.classname, "building_sentrygun_base" ) ) { if ( self->oldenemy ) dremove( self->oldenemy ); } else dremove( self->trigger_field ); TempEffectCoord( self->s.v.origin , TE_EXPLOSION ); BecomeExplosion( ); }
/*QUAKED ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void SP_ambient_comp_hum( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } trap_precache_sound( "ambience/comp1.wav" ); trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/comp1.wav", 1, ATTN_STATIC ); }
/*QUAKED ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void SP_ambient_swamp2( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } trap_precache_sound( "ambience/swamp2.wav" ); trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/swamp2.wav", 0.5, ATTN_STATIC ); }
//========================================================================= // Laserbolt touch function. Just moves through the player and comes out // the other side. void LaserBolt_Touch( ) { vec3_t org; if ( other == PROG_TO_EDICT( self->s.v.owner ) ) return; // don't explode on same person twice if ( other == PROG_TO_EDICT( self->s.v.enemy ) && self->s.v.enemy ) return; if ( trap_pointcontents( PASSVEC3( self->s.v.origin ) ) == CONTENT_SKY ) { dremove( self ); return; } normalize( self->s.v.velocity, org ); VectorScale( org, 8, org ); VectorSubtract( self->s.v.origin, org, org ); if ( other->s.v.health ) { SpawnBlood( org, 15 ); tf_data.deathmsg = DMSG_LASERBOLT; TF_T_Damage( other, self, PROG_TO_EDICT( self->s.v.enemy ), 30, 2, TF_TD_ELECTRICITY ); VectorCopy( self->s.v.oldorigin, self->s.v.velocity ); self->s.v.owner = EDICT_TO_PROG( other ); setmodel( self, "" ); self->s.v.touch = ( func_t ) SUB_Null; self->s.v.nextthink = g_globalvars.time + 0.1; self->s.v.think = ( func_t ) LaserBolt_Think; return; } else { sound( self, 1, "enforcer/enfstop.wav", 1, 1 ); trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY ); trap_WriteByte( MSG_MULTICAST, 11/*TE_SPIKE*/ ); trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[0] ); trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[1] ); trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[2] ); trap_multicast( PASSVEC3( self->s.v.origin ), 1 ); } dremove( self ); }
/*QUAKED trigger_onlyregistered (.5 .5 .5) ? Only fires if playing the registered version, otherwise prints the message */ void SP_trigger_onlyregistered( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } trap_precache_sound( "misc/talk.wav" ); InitTrigger( ); self->s.v.touch = ( func_t ) trigger_onlyregistered_touch; }
/*QUAKED light_globe (0 1 0) (-8 -8 -8) (8 8 8) Sphere globe light. Default light value is 300 Default style is 0 */ void SP_light_globe( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } trap_precache_model( "progs/s_light.spr" ); setmodel( self, "progs/s_light.spr" ); makestatic( self ); }
/*QUAKED light_flame_small_white (0 1 0) (-10 -10 -40) (10 10 40) START_OFF Small white flame ball */ void SP_light_flame_small_white( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } trap_precache_model( "progs/flame2.mdl" ); setmodel( self, "progs/flame2.mdl" ); FireAmbient( ); makestatic( self ); }
void viewthing( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } self->s.v.movetype = MOVETYPE_NONE; self->s.v.solid = SOLID_NOT; trap_precache_model( "progs/player.mdl" ); setmodel( self, "progs/player.mdl" ); }
/*QUAKED trigger_hurt (.5 .5 .5) ? Any object touching this will be hurt set dmg to damage amount defalt dmg = 5 */ void SP_trigger_hurt( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } InitTrigger( ); self->s.v.touch = ( func_t ) hurt_touch; if ( !self->dmg ) self->dmg = 5; }
/*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; }
/*QUAKED func_illusionary (0 .5 .8) ? A simple entity that looks solid but lets you walk through it. */ void SP_func_illusionary( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } SetVector( self->s.v.angles, 0, 0, 0 ); self->s.v.movetype = MOVETYPE_NONE; self->s.v.solid = SOLID_NOT; setmodel( self, self->s.v.model ); makestatic( self ); }
/*QUAKED func_wall (0 .5 .8) ? This is just a solid wall if not inhibitted */ void SP_func_wall( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } SetVector( self->s.v.angles, 0, 0, 0 ); self->s.v.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything self->s.v.solid = SOLID_BSP; self->s.v.use = ( func_t ) func_wall_use; setmodel( self, self->s.v.model ); }
/*QUAKED trigger_counter (.5 .5 .5) ? nomessage Acts as an intermediary for an action that takes multiple inputs. If nomessage is not set, t will print "1 more.. " etc when triggered and "sequence complete" when finished. After the counter has been triggered "count" g_globalvars.times (default 2), it will fire all of it's targets and remove itself. */ void SP_trigger_counter( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } self->wait = -1; if ( !self->count ) self->count = 2; self->s.v.use = ( func_t ) counter_use; }
/*QUAKED light_flame_large_yellow (0 1 0) (-10 -10 -12) (12 12 18) Large yellow flame ball */ void SP_light_flame_large_yellow( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } trap_precache_model( "progs/flame2.mdl" ); setmodel( self, "progs/flame2.mdl" ); self->s.v.frame = 1; FireAmbient( ); makestatic( self ); }
/*QUAKED light_fluorospark (0 1 0) (-8 -8 -8) (8 8 8) Non-displayed light. Default light value is 300 Default style is 10 Makes sparking, broken fluorescent sound */ void SP_light_fluorospark( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } if ( !self->style ) self->style = 10; trap_precache_sound( "ambience/buzz1.wav" ); trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/buzz1.wav", 0.5, ATTN_STATIC ); }
/*QUAKED trap_shooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser Continuously fires spikes. "wait" g_globalvars.time between spike (1.0 default) "nextthink" delay before firing first spike, so multiple shooters can be stagered. */ void SP_trap_shooter( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } SP_trap_spikeshooter( ); if ( self->wait == 0 ) self->wait = 1; self->s.v.nextthink = self->s.v.nextthink + self->wait + self->s.v.ltime; self->s.v.think = ( func_t ) shooter_think; }
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; }