Core/Creatures: Allow disabling melee attacks for all creatures, not just the ones using SAI

This commit is contained in:
Shauren
2023-03-13 20:22:47 +01:00
parent eb93afffc0
commit d26d38075c
7 changed files with 18 additions and 19 deletions
+4 -5
View File
@@ -33,7 +33,7 @@
SmartAI::SmartAI(Creature* creature, uint32 scriptId) : CreatureAI(creature, scriptId), _charmed(false), _followCreditType(0), _followArrivedTimer(0), _followCredit(0), _followArrivedEntry(0), _followDistance(0.f), _followAngle(0.f),
_escortState(SMART_ESCORT_NONE), _escortNPCFlags(0), _escortInvokerCheckTimer(1000), _currentWaypointNode(0), _waypointReached(false), _waypointPauseTimer(0), _waypointPauseForced(false), _repeatWaypointPath(false),
_OOCReached(false), _waypointPathEnded(false), _run(true), _evadeDisabled(false), _canAutoAttack(true), _canCombatMove(true), _invincibilityHPLevel(0), _despawnTime(0), _despawnState(0), _vehicleConditionsTimer(0),
_OOCReached(false), _waypointPathEnded(false), _run(true), _evadeDisabled(false), _canCombatMove(true), _invincibilityHPLevel(0), _despawnTime(0), _despawnState(0), _vehicleConditionsTimer(0),
_gossipReturn(false), _escortQuestId(0)
{
_vehicleConditions = sConditionMgr->HasConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, creature->GetEntry());
@@ -309,8 +309,7 @@ void SmartAI::UpdateAI(uint32 diff)
if (!hasVictim)
return;
if (_canAutoAttack)
DoMeleeAttackIfReady();
DoMeleeAttackIfReady();
}
bool SmartAI::IsEscortInvokerInRange()
@@ -594,11 +593,11 @@ void SmartAI::AttackStart(Unit* who)
if (!IsAIControlled())
{
if (who)
me->Attack(who, _canAutoAttack);
me->Attack(who, true);
return;
}
if (who && me->Attack(who, _canAutoAttack))
if (who && me->Attack(who, true))
{
me->GetMotionMaster()->Clear(MOTION_PRIORITY_NORMAL);
me->PauseMovement();