mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 09:03:47 +00:00
fix(Core/Pathfinding): Creatures regen health, spells LOD (#4509)
This commit is contained in:
@@ -641,7 +641,7 @@ void Creature::Update(uint32 diff)
|
||||
// regenerate health if not in combat or if polymorphed)
|
||||
if (!IsInCombat() || IsPolymorphed())
|
||||
RegenerateHealth();
|
||||
else if (CanNotReachTarget())
|
||||
else if (IsNotReachableAndNeedRegen())
|
||||
{
|
||||
// regenerate health if cannot reach the target and the setting is set to do so.
|
||||
// this allows to disable the health regen of raid bosses if pathfinding has issues for whatever reason
|
||||
@@ -666,7 +666,7 @@ void Creature::Update(uint32 diff)
|
||||
if (CanNotReachTarget() && !IsInEvadeMode() && !GetMap()->IsRaid())
|
||||
{
|
||||
m_cannotReachTimer += diff;
|
||||
if (m_cannotReachTimer >= (sWorld->getIntConfig(CONFIG_NPC_EVADE_IF_NOT_REACHABLE)*IN_MILLISECONDS) && IsAIEnabled)
|
||||
if (IsNotReachable() && IsAIEnabled)
|
||||
{
|
||||
AI()->EnterEvadeMode();
|
||||
}
|
||||
|
||||
@@ -688,6 +688,8 @@ public:
|
||||
|
||||
void SetCannotReachTarget(bool cannotReach);
|
||||
[[nodiscard]] bool CanNotReachTarget() const { return m_cannotReachTarget; }
|
||||
[[nodiscard]] bool IsNotReachable() const { return (m_cannotReachTimer >= (sWorld->getIntConfig(CONFIG_NPC_EVADE_IF_NOT_REACHABLE) * IN_MILLISECONDS)) && m_cannotReachTarget; }
|
||||
[[nodiscard]] bool IsNotReachableAndNeedRegen() const { return (m_cannotReachTimer >= (sWorld->getIntConfig(CONFIG_NPC_REGEN_TIME_IF_NOT_REACHABLE_IN_RAID) * IN_MILLISECONDS)) && m_cannotReachTarget; }
|
||||
|
||||
void SetPosition(float x, float y, float z, float o);
|
||||
void SetPosition(const Position& pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }
|
||||
|
||||
@@ -553,7 +553,7 @@ void Unit::UpdateSplinePosition()
|
||||
|
||||
void Unit::DisableSpline()
|
||||
{
|
||||
m_movementInfo.RemoveMovementFlag(MovementFlags(MOVEMENTFLAG_SPLINE_ENABLED | MOVEMENTFLAG_FORWARD));
|
||||
m_movementInfo.RemoveMovementFlag(MovementFlags(MOVEMENTFLAG_SPLINE_ENABLED | MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_BACKWARD));
|
||||
movespline->_Interrupt();
|
||||
}
|
||||
|
||||
@@ -13685,6 +13685,7 @@ void Unit::setDeathState(DeathState s, bool despawn)
|
||||
// remove aurastates allowing special moves
|
||||
ClearAllReactives();
|
||||
ClearDiminishings();
|
||||
|
||||
GetMotionMaster()->Clear(false);
|
||||
GetMotionMaster()->MoveIdle();
|
||||
|
||||
@@ -15894,6 +15895,10 @@ void Unit::StopMoving()
|
||||
if (movespline->Finalized())
|
||||
return;
|
||||
|
||||
// Update position now since Stop does not start a new movement that can be updated later
|
||||
if (movespline->HasStarted())
|
||||
UpdateSplinePosition();
|
||||
|
||||
Movement::MoveSplineInit init(this);
|
||||
init.Stop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user