From 55b996c30a5309f6ee672f12e1fee12f7d091599 Mon Sep 17 00:00:00 2001 From: Sergey Shorokhov Date: Sun, 20 Jun 2021 11:57:51 +0300 Subject: [PATCH] Allow observe for dying player with EF_NODRAW effect --- regamedll/dlls/observer.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/regamedll/dlls/observer.cpp b/regamedll/dlls/observer.cpp index 2f959d71..f60f2004 100644 --- a/regamedll/dlls/observer.cpp +++ b/regamedll/dlls/observer.cpp @@ -281,12 +281,21 @@ void CBasePlayer::Observer_CheckTarget() CBasePlayer *target = UTIL_PlayerByIndex(m_hObserverTarget->entindex()); // check taget - if (!target || target->pev->deadflag == DEAD_RESPAWNABLE || (target->pev->effects & EF_NODRAW)) + if (!target || target->pev->deadflag == DEAD_RESPAWNABLE) + { Observer_FindNextPlayer(false); - + } + else if (target->pev->effects & EF_NODRAW) + { +#ifdef REGAMEDLL_FIXES + bool bStillDying = (target->pev->deadflag == DEAD_DYING || (target->pev->deadflag == DEAD_DEAD && (gpGlobals->time <= target->m_fDeadTime + 2.0f))); + if (!bStillDying || (target->m_afPhysicsFlags & PFLAG_OBSERVER)) // keep observing to victim until dying, even if it is invisible +#endif + Observer_FindNextPlayer(false); + } else if (target->pev->deadflag == DEAD_DEAD && gpGlobals->time > target->m_fDeadTime + 2.0f) { - // 3 secs after death change target + // 2 secs after death change target Observer_FindNextPlayer(false); if (!m_hObserverTarget)