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
wopox1337 committed Jun 19, 2021
1 parent a9111f8 commit e7aeab5
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion regamedll/dlls/observer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,23 @@ CBasePlayer *CBasePlayer::__API_HOOK(Observer_IsValidTarget)(int iPlayerIndex, b
CBasePlayer *pPlayer = UTIL_PlayerByIndex(iPlayerIndex);

// Don't spec observers or players who haven't picked a class yet
if (!pPlayer || pPlayer == this || pPlayer->has_disconnected || pPlayer->GetObserverMode() != OBS_NONE || (pPlayer->pev->effects & EF_NODRAW) || pPlayer->m_iTeam == UNASSIGNED || (bSameTeam && pPlayer->m_iTeam != m_iTeam))
if (!pPlayer || pPlayer == this)
return nullptr;

if (pPlayer->has_disconnected)
return nullptr;

if (pPlayer->m_iTeam == UNASSIGNED || (bSameTeam && pPlayer->m_iTeam != m_iTeam))
return nullptr;

if (pPlayer->GetObserverMode() != OBS_NONE)
return nullptr;

if (pPlayer->pev->effects & EF_NODRAW
#ifdef REGAMEDLL_FIXES
&& (pPlayer->pev->deadflag == DEAD_DEAD || pPlayer->pev->deadflag == DEAD_NO)
#endif
)
return nullptr;

return pPlayer;
Expand Down

0 comments on commit e7aeab5

Please sign in to comment.