]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_client.qc
Merge remote branch 'origin/master' into fruitiex/ctsfix
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_client.qc
index 821f51573d9c01c6892d4b713e58cbd5db2fb666..274d5ccdb3a5863ae905184d330338b8d731b0d3 100644 (file)
@@ -1272,6 +1272,11 @@ void KillIndicator_Think()
                ClientKill_Now(); // no oldself needed
                return;
        }
+    else if(g_cts)
+    {
+        self.nextthink = time + 1;
+        self.cnt -= 1;
+    }
        else
        {
                if(self.cnt <= 10)
@@ -1314,7 +1319,16 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
 
        self.killindicator_teamchange = targetteam;
 
-       if(!self.killindicator)
+    if(g_cts) // allow an instant kill in CTS
+    {
+        if(self.selfkilltime < time + 3) // prevent spam
+        {
+            self.selfkilltime = max(time, self.selfkilltime) + 2;
+            ClientKill_Now();
+        }
+        return;
+    }
+    if(!self.killindicator)
        {
                if(killtime <= 0 || !self.modelindex || self.deadflag != DEAD_NO)
                {
@@ -1376,20 +1390,14 @@ void ClientKill (void)
                ClientKill_TeamChange(0);
 }
 
-void CTS_ClientKill_Think (void)
+void CTS_ClientKill (entity e) // silent version of ClientKill
 {
-       self = self.owner; // set self to the player to be killed
-       sprint(self, "^1You were killed in order to prevent cheating!");
-       ClientKill_Now();
-}
-
-void CTS_ClientKill (float t) // silent version of ClientKill
-{
-       entity e;
-       e = spawn();
-       e.owner = self;
-       e.think = CTS_ClientKill_Think;
-       e.nextthink = t;
+    e.killindicator = spawn();
+    e.killindicator.owner = e;
+    e.killindicator.think = KillIndicator_Think;
+    e.killindicator.nextthink = time + (e.lip) * 0.05;
+    e.killindicator.cnt = ceil(autocvar_g_cts_finish_kill_delay);
+    e.lip = 0;
 }
 
 void DoTeamChange(float destteam)
@@ -2739,7 +2747,7 @@ void PlayerPreThink (void)
                                if(frametime)
                                        player_anim();
                                button_pressed = (self.BUTTON_ATCK || self.BUTTON_JUMP || self.BUTTON_ATCK2 || self.BUTTON_HOOK || self.BUTTON_USE);
-                               force_respawn = (g_lms || (g_ca) || autocvar_g_forced_respawn);
+                               force_respawn = (g_lms || g_ca || g_cts || autocvar_g_forced_respawn);
                                if (self.deadflag == DEAD_DYING)
                                {
                                        if(force_respawn)