]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Do not spam multiple msgs at once touching the flag when it's shielded
authorterencehill <piuntn@gmail.com>
Fri, 1 Jul 2011 11:11:09 +0000 (13:11 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 1 Jul 2011 11:11:09 +0000 (13:11 +0200)
qcsrc/common/constants.qh
qcsrc/server/ctf.qc

index ffb0d0faac00af09e851a2e2786b959ad50aeed4..42262ac3d2f43cd415e86e7a7ea34739de9388a4 100644 (file)
@@ -614,7 +614,7 @@ float MAX_SHOT_DISTANCE = 32768;
 
 //centerprint ID list
 float CPID_TEAMCHANGE = 1;
-
+float CPID_CTF_CAPTURESHIELD = 2;
 float CPID_MINSTA_FINDAMMO = 3;
 float CPID_NIX_WPNCHANGE = 4;
 float CPID_DISCONNECT_IDLING = 5;
index df44f5d2e8ab2861ab1409f731512df0db2cd921..8370ef70431e8de17f2027f92537970a60075652 100644 (file)
@@ -66,12 +66,12 @@ void ctf_captureshield_update(entity p, float dir)
                {
                        if(should)
                        {
-                               centerprint(p, "^3You are now ^4shielded^3 from the flag\n^3for ^1too many unsuccessful attempts^3 to capture.\n\n^3Make some defensive scores before trying again.");
+                               Send_CSQC_Centerprint_Generic(other, CPID_CTF_CAPTURESHIELD, "^3You are ^4shielded^3 from the flag\n^3for ^1too many unsuccessful attempts^3 to capture.\n\n^3Get some defensive scores before trying again.", 5, 0);
                                // TODO csqc notifier for this
                        }
                        else
                        {
-                               centerprint(p, "^3You are now free.\n\n^3Feel free to ^1try to capture^3 the flag again\n^3if you think you will succeed.");
+                               Send_CSQC_Centerprint_Generic(p, CPID_CTF_CAPTURESHIELD, "^3You are now free.\n\n^3Feel free to ^1try to capture^3 the flag again\n^3if you think you will succeed.", 5, 0);
                                // TODO csqc notifier for this
                        }
                        p.ctf_captureshielded = should;
@@ -88,6 +88,7 @@ float ctf_captureshield_customize()
        return TRUE;
 }
 
+.float ctf_captureshield_touch_msgtime;
 void ctf_captureshield_touch()
 {
        if not(other.ctf_captureshielded)
@@ -99,7 +100,9 @@ void ctf_captureshield_touch()
        mymid = (self.absmin + self.absmax) * 0.5;
        othermid = (other.absmin + other.absmax) * 0.5;
        Damage(other, self, self, 0, DEATH_HURTTRIGGER, mymid, normalize(othermid - mymid) * captureshield_force);
-       centerprint(other, "^3You are ^4shielded^3 from the flag\n^3for ^1too many unsuccessful attempts^3 to capture.\n\n^3Get some defensive scores before trying again.");
+       if (time - other.ctf_captureshield_touch_msgtime > 2)
+               Send_CSQC_Centerprint_Generic(other, CPID_CTF_CAPTURESHIELD, "^3You are ^4shielded^3 from the flag\n^3for ^1too many unsuccessful attempts^3 to capture.\n\n^3Get some defensive scores before trying again.", 5, 0);
+       other.ctf_captureshield_touch_msgtime = time;
 }
 
 void ctf_flag_spawnstuff()