fix(Core/Visibility): Fix visibility crash (#22704)

This commit is contained in:
Takenbacon
2025-08-18 21:14:08 -07:00
committed by GitHub
parent 2ae1dbeab2
commit e3505df99f
+7 -1
View File
@@ -1696,7 +1696,7 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
if (this == obj) if (this == obj)
return true; return true;
if (obj->IsNeverVisible() || CanNeverSee(obj)) if (CanNeverSee(obj))
return false; return false;
if (obj->IsAlwaysVisibleFor(this) || CanAlwaysSee(obj)) if (obj->IsAlwaysVisibleFor(this) || CanAlwaysSee(obj))
@@ -1840,6 +1840,12 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
bool WorldObject::CanNeverSee(WorldObject const* obj) const bool WorldObject::CanNeverSee(WorldObject const* obj) const
{ {
if (!IsInWorld())
return true;
if (obj->IsNeverVisible())
return true;
if (IsCreature() && obj->IsCreature()) if (IsCreature() && obj->IsCreature())
return GetMap() != obj->GetMap() || (!InSamePhase(obj) && ToUnit()->GetVehicleBase() != obj && this != obj->ToUnit()->GetVehicleBase()); return GetMap() != obj->GetMap() || (!InSamePhase(obj) && ToUnit()->GetVehicleBase() != obj && this != obj->ToUnit()->GetVehicleBase());
return GetMap() != obj->GetMap() || !InSamePhase(obj); return GetMap() != obj->GetMap() || !InSamePhase(obj);