]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
anti-hitsound spam for electro lightning gun and laser gauntlet
authorFruitieX <rasse@rasse-lappy.localdomain>
Thu, 22 Jul 2010 14:57:26 +0000 (17:57 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Thu, 22 Jul 2010 14:57:26 +0000 (17:57 +0300)
defaultXonotic.cfg
qcsrc/server/g_damage.qc

index 5c76f7df8a867325f7863f0293861bd74d61fa5d..9435497534bf554a6a875a4bcaebaafc61642aa6 100644 (file)
@@ -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)"
 
index 3b4386b57d368ea56859a13ac6a1b82d7e01b776..def4829de5ee1dd62ea87e0e00db87ea8571e0d4 100644 (file)
@@ -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;