Skip to content

Commit

Permalink
Allow observe for dying player with EF_NODRAW effect
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyShorokhov committed Jun 20, 2021
1 parent a390cad commit 55b996c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions regamedll/dlls/observer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 55b996c

Please sign in to comment.