2 void W_GiveWeapon (entity e, float wep)
9 e.weapons |= WepSet_FromWeapon(wep);
15 { Send_Notification(NOTIF_ONE, other, MSG_MULTI, ITEM_WEAPON_GOT, wep); }
20 void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound
22 if((player.items & IT_STRENGTH)
23 && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam
24 || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold)))
26 sound(player, CH_TRIGGER, "weapons/strength_fire.wav", VOL_BASE, ATTEN_NORM);
27 player.prevstrengthsound = time;
29 player.prevstrengthsoundattempt = time;
32 float W_CheckProjectileDamage(entity inflictor, entity projowner, float deathtype, float exception)
34 float is_from_contents = (deathtype == DEATH_SLIME || deathtype == DEATH_LAVA);
35 float is_from_owner = (inflictor == projowner);
36 float is_from_exception = (exception != -1);
38 //dprint(strcat("W_CheckProjectileDamage: from_contents ", ftos(is_from_contents), " : from_owner ", ftos(is_from_owner), " : exception ", strcat(ftos(is_from_exception), " (", ftos(exception), "). \n")));
40 if(autocvar_g_projectiles_damage <= -2)
42 return FALSE; // no damage to projectiles at all, not even with the exceptions
44 else if(autocvar_g_projectiles_damage == -1)
47 return (exception); // if exception is detected, allow it to override
49 return FALSE; // otherwise, no other damage is allowed
51 else if(autocvar_g_projectiles_damage == 0)
54 return (exception); // if exception is detected, allow it to override
55 else if(!is_from_contents)
56 return FALSE; // otherwise, only allow damage from contents
58 else if(autocvar_g_projectiles_damage == 1)
61 return (exception); // if exception is detected, allow it to override
62 else if(!(is_from_contents || is_from_owner))
63 return FALSE; // otherwise, only allow self damage and damage from contents
65 else if(autocvar_g_projectiles_damage == 2) // allow any damage, but override for exceptions
68 return (exception); // if exception is detected, allow it to override
71 return TRUE; // if none of these return, then allow damage anyway.
74 void W_PrepareExplosionByDamage(entity attacker, void() explode)
76 self.takedamage = DAMAGE_NO;
77 self.event_damage = func_null;
79 if(IS_CLIENT(attacker) && !autocvar_g_projectiles_keep_owner)
81 self.owner = attacker;
82 self.realowner = attacker;
85 // do not explode NOW but in the NEXT FRAME!
86 // because recursive calls to RadiusDamage are not allowed
87 self.nextthink = time;