]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/common.qc
Disable reloading when weapon use is forbidden (fixes reload spam while frozen)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / common.qc
index 936b954cad252d2308bde9a2c0fe433d0ab3d451..6e54cb0601a89df25175edb1a90fa1c44af6cd74 100644 (file)
@@ -6,7 +6,7 @@ void W_GiveWeapon (entity e, float wep)
        if (!wep)
                return;
 
-       WEPSET_OR_EW(e, wep);
+       e.weapons |= WepSet_FromWeapon(wep);
 
        oldself = self;
        self = e;
@@ -17,6 +17,18 @@ void W_GiveWeapon (entity e, float wep)
        self = oldself;
 }
 
+void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound
+{
+       if((player.items & IT_STRENGTH)
+               && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam
+               || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold)))
+               {
+                       sound(player, CH_TRIGGER, "weapons/strength_fire.wav", VOL_BASE, ATTEN_NORM);
+                       player.prevstrengthsound = time;
+               }
+               player.prevstrengthsoundattempt = time;
+}
+
 float W_CheckProjectileDamage(entity inflictor, entity projowner, float deathtype, float exception)
 {
        float is_from_contents = (deathtype == DEATH_SLIME || deathtype == DEATH_LAVA);
@@ -40,14 +52,14 @@ float W_CheckProjectileDamage(entity inflictor, entity projowner, float deathtyp
        {
                if(is_from_exception)
                        return (exception); // if exception is detected, allow it to override
-               else if not(is_from_contents)
+               else if(!is_from_contents)
                        return FALSE; // otherwise, only allow damage from contents
        }       
        else if(autocvar_g_projectiles_damage == 1)
        {
                if(is_from_exception)
                        return (exception); // if exception is detected, allow it to override
-               else if not(is_from_contents || is_from_owner)
+               else if(!(is_from_contents || is_from_owner))
                        return FALSE; // otherwise, only allow self damage and damage from contents
        }
        else if(autocvar_g_projectiles_damage == 2) // allow any damage, but override for exceptions