From: terencehill Date: Mon, 4 Jun 2018 16:31:17 +0000 (+0200) Subject: Spectate next player if the spectated player becomes observer (very useful in CA... X-Git-Tag: xonotic-v0.8.5~2110 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8f0ab1d38e9bda609bc56cf5d41ec348b489d723;p=xonotic%2Fxonotic-data.pk3dir.git Spectate next player if the spectated player becomes observer (very useful in CA) or disconnects --- 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))) {