From ad1795a11f6bd1c55d7867a564c9e2a9195a20df Mon Sep 17 00:00:00 2001 From: FruitieX Date: Thu, 22 Jul 2010 17:57:26 +0300 Subject: [PATCH] anti-hitsound spam for electro lightning gun and laser gauntlet --- defaultXonotic.cfg | 2 ++ qcsrc/server/g_damage.qc | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 5c76f7df8..943549753 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -298,6 +298,8 @@ set sv_ready_restart 0 "if set to 1 allow a map to be restarted once all players set sv_ready_restart_after_countdown 0 "if set to 1 the players and map items are reset after the countdown ended, otherwise they're reset already at the beginning of the countdown" set sv_ready_restart_repeatable 0 "allows the players to restart the game as often as needed" +sv_hitsound_antispam_time 0.05 "don't play the hitsound more often than this for the electro lightning gun or the laser gauntlet" + //nifreks lockonrestart feature, used in team-based game modes, if set to 1 and all players readied up no other player can then join the game anymore, useful to block spectators from joining set teamplay_lockonrestart 0 "it set to 1 in a team-based game, the teams are locked once all players readied up and the game restarted (no new players can join after restart unless using the server-command unlockteams)" diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 3b4386b57..def4829de 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -463,6 +463,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) entity damage_targ; entity damage_inflictor; entity damage_attacker; +.float prevhitsound; void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) { @@ -725,10 +726,14 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float { if(damage > 0) { - if(targ.BUTTON_CHAT) - attacker.typehitsound += 1; - else - attacker.hitsound += 1; + if(attacker.weapon != WEP_ELECTRO && attacker.weapon != WEP_LASER || ((attacker.weapon == WEP_ELECTRO && cvar("g_balance_electro_lightning") || attacker.weapon == WEP_LASER) && attacker.prevhitsound + cvar("sv_hitsound_antispam_time") < time)) + { + if(targ.BUTTON_CHAT) + attacker.typehitsound += 1; + else + attacker.hitsound += 1; + attacker.prevhitsound = time; + } damage_goodhits += 1; damage_gooddamage += damage; -- 2.39.2