mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-21 02:20:00 +01:00
movement for fly & swimming
This commit is contained in:
parent
022c7c7796
commit
e896168769
@ -87,7 +87,7 @@ bool FollowAction::isUseful()
|
|||||||
if (Formation::IsNullLocation(loc) || bot->GetMapId() != loc.GetMapId())
|
if (Formation::IsNullLocation(loc) || bot->GetMapId() != loc.GetMapId())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
distance = sServerFacade->GetDistance2d(bot, loc.GetPositionX(), loc.GetPositionY());
|
distance = bot->GetDistance(loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return sServerFacade->IsDistanceGreaterThan(distance, formation->GetMaxDistance());
|
return sServerFacade->IsDistanceGreaterThan(distance, formation->GetMaxDistance());
|
||||||
|
|||||||
@ -148,7 +148,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// if (bot->Unit::IsFalling()) {
|
// if (bot->Unit::IsFalling()) {
|
||||||
// bot->Say("I'm falling", LANG_UNIVERSAL);
|
// bot->Say("I'm falling", LANG_UNIVERSAL);
|
||||||
// }
|
// }
|
||||||
float distance = bot->GetDistance2d(x, y);
|
float distance = bot->GetDistance(x, y, z);
|
||||||
if (distance > sPlayerbotAIConfig->contactDistance)
|
if (distance > sPlayerbotAIConfig->contactDistance)
|
||||||
{
|
{
|
||||||
WaitForReach(distance);
|
WaitForReach(distance);
|
||||||
@ -166,7 +166,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
MotionMaster &mm = *bot->GetMotionMaster();
|
MotionMaster &mm = *bot->GetMotionMaster();
|
||||||
|
|
||||||
mm.Clear();
|
mm.Clear();
|
||||||
mm.MovePoint(mapId, x, y, SearchBestGroundZForPath(x, y, z), generatePath);
|
mm.MovePoint(mapId, x, y, SearchBestGroundZForPath(x, y, z, generatePath), generatePath);
|
||||||
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation());
|
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1268,8 +1268,11 @@ bool MovementAction::MoveInside(uint32 mapId, float x, float y, float z, float d
|
|||||||
return MoveNear(mapId, x, y, z, distance);
|
return MoveNear(mapId, x, y, z, distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
float MovementAction::SearchBestGroundZForPath(float x, float y, float z, float range)
|
float MovementAction::SearchBestGroundZForPath(float x, float y, float z, bool generatePath, float range)
|
||||||
{
|
{
|
||||||
|
if (!generatePath) {
|
||||||
|
return z;
|
||||||
|
}
|
||||||
float modified_z;
|
float modified_z;
|
||||||
float delta;
|
float delta;
|
||||||
for (delta = 0.0f; delta <= range / 2; delta++) {
|
for (delta = 0.0f; delta <= range / 2; delta++) {
|
||||||
|
|||||||
@ -41,7 +41,7 @@ class MovementAction : public Action
|
|||||||
bool MoveInside(uint32 mapId, float x, float y, float z, float distance = sPlayerbotAIConfig->followDistance);
|
bool MoveInside(uint32 mapId, float x, float y, float z, float distance = sPlayerbotAIConfig->followDistance);
|
||||||
void CreateWp(Player* wpOwner, float x, float y, float z, float o, uint32 entry, bool important = false);
|
void CreateWp(Player* wpOwner, float x, float y, float z, float o, uint32 entry, bool important = false);
|
||||||
private:
|
private:
|
||||||
float SearchBestGroundZForPath(float x, float y, float z, float range = 10.0f);
|
float SearchBestGroundZForPath(float x, float y, float z, bool generatePath, float range = 10.0f);
|
||||||
};
|
};
|
||||||
|
|
||||||
class FleeAction : public MovementAction
|
class FleeAction : public MovementAction
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user