mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Add backwards paramater on MoveAway (apply only on FleeAction)
This commit is contained in:
@@ -1522,14 +1522,8 @@ void MovementAction::ClearIdleState()
|
||||
context->GetValue<PositionMap&>("position")->Get()["random"].Reset();
|
||||
}
|
||||
|
||||
bool MovementAction::MoveAway(Unit* target, float distance)
|
||||
bool MovementAction::MoveAway(Unit* target, float distance, bool backwards)
|
||||
{
|
||||
// MotionMaster& mm = *bot->GetMotionMaster();
|
||||
// mm.Clear();
|
||||
// mm.MoveBackwards(target, distance);
|
||||
// botAI->SetNextCheckDelay(3000);
|
||||
// // bot->GetSpeed()
|
||||
// return true;
|
||||
if (!target)
|
||||
{
|
||||
return false;
|
||||
@@ -1551,7 +1545,7 @@ bool MovementAction::MoveAway(Unit* target, float distance)
|
||||
dz = bot->GetPositionZ();
|
||||
exact = false;
|
||||
}
|
||||
if (MoveTo(target->GetMapId(), dx, dy, dz, false, false, true, exact, MovementPriority::MOVEMENT_COMBAT, false, true))
|
||||
if (MoveTo(target->GetMapId(), dx, dy, dz, false, false, true, exact, MovementPriority::MOVEMENT_COMBAT, false, backwards))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1573,7 +1567,7 @@ bool MovementAction::MoveAway(Unit* target, float distance)
|
||||
dz = bot->GetPositionZ();
|
||||
exact = false;
|
||||
}
|
||||
if (MoveTo(target->GetMapId(), dx, dy, dz, false, false, true, exact, MovementPriority::MOVEMENT_COMBAT, false, true))
|
||||
if (MoveTo(target->GetMapId(), dx, dy, dz, false, false, true, exact, MovementPriority::MOVEMENT_COMBAT, false, backwards))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1774,7 +1768,7 @@ const Movement::PointsArray MovementAction::SearchForBestPath(float x, float y,
|
||||
bool FleeAction::Execute(Event event)
|
||||
{
|
||||
// return Flee(AI_VALUE(Unit*, "current target"));
|
||||
return MoveAway(AI_VALUE(Unit*, "current target"));
|
||||
return MoveAway(AI_VALUE(Unit*, "current target"), true);
|
||||
}
|
||||
|
||||
bool FleeAction::isUseful()
|
||||
|
||||
@@ -51,7 +51,7 @@ protected:
|
||||
bool Flee(Unit* target);
|
||||
void ClearIdleState();
|
||||
void UpdateMovementState();
|
||||
bool MoveAway(Unit* target, float distance = sPlayerbotAIConfig -> fleeDistance);
|
||||
bool MoveAway(Unit* target, float distance = sPlayerbotAIConfig -> fleeDistance, bool backwards = false);
|
||||
bool MoveFromGroup(float distance);
|
||||
bool Move(float angle, float distance);
|
||||
bool MoveInside(uint32 mapId, float x, float y, float z, float distance = sPlayerbotAIConfig->followDistance, MovementPriority priority = MovementPriority::MOVEMENT_NORMAL);
|
||||
|
||||
Reference in New Issue
Block a user