diff options
author | Xanadu <none@none> | 2010-03-11 01:56:47 +0100 |
---|---|---|
committer | Xanadu <none@none> | 2010-03-11 01:56:47 +0100 |
commit | 4c7e599802996fc5e11d8d6e0f7ca27e02039609 (patch) | |
tree | ee16cbb2747cca6e496ae8d37368276d4a7aba9c /src | |
parent | d8520c04e80b1061e7a41cacd058451278b7b1d9 (diff) |
Fixed ACTION_T_COMBAT_MOVEMENT preventing waypoint movement in OOC state.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/CreatureEventAI.cpp | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 3b6281677f4..133bfca1f4b 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -575,19 +575,38 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 //Allow movement (create new targeted movement gen only if idle) if (CombatMovementEnabled) { - if(action.combat_movement.melee && m_creature->isInCombat()) - if(Unit* victim = m_creature->getVictim()) + Unit* victim = m_creature->getVictim(); + if (m_creature->isInCombat() && victim) + { + if (action.combat_movement.melee) + { + m_creature->addUnitState(UNIT_STAT_MELEE_ATTACKING); m_creature->SendMeleeAttackStart(victim); - - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), AttackDistance, AttackAngle); + } + if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE) + { + //m_creature->GetMotionMaster()->Clear(false); + m_creature->GetMotionMaster()->MoveChase(victim, AttackDistance, AttackAngle); // Targeted movement generator will start melee automatically, no need to send it explicitly + } + } } else - { - if(action.combat_movement.melee && m_creature->isInCombat()) - if(Unit* victim = m_creature->getVictim()) + { + if (m_creature->isInCombat()) + { + Unit* victim = m_creature->getVictim(); + if (action.combat_movement.melee && victim) + { + m_creature->clearUnitState(UNIT_STAT_MELEE_ATTACKING); m_creature->SendMeleeAttackStop(victim); - - m_creature->GetMotionMaster()->MoveIdle(); + } + if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + { + //m_creature->StopMoving(); + //m_creature->GetMotionMaster()->Clear(false); + m_creature->GetMotionMaster()->MoveIdle(); + } + } } break; case ACTION_T_SET_PHASE: |