]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/clientkill.qc
Merge branch 'martin-t/deglob-log' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / clientkill.qc
index be020a77269eebbbdfce113f144bcf59ba3843ac..08758a06536f706bd722e6ed57549e0ae1b6d154 100644 (file)
@@ -22,7 +22,10 @@ void ClientKill_Now_TeamChange(entity this)
                PutObserverInServer(this);
        }
        else
-               SV_ChangeTeam(this, this.killindicator_teamchange - 1);
+       {
+               Player_SetTeamIndexChecked(this, Team_TeamToIndex(
+                       this.killindicator_teamchange));
+       }
        this.killindicator_teamchange = 0;
 }
 
@@ -99,6 +102,13 @@ void ClientKill_TeamChange(entity this, float targetteam) // 0 = don't change, -
 
        this.killindicator_teamchange = targetteam;
 
+       // this.killindicator.count == 1 means that the kill indicator was spawned by ClientKill_Silent
+       if(killtime <= 0 && this.killindicator && this.killindicator.count == 1)
+       {
+               ClientKill_Now(this); // allow instant kill in this case
+               return;
+       }
+
        if (!this.killindicator)
        {
                if (!IS_DEAD(this))
@@ -171,11 +181,20 @@ void ClientKill_TeamChange(entity this, float targetteam) // 0 = don't change, -
 
 }
 
+void ClientKill_Silent(entity this, float _delay)
+{
+       this.killindicator = spawn();
+       this.killindicator.owner = this;
+       setthink(this.killindicator, KillIndicator_Think);
+       this.killindicator.nextthink = time + (this.lip) * 0.05;
+       this.killindicator.cnt = ceil(_delay);
+       this.killindicator.count = 1; // this is used to indicate that it should be silent
+       this.lip = 0;
+}
+
 // 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;