mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-28 08:06:23 +00:00
fix(Core/Creature): Prevent combat movement disabled creatures from r… (#18428)
* fix(Core/Creature): Prevent combat movement disabled creatures from repositioning if target moves within model boundary * fixbuild * Apply suggestions from code review
This commit is contained in:
@@ -220,7 +220,7 @@ Creature::Creature(bool isWorldObject): Unit(isWorldObject), MovableMapObject(),
|
||||
m_spawnId(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false),
|
||||
m_AlreadySearchedAssistance(false), m_regenHealth(true), m_regenPower(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), m_originalEntry(0), m_moveInLineOfSightDisabled(false), m_moveInLineOfSightStrictlyDisabled(false),
|
||||
m_homePosition(), m_transportHomePosition(), m_creatureInfo(nullptr), m_creatureData(nullptr), m_detectionDistance(20.0f), m_waypointID(0), m_path_id(0), m_formation(nullptr), _lastDamagedTime(nullptr), m_cannotReachTimer(0),
|
||||
_isMissingSwimmingFlagOutOfCombat(false), m_assistanceTimer(0), _playerDamageReq(0), _damagedByPlayer(false)
|
||||
_isMissingSwimmingFlagOutOfCombat(false), m_assistanceTimer(0), _playerDamageReq(0), _damagedByPlayer(false), _isCombatMovementAllowed(true)
|
||||
{
|
||||
m_regenTimer = CREATURE_REGEN_INTERVAL;
|
||||
m_valuesCount = UNIT_END;
|
||||
@@ -877,7 +877,7 @@ bool Creature::IsFreeToMove()
|
||||
{
|
||||
uint32 moveFlags = m_movementInfo.GetMovementFlags();
|
||||
// Do not reposition ourself when we are not allowed to move
|
||||
if ((IsMovementPreventedByCasting() || isMoving() || !CanFreeMove()) &&
|
||||
if ((IsMovementPreventedByCasting() || isMoving() || !CanFreeMove() || !IsCombatMovementAllowed()) &&
|
||||
(GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE ||
|
||||
moveFlags & MOVEMENTFLAG_SPLINE_ENABLED))
|
||||
{
|
||||
@@ -3738,6 +3738,11 @@ bool Creature::CanCastSpell(uint32 spellID) const
|
||||
return true;
|
||||
}
|
||||
|
||||
void Creature::SetCombatMovement(bool allowMovement)
|
||||
{
|
||||
_isCombatMovementAllowed = allowMovement;
|
||||
}
|
||||
|
||||
ObjectGuid Creature::GetSummonerGUID() const
|
||||
{
|
||||
if (TempSummon const* temp = ToTempSummon())
|
||||
|
||||
Reference in New Issue
Block a user