// 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 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 ); }
//========================================================================= // 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 ); }
void hurt_touch( ) { gedict_t *te; if ( other->s.v.takedamage ) { if ( !Activated( self, other ) ) { if ( self->else_goal ) { te = Findgoal( self->else_goal ); if ( te ) AttemptToActivate( te, other, self ); } return; } self->s.v.solid = SOLID_NOT; tf_data.deathmsg = DMSG_TRIGGER; TF_T_Damage( other, self, self, self->dmg, 1, 0 ); self->s.v.think = ( func_t ) hurt_on; self->s.v.nextthink = g_globalvars.time + 1; } }
void DestroyBuilding( gedict_t * eng, char *bld ) { gedict_t *te; gedict_t *oldself; float pos; for ( te = world; (te = trap_find( te, FOFS( s.v.classname ), bld )); ) { if ( te->real_owner == eng ) { pos = trap_pointcontents( PASSVEC3( te->s.v.origin ) ); if ( pos == CONTENT_SOLID || pos == CONTENT_SKY ) { oldself = self; self = eng; self->s.v.ammo_cells = self->s.v.ammo_cells + 100; bound_other_ammo( self ); W_SetCurrentAmmo( ); self = oldself; } if ( te->real_owner->building == te ) { if ( !te->real_owner->StatusBarSize ) CenterPrint( te->real_owner, "\n" ); else te->real_owner->StatusRefreshTime = g_globalvars.time + 0.1; te->real_owner->menu_count = MENU_REFRESH_RATE; te->real_owner->current_menu = MENU_DEFAULT; te->real_owner->building = world; } if( tg_data.tg_enabled ) te->has_sentry = 0; TF_T_Damage( te, world, world, 500, 0, 0 ); } } }
void fire_touch( ) { if ( other->s.v.takedamage ) TF_T_Damage( other, self, self, 20, 0, TF_TD_FIRE ); dremove( self ); }
//========================================================================= // EMP Grenade explode function, for when the PRIMETIME runs out void EMPGrenadeExplode( ) { float expsize; gedict_t *te; gedict_t *oldself; trap_WriteByte( MSG_BROADCAST, SVC_TEMPENTITY ); trap_WriteByte( MSG_BROADCAST, TE_TAREXPLOSION ); trap_WriteCoord( MSG_BROADCAST, self->s.v.origin[0] ); trap_WriteCoord( MSG_BROADCAST, self->s.v.origin[1] ); trap_WriteCoord( MSG_BROADCAST, self->s.v.origin[2] ); trap_multicast( PASSVEC3( self->s.v.origin ), 1 ); for ( te = world; (te = findradius( te, self->s.v.origin, 240 )); ) { if ( te->s.v.touch == ( func_t ) ammo_touch || te->s.v.touch == ( func_t ) weapon_touch ) { if ( strneq( te->s.v.classname, "item_spikes" ) ) { te->s.v.solid = SOLID_NOT; te->s.v.enemy = self->s.v.owner; te->s.v.nextthink = g_globalvars.time + 1 + g_random( ) * 2; te->s.v.think = ( func_t ) EMPExplode; } continue; } if ( te->s.v.think == ( func_t ) TeamFortress_DetpackExplode ) { te->s.v.solid = SOLID_NOT; te->s.v.nextthink = g_globalvars.time + 1 + g_random( ) * 2; dremove( te->oldenemy ); continue; } if ( streq( te->s.v.classname, "pipebomb" ) ) { te->s.v.nextthink = g_globalvars.time + 0.1; continue; } // No sentrygun damage in mtf vanilla :( // Clan Edition should have tho.. // - XavioR if ( streq( te->s.v.classname, "building_dispenser" ) /*|| streq( te->s.v.classname, "building_sentrygun" )*/ ) { if ( ! ( ( teamplay & TEAMPLAY_NOEXPLOSIVE ) && te->team_no > 0 && te->team_no == PROG_TO_EDICT( self->s.v.owner )->team_no ) ) TF_T_Damage( te, self, PROG_TO_EDICT( self->s.v.owner ), 200, 0, 4 ); continue; } if ( streq( te->s.v.classname, "ammobox" ) ) { expsize = 0; expsize = expsize + te->s.v.ammo_shells * 0.75; expsize = expsize + te->s.v.ammo_rockets * 0.75 * 2; expsize = expsize + te->s.v.ammo_cells * 0.75 * 2; if ( expsize > 0 ) { te->s.v.solid = SOLID_NOT; tf_data.deathmsg = DMSG_GREN_EMP; T_RadiusDamage( te, PROG_TO_EDICT( self->s.v.owner ), expsize, te ); te->s.v.think = ( func_t ) TeamFortress_AmmoboxRemove;//SUB_Remove; te->s.v.nextthink = g_globalvars.time + 0.1; trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY ); trap_WriteByte( MSG_MULTICAST, TE_EXPLOSION ); trap_WriteCoord( MSG_MULTICAST, te->s.v.origin[0] ); trap_WriteCoord( MSG_MULTICAST, te->s.v.origin[1] ); trap_WriteCoord( MSG_MULTICAST, te->s.v.origin[2] ); trap_multicast( PASSVEC3( te->s.v.origin ), 1 ); } continue; } if ( streq( te->s.v.classname, "player" ) || te->s.v.touch == ( func_t ) BackpackTouch ) { // if ( !( ( teamplay & 16 ) && te->team_no > 0 && te->team_no == PROG_TO_EDICT( self->s.v.owner )->team_no ) ) // { // ^ yeah it's also kinda dumb that in mtf you can emp teammates but wtva.. expsize = 0; expsize = expsize + te->s.v.ammo_shells * 0.75; expsize = expsize + te->s.v.ammo_rockets * 0.75 * 2; if ( te->playerclass != PC_ENGINEER ) expsize = expsize + te->s.v.ammo_cells * 0.75; if ( expsize > 0 ) { tf_data.deathmsg = DMSG_GREN_EMP; T_RadiusDamage( te, PROG_TO_EDICT( self->s.v.owner ), expsize, te ); if ( te->s.v.touch != ( func_t ) BackpackTouch ) { TF_T_Damage( te, self, PROG_TO_EDICT( self->s.v.owner ), expsize, 2, 4 ); te->s.v.ammo_shells = ceil( te->s.v.ammo_shells * 0.25 ); te->s.v.ammo_rockets = ceil( te->s.v.ammo_rockets * 0.25 ); if ( te->playerclass != 9 ) te->s.v.ammo_cells = ceil( te->s.v.ammo_cells * 0.25 ); oldself = self; self = te; W_SetCurrentAmmo( ); self = oldself; } else { te->s.v.think = ( func_t ) SUB_Remove; te->s.v.nextthink = g_globalvars.time + 0.1; } trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY ); trap_WriteByte( MSG_MULTICAST, TE_EXPLOSION ); trap_WriteCoord( MSG_MULTICAST, te->s.v.origin[0] ); trap_WriteCoord( MSG_MULTICAST, te->s.v.origin[1] ); trap_WriteCoord( MSG_MULTICAST, te->s.v.origin[2] ); trap_multicast( PASSVEC3( te->s.v.origin ), 1 ); } // } continue; } } dremove( self ); }