feat(Core/Visibility): Far visibility worldobjects (#22828)
This commit is contained in:
@@ -16311,13 +16311,25 @@ float Player::GetSightRange(WorldObject const* target) const
|
||||
{
|
||||
float sightRange = WorldObject::GetSightRange(target);
|
||||
if (_farSightDistance)
|
||||
{
|
||||
sightRange += *_farSightDistance;
|
||||
}
|
||||
|
||||
return sightRange;
|
||||
}
|
||||
|
||||
bool Player::IsWorldObjectOutOfSightRange(WorldObject const* target) const
|
||||
{
|
||||
// Special handling for Infinite visibility override objects -> they are zone wide visible
|
||||
if (target->GetVisibilityOverrideType() == VisibilityDistanceType::Infinite)
|
||||
{
|
||||
// Same zone, always visible
|
||||
if (target->GetZoneId() == GetZoneId())
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if out of range
|
||||
return !m_seer->IsWithinDist(target, GetSightRange(target), true);
|
||||
}
|
||||
|
||||
std::string Player::GetPlayerName()
|
||||
{
|
||||
std::string name = GetName();
|
||||
|
||||
@@ -2630,6 +2630,7 @@ public:
|
||||
[[nodiscard]] Optional<float> GetFarSightDistance() const;
|
||||
|
||||
float GetSightRange(WorldObject const* target = nullptr) const override;
|
||||
bool IsWorldObjectOutOfSightRange(WorldObject const* target) const;
|
||||
|
||||
std::string GetPlayerName();
|
||||
|
||||
|
||||
@@ -1594,21 +1594,12 @@ void Player::UpdateVisibilityForPlayer(bool mapChange)
|
||||
// After added to map seer must be a player - there is no possibility to
|
||||
// still have different seer (all charm auras must be already removed)
|
||||
if (mapChange && m_seer != this)
|
||||
{
|
||||
m_seer = this;
|
||||
}
|
||||
|
||||
Acore::VisibleNotifier notifierNoLarge(
|
||||
*this, mapChange,
|
||||
false); // visit only objects which are not large; default distance
|
||||
Cell::VisitObjects(m_seer, notifierNoLarge,
|
||||
GetSightRange() + VISIBILITY_INC_FOR_GOBJECTS);
|
||||
notifierNoLarge.SendToSelf();
|
||||
|
||||
Acore::VisibleNotifier notifierLarge(
|
||||
*this, mapChange, true); // visit only large objects; maximum distance
|
||||
Cell::VisitObjects(m_seer, notifierLarge, GetSightRange());
|
||||
notifierLarge.SendToSelf();
|
||||
Acore::VisibleNotifier notifier(*this, mapChange);
|
||||
Cell::VisitObjects(m_seer, notifier, GetSightRange());
|
||||
Cell::VisitFarVisibleObjects(m_seer, notifier, VISIBILITY_DISTANCE_GIGANTIC);
|
||||
notifier.SendToSelf();
|
||||
|
||||
if (mapChange)
|
||||
m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
|
||||
|
||||
Reference in New Issue
Block a user