fix(Core/Visibility): Fix sentry totem visibility not toggling (#23228)

This commit is contained in:
Takenbacon 2025-10-22 07:56:54 -07:00 committed by GitHub
parent e867443c4e
commit f661f57f67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 5 deletions

View file

@ -1776,6 +1776,8 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
WorldObject const* viewpoint = this;
if (Player const* thisPlayer = ToPlayer())
{
viewpoint = thisPlayer->GetSeer();
if (Creature const* creature = obj->ToCreature())
{
if (TempSummon const* tempSummon = creature->ToTempSummon())
@ -1815,13 +1817,8 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
return false;
}
if (thisPlayer->GetViewpoint())
viewpoint = thisPlayer->GetViewpoint();
if (thisPlayer->GetFarSightDistance() && !thisPlayer->isInFront(obj))
{
return false;
}
}
// Xinef: check reversely obj vs viewpoint, object could be a gameObject which overrides _IsWithinDist function to include gameobject size

View file

@ -2351,6 +2351,7 @@ public:
void SetMover(Unit* target);
void SetSeer(WorldObject* target) { m_seer = target; }
WorldObject* GetSeer() const { return m_seer; }
void SetViewpoint(WorldObject* target, bool apply);
[[nodiscard]] WorldObject* GetViewpoint() const;
void StopCastingCharm(Aura* except = nullptr);