feat(Core/Maps): Improve map object updater (#22392)

This commit is contained in:
Takenbacon
2025-07-11 07:00:16 -07:00
committed by GitHub
parent 9d6c7ad7ea
commit 1c3cbd3d9e
16 changed files with 285 additions and 181 deletions

View File

@@ -2772,11 +2772,7 @@ bool Creature::LoadCreaturesAddon(bool reload)
//Load Path
if (cainfo->path_id != 0)
{
if (sWorld->getBoolConfig(CONFIG_SET_ALL_CREATURES_WITH_WAYPOINT_MOVEMENT_ACTIVE))
setActive(true);
m_path_id = cainfo->path_id;
}
if (!cainfo->auras.empty())
{
@@ -3896,3 +3892,27 @@ std::string Creature::GetDebugInfo() const
<< " WaypointPath: " << GetWaypointPath() << " SpawnId: " << GetSpawnId();
return sstr.str();
}
// Note: This is called in a tight (heavy) loop, is it critical that all checks are FAST and are hopefully only simple conditionals.
bool Creature::IsUpdateNeeded()
{
if (WorldObject::IsUpdateNeeded())
return true;
if (GetMap()->isCellMarked(GetCurrentCell().GetCellCoord().GetId()))
return true;
if (IsInCombat())
return true;
if (IsVisibilityOverridden())
return true;
if (GetMotionMaster()->HasMovementGeneratorType(WAYPOINT_MOTION_TYPE))
return true;
if (HasUnitState(UNIT_STATE_EVADE))
return true;
return false;
}