// We need to have a dieFunc, otherwise G_Damage won't actually make us die. I could modify G_Damage, but that entails too many changes //----------------------------------------------------------------------------- void WP_ExplosiveDie( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath,int dFlags,int hitLoc ) //----------------------------------------------------------------------------- { self->enemy = attacker; if ( attacker && !attacker->s.number ) { // less damage when shot by player self->splashDamage /= 3; self->splashRadius /= 3; } self->s.eFlags &= ~EF_FIRING; // don't draw beam if we are dead WP_Explode( self ); }
//--------------------------------------------------------- void laserTrapThink( gentity_t *ent ) //--------------------------------------------------------- { gentity_t *traceEnt; vec3_t end, mins = {-4,-4,-4}, maxs = {4,4,4}; trace_t tr; // turn on the beam effect if ( !(ent->s.eFlags & EF_FIRING )) { // arm me G_Sound( ent, G_SoundIndex( "sound/weapons/laser_trap/warning.wav" )); ent->s.loopSound = G_SoundIndex( "sound/weapons/laser_trap/hum_loop.wav" ); ent->s.eFlags |= EF_FIRING; } ent->e_ThinkFunc = thinkF_laserTrapThink; ent->nextthink = level.time + FRAMETIME; // Find the main impact point VectorMA( ent->s.pos.trBase, 2048, ent->movedir, end ); gi.trace( &tr, ent->s.origin2, mins, maxs, end, ent->s.number, MASK_SHOT, G2_RETURNONHIT, 0 ); traceEnt = &g_entities[ tr.entityNum ]; // Adjust this so that the effect has a relatively fresh endpoint VectorCopy( tr.endpos, ent->pos4 ); if ( traceEnt->client || tr.startsolid ) { // go boom WP_Explode( ent ); ent->s.eFlags &= ~EF_FIRING; // don't draw beam if we are dead } else { /* // FIXME: they need to avoid the beam! AddSoundEvent( ent->owner, ent->currentOrigin, ent->splashRadius*2, AEL_DANGER ); AddSightEvent( ent->owner, ent->currentOrigin, ent->splashRadius*2, AEL_DANGER, 50 ); */ } }