From a666e3cfb0053892d0b224c1b37475ad10484664 Mon Sep 17 00:00:00 2001 From: FruitieX Date: Sat, 11 Dec 2010 20:57:03 +0200 Subject: [PATCH] allow only 5 suicides every 5 seconds in CTS. No killmessage (centerprint) needed. Disable the respawn delay in CTS --- defaultXonotic.cfg | 2 +- qcsrc/server/cl_client.qc | 9 ++++++++- qcsrc/server/cl_player.qc | 7 ++++++- qcsrc/server/defs.qh | 2 ++ qcsrc/server/g_damage.qc | 3 ++- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index f591fe31f..e5a78a0a0 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -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 diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index c1005d003..a19aba97f 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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 diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 27bd209c5..9fa4784fa 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -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; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 76ce748ca..d46cca686 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -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 diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index f064e5359..6ab29006d 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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) { -- 2.39.2