From 8f0ab1d38e9bda609bc56cf5d41ec348b489d723 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 4 Jun 2018 18:31:17 +0200 Subject: [PATCH] Spectate next player if the spectated player becomes observer (very useful in CA) or disconnects --- qcsrc/server/client.qc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 06aac36e7..270a4d1af 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2302,6 +2302,7 @@ bool PlayerThink(entity this) return true; } +.bool would_spectate; void ObserverThink(entity this) { if ( CS(this).impulse ) @@ -2314,7 +2315,7 @@ void ObserverThink(entity this) if (PHYS_INPUT_BUTTON_JUMP(this) && joinAllowed(this)) { this.flags &= ~FL_JUMPRELEASED; this.flags |= FL_SPAWNING; - } else if(PHYS_INPUT_BUTTON_ATCK(this) && !CS(this).version_mismatch) { + } else if(PHYS_INPUT_BUTTON_ATCK(this) && !CS(this).version_mismatch || this.would_spectate) { this.flags &= ~FL_JUMPRELEASED; if(SpectateNext(this)) { TRANSMUTE(Spectator, this); @@ -2374,12 +2375,19 @@ void SpectatorThink(entity this) } CS(this).impulse = 0; } else if (PHYS_INPUT_BUTTON_ATCK2(this)) { + this.would_spectate = false; this.flags &= ~FL_JUMPRELEASED; TRANSMUTE(Observer, this); PutClientInServer(this); } else { if(!SpectateUpdate(this)) - PutObserverInServer(this); + { + if(!SpectateNext(this)) + { + PutObserverInServer(this); + this.would_spectate = true; + } + } } } else { if (!(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this))) { -- 2.39.2