allow only 5 suicides every 5 seconds in CTS. No killmessage (centerprint) needed...
authorFruitieX <fruitiex@gmail.com>
Sat, 11 Dec 2010 18:57:03 +0000 (20:57 +0200)
committerFruitieX <fruitiex@gmail.com>
Sat, 11 Dec 2010 18:57:03 +0000 (20:57 +0200)
defaultXonotic.cfg
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc

index f591fe3..e5a78a0 100644 (file)
@@ -623,7 +623,7 @@ set g_ons_respawn_waves 0
 set g_rc_respawn_waves 0
 set g_rc_respawn_delay 0
 set g_cts_respawn_waves 0
-set g_cts_respawn_delay 0.25
+set g_cts_respawn_delay 0
 set g_cts_selfdamage 1 "0 = disable all selfdamage and falldamage in cts"
 set g_cts_finish_kill_delay 10 "prevent cheating by running back to the start line, and starting out with more speed than otherwise possible"
 set g_freezetag_respawn_waves 0
index c1005d0..a19aba9 100644 (file)
@@ -1304,7 +1304,11 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto
 
     if(g_cts) // allow an instant kill in CTS
     {
-        ClientKill_Now();
+        if(self.killcnt < 5) // 5 kills in 5 seconds allowed
+        {
+            self.killcnt += 1;
+            ClientKill_Now();
+        }
         return;
     }
 
@@ -2873,6 +2877,9 @@ void PlayerPreThink (void)
                if(g_nexball)
                        nexball_setstatus();
 
+        if(g_cts)
+            self.killcnt = max(0, self.killcount - sys_frametime);
+
                self.dmg_team = max(0, self.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
 
                //self.angles_y=self.v_angle_y + 90;   // temp
index 27bd209..9fa4784 100644 (file)
@@ -669,7 +669,12 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                waves = 0;
                sdelay = cvar(strcat("g_", GetGametype(), "_respawn_delay"));
                if(!sdelay)
-                       sdelay = autocvar_g_respawn_delay;
+        {
+            if(g_cts)
+                sdelay = 0; // no respawn delay in CTS
+            else
+                sdelay = autocvar_g_respawn_delay;
+        }
                waves = cvar(strcat("g_", GetGametype(), "_respawn_waves"));
                if(!waves)
                        waves = autocvar_g_respawn_waves;
index 76ce748..d46cca6 100644 (file)
@@ -659,3 +659,5 @@ float serverflags;
 .float freezetag_frozen;
 .float freezetag_beginrevive_time;
 .float freezetag_revive_progress;
+
+.float killcnt; // keep track of how many times a player has suicided during the previous 5 seconds
index f064e53..6ab2900 100644 (file)
@@ -295,7 +295,8 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                {
                        if (deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE)
                                msg = ColoredTeamName(targ.team); // TODO: check if needed?
-                       Send_CSQC_Centerprint(targ, msg, "", deathtype, MSG_SUICIDE);
+            if(!g_cts) // no "killed your own dumb self" message in CTS
+                Send_CSQC_Centerprint(targ, msg, "", deathtype, MSG_SUICIDE);
 
                        if(deathtype != DEATH_TEAMCHANGE && deathtype != DEATH_QUIET)
                        {