X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fclientkill.qc;h=296a95bfe5f384c9d8428626f0a1cbd0282fff2f;hb=2383cf4e8e263782677201fe93423e1dd19367b2;hp=0bb761483b19bb8433c8bf968dad5fa3679b8f19;hpb=74cbc0f6613383108745f231c78a340d747fc094;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/clientkill.qc b/qcsrc/server/clientkill.qc index 0bb761483..296a95bfe 100644 --- a/qcsrc/server/clientkill.qc +++ b/qcsrc/server/clientkill.qc @@ -1,13 +1,19 @@ #include "clientkill.qh" -#include - -#include "g_damage.qh" -#include "teamplay.qh" - -#include +#include +#include +#include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include void ClientKill_Now_TeamChange(entity this) { @@ -19,10 +25,13 @@ void ClientKill_Now_TeamChange(entity this) { if (blockSpectators) Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime); - PutObserverInServer(this); + PutObserverInServer(this, false, true); } else - SV_ChangeTeam(this, this.killindicator_teamchange - 1); + { + Player_SetTeamIndexChecked(this, Team_TeamToIndex( + this.killindicator_teamchange)); + } this.killindicator_teamchange = 0; } @@ -97,6 +106,9 @@ void ClientKill_TeamChange(entity this, float targetteam) // 0 = don't change, - return; killtime = M_ARGV(1, float); + if(round_handler_IsActive() && !round_handler_IsRoundStarted()) + killtime = min(killtime, 1); + this.killindicator_teamchange = targetteam; // this.killindicator.count == 1 means that the kill indicator was spawned by ClientKill_Silent @@ -111,7 +123,10 @@ void ClientKill_TeamChange(entity this, float targetteam) // 0 = don't change, - if (!IS_DEAD(this)) { killtime = max(killtime, this.clientkill_nexttime - time); - this.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam; + float antispam_delay = autocvar_g_balance_kill_antispam; + if(round_handler_IsActive() && !round_handler_IsRoundStarted()) + antispam_delay = min(antispam_delay, 2); + this.clientkill_nexttime = time + killtime + antispam_delay; } if (killtime <= 0 || !IS_PLAYER(this) || IS_DEAD(this)) @@ -122,7 +137,7 @@ void ClientKill_TeamChange(entity this, float targetteam) // 0 = don't change, - { float starttime = max(time, clientkilltime); - this.killindicator = spawn(); + this.killindicator = new(killindicator); this.killindicator.owner = this; this.killindicator.scale = 0.5; setattachment(this.killindicator, this, ""); @@ -134,9 +149,9 @@ void ClientKill_TeamChange(entity this, float targetteam) // 0 = don't change, - this.killindicator.count = bound(0, ceil(killtime), 10); //sprint(this, strcat("^1You'll be dead in ", ftos(this.killindicator.cnt), " seconds\n")); - IL_EACH(g_clones, it.enemy == this && !(it.effects & CSQCMODEL_EF_RESPAWNGHOST), + IL_EACH(g_clones, it.enemy == this && !(it.effects & CSQCMODEL_EF_RESPAWNGHOST) && !it.killindicator, { - it.killindicator = spawn(); + it.killindicator = new(killindicator); it.killindicator.owner = it; it.killindicator.scale = 0.5; setattachment(it.killindicator, it, ""); @@ -180,7 +195,7 @@ void ClientKill_TeamChange(entity this, float targetteam) // 0 = don't change, - void ClientKill_Silent(entity this, float _delay) { - this.killindicator = spawn(); + this.killindicator = new(killindicator); this.killindicator.owner = this; setthink(this.killindicator, KillIndicator_Think); this.killindicator.nextthink = time + (this.lip) * 0.05; @@ -192,8 +207,6 @@ void ClientKill_Silent(entity this, float _delay) // Called when a client types 'kill' in the console void ClientKill(entity this) { - // TODO: once .health is removed, will need to check it here for the "already dead" message! - if (game_stopped || this.player_blocked || STAT(FROZEN, this)) return;