Core/Movement: MotionMaster reimplementation (#21888)

Internal structure and handling changes, nothing behavioural (or thats the intention at least).
This commit is contained in:
ccrs
2018-06-03 10:06:57 -07:00
committed by GitHub
parent b84348f6fc
commit 982643cd96
96 changed files with 2402 additions and 1471 deletions

View File

@@ -1594,10 +1594,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
float attackAngle = float(e.action.setRangedMovement.angle) / 180.0f * float(M_PI);
for (WorldObject* target : targets)
{
if (Creature* creature = target->ToCreature())
if (IsSmart(creature) && creature->GetVictim())
if (ENSURE_AI(SmartAI, creature->AI())->CanCombatMove())
creature->GetMotionMaster()->MoveChase(creature->GetVictim(), attackDistance, attackAngle);
}
break;
}
@@ -2230,16 +2232,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
target->ToUnit()->RemoveAllGameObjects();
break;
}
case SMART_ACTION_STOP_MOTION:
case SMART_ACTION_REMOVE_MOVEMENT:
{
for (WorldObject* const target : targets)
{
if (IsUnit(target))
{
if (e.action.stopMotion.stopMovement)
if (e.action.removeMovement.movementType && e.action.removeMovement.movementType < MAX_MOTION_TYPE)
target->ToUnit()->GetMotionMaster()->Remove(MovementGeneratorType(e.action.removeMovement.movementType));
if (e.action.removeMovement.forced)
target->ToUnit()->StopMoving();
if (e.action.stopMotion.movementExpired)
target->ToUnit()->GetMotionMaster()->MovementExpired();
}
}
break;