ATTRIB(Player, dual_weapons, vector, this.dual_weapons); // TODO: actually WepSet!
ATTRIB(Player, itemkeys, int, this.itemkeys);
ATTRIB(Player, ballistics_density, float, this.ballistics_density);
+ ATTRIB(Player, prevstrengthsound, float, this.prevstrengthsound);
+ ATTRIB(Player, prevstrengthsoundattempt, float, this.prevstrengthsoundattempt);
INIT(Player) {
this.classname = STR_PLAYER;
}
}
-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)