X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fweapons%2Fcommon.qc;fp=qcsrc%2Fserver%2Fweapons%2Fcommon.qc;h=bcec9df17024ee7d54e207fab58c1438e1afd028;hp=6d163755067def2224a973db9bc311f1dcb60770;hb=fd6ed106134f8d9ec0bd1c15ee687b49418e5de1;hpb=a3f0e2d068109a0fe84d3a037f6f07b065d3347c diff --git a/qcsrc/server/weapons/common.qc b/qcsrc/server/weapons/common.qc index 6d16375506..bcec9df170 100644 --- a/qcsrc/server/weapons/common.qc +++ b/qcsrc/server/weapons/common.qc @@ -20,16 +20,18 @@ void W_GiveWeapon(entity e, int wep) } } -void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound +void W_PlayStrengthSound(entity player) { + entity store = IS_PLAYER(player) ? PS(player) : player; // because non-player entities can fire, but can they have items? TODO + if((player.items & ITEM_Strength.m_itemid) - && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam - || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold))) + && ((time > store.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam + || (time > store.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold))) { sound(player, CH_TRIGGER, SND_STRENGTH_FIRE, VOL_BASE, ATTEN_NORM); - player.prevstrengthsound = time; + store.prevstrengthsound = time; } - player.prevstrengthsoundattempt = time; + store.prevstrengthsoundattempt = time; } float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception)