]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix bug with helpme notification (spamming the radar ping)
authorSamual Lenks <samual@xonotic.org>
Sat, 22 Sep 2012 20:56:59 +0000 (16:56 -0400)
committerSamual Lenks <samual@xonotic.org>
Sat, 22 Sep 2012 20:56:59 +0000 (16:56 -0400)
gamemodes.cfg
qcsrc/server/autocvars.qh
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/gamemode_ctf.qh

index 53b6e3f914f83329b7d6f75b008f117f534bf91a..6cff7e5a42666ab32954c8ec8d5abb757b1a09f6 100644 (file)
@@ -178,7 +178,8 @@ set g_ctf_flag_return_time 15
 set g_ctf_flag_return_dropped 100
 set g_ctf_flag_return_damage 0
 set g_ctf_flag_return_when_unreachable 1 "automatically return the flag if it falls into lava/slime/trigger hurt"
-set g_ctf_flagcarrier_auto_helpme_when_damaged 100
+set g_ctf_flagcarrier_auto_helpme_damage 100 "automatically place a helpme notification on flag carrier waypointsprite if they get hit and their health dips below this value"
+set g_ctf_flagcarrier_auto_helpme_time 2 "antispam time for the helpme notification"
 set g_ctf_flagcarrier_selfdamagefactor 1
 set g_ctf_flagcarrier_selfforcefactor 1
 set g_ctf_flagcarrier_damagefactor 1
index 00a257acdd767a9caf6c7f9b64ef7d3c35bf47a3..16a7193c13710903da8cd9ed2db5143802504508 100644 (file)
@@ -803,7 +803,8 @@ float autocvar_g_ctf_flag_return_time;
 float autocvar_g_ctf_flag_return_when_unreachable;
 float autocvar_g_ctf_flag_return_damage;
 float autocvar_g_ctf_flag_return_dropped;
-float autocvar_g_ctf_flagcarrier_auto_helpme_when_damaged;
+float autocvar_g_ctf_flagcarrier_auto_helpme_damage;
+float autocvar_g_ctf_flagcarrier_auto_helpme_time;
 float autocvar_g_ctf_flagcarrier_selfdamagefactor;
 float autocvar_g_ctf_flagcarrier_selfforcefactor;
 float autocvar_g_ctf_flagcarrier_damagefactor;
index 5233aa635c8679f7cba7d6e895dad0e52284e523..f453cc22ad727ea81b78f276ff3958aed207bde2 100644 (file)
@@ -1756,8 +1756,12 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerDamage) // for changing damage and force values t
        }
        else if(frag_target.flagcarried && (frag_target.deadflag == DEAD_NO) && IsDifferentTeam(frag_target, frag_attacker)) // if the target is a flagcarrier
        {
-               if(autocvar_g_ctf_flagcarrier_auto_helpme_when_damaged > ('1 0 0' * healtharmor_maxdamage(frag_target.health, frag_target.armorvalue, autocvar_g_balance_armor_blockpercent)))
+               if(autocvar_g_ctf_flagcarrier_auto_helpme_damage > ('1 0 0' * healtharmor_maxdamage(frag_target.health, frag_target.armorvalue, autocvar_g_balance_armor_blockpercent)))
+               if(time > frag_target.wps_helpme_time + autocvar_g_ctf_flagcarrier_auto_helpme_time)
+               {
+                       frag_target.wps_helpme_time = time;
                        WaypointSprite_HelpMePing(frag_target.wps_flagcarrier);
+               }
        }
        return FALSE;
 }
@@ -1905,6 +1909,7 @@ MUTATOR_HOOKFUNCTION(ctf_HelpMePing)
 {
        if(self.wps_flagcarrier) // update the flagcarrier waypointsprite with "NEEDING HELP" notification
        {
+               self.wps_helpme_time = time;
                WaypointSprite_HelpMePing(self.wps_flagcarrier);
        } 
        else // create a normal help me waypointsprite
index 7ed3dfef0121adb150617ac163d5c2c2df3793cd..b6ca033bb3284d34b0e57847e022b21d3a1ea223 100644 (file)
@@ -63,6 +63,7 @@ entity ctf_worldflaglist;
 .entity wps_flagcarrier;
 .entity wps_flagdropped;
 .entity wps_enemyflagcarrier;
+.float wps_helpme_time;
 float wpforenemy_announced;
 float wpforenemy_nextthink;