move & knockback

This commit is contained in:
Yunfan Li
2023-09-02 10:43:13 +08:00
parent 62e49a966d
commit 5f5faf00cd
5 changed files with 103 additions and 75 deletions

View File

@@ -160,12 +160,12 @@ bool CheckMountStateAction::Mount()
{
uint32 secondmount = 40;
if (bot->isMoving())
{
bot->StopMoving();
bot->GetMotionMaster()->Clear();
bot->GetMotionMaster()->MoveIdle();
}
// if (bot->isMoving())
// {
// bot->StopMoving();
// bot->GetMotionMaster()->Clear();
// // bot->GetMotionMaster()->MoveIdle();
// }
Player* master = GetMaster();
botAI->RemoveShapeshift();

View File

@@ -107,7 +107,7 @@ bool AttackAnythingAction::Execute(Event event)
{
context->GetValue<ObjectGuid>("pull target")->Set(grindTarget->GetGUID());
bot->GetMotionMaster()->Clear();
bot->StopMoving();
// bot->StopMoving();
}
}
}

View File

@@ -3,6 +3,7 @@
*/
#include "MovementActions.h"
#include "MotionMaster.h"
#include "MovementGenerator.h"
#include "ObjectDefines.h"
#include "ObjectGuid.h"
@@ -168,9 +169,11 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
bot->CastStop();
botAI->InterruptSpell();
}
bool generatePath = !bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) &&
!bot->IsFlying() && !bot->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) && !bot->IsInWater();
// char speak[100];
// sprintf(speak, "Move to : (%.2f, %.2f, %.2f), generatePath: %d", x, y, z, generatePath);
// bot->Say(speak, LANG_UNIVERSAL);
MotionMaster &mm = *bot->GetMotionMaster();
mm.Clear();
mm.MovePoint(mapId, x, y, z, generatePath);
@@ -752,6 +755,9 @@ bool MovementAction::IsMovingAllowed()
bot->HasUnitState(UNIT_STATE_LOST_CONTROL))
return false;
if (bot->GetMotionMaster()->GetMotionSlot(MOTION_SLOT_CONTROLLED)) {
return false;
}
return bot->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLIGHT_MOTION_TYPE;
}