mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-02 18:33:48 +00:00
bot swim
This commit is contained in:
@@ -146,8 +146,14 @@ 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);
|
||||||
// }
|
// }
|
||||||
z += 2.0f;
|
float modified_z = z + 0.5f;
|
||||||
bot->UpdateAllowedPositionZ(x, y, z);
|
bot->UpdateAllowedPositionZ(x, y, modified_z);
|
||||||
|
// prevent falling when bot on slope
|
||||||
|
if (modified_z < z - 20.0f) {
|
||||||
|
modified_z = z + 5.0f;
|
||||||
|
bot->UpdateAllowedPositionZ(x, y, modified_z);
|
||||||
|
}
|
||||||
|
z = modified_z;
|
||||||
// z += 0.5f;
|
// z += 0.5f;
|
||||||
float distance = bot->GetDistance2d(x, y);
|
float distance = bot->GetDistance2d(x, y);
|
||||||
if (distance > sPlayerbotAIConfig->contactDistance)
|
if (distance > sPlayerbotAIConfig->contactDistance)
|
||||||
@@ -164,7 +170,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool generatePath = !bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) &&
|
bool generatePath = !bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) &&
|
||||||
!bot->IsFlying() && !bot->isSwimming();
|
!bot->IsFlying() && !bot->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) && !bot->IsInWater();
|
||||||
MotionMaster &mm = *bot->GetMotionMaster();
|
MotionMaster &mm = *bot->GetMotionMaster();
|
||||||
mm.Clear();
|
mm.Clear();
|
||||||
mm.MovePoint(mapId, x, y, z, generatePath);
|
mm.MovePoint(mapId, x, y, z, generatePath);
|
||||||
@@ -758,13 +764,11 @@ void MovementAction::UpdateMovementState()
|
|||||||
{
|
{
|
||||||
if (bot->Unit::IsInWater() || bot->Unit::IsUnderWater())
|
if (bot->Unit::IsInWater() || bot->Unit::IsUnderWater())
|
||||||
{
|
{
|
||||||
bot->m_movementInfo.AddMovementFlag(MOVEMENTFLAG_SWIMMING);
|
bot->SetSwim(true);
|
||||||
bot->UpdateSpeed(MOVE_SWIM, true);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bot->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_SWIMMING);
|
bot->SetSwim(false);
|
||||||
bot->UpdateSpeed(MOVE_SWIM, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bot->IsFlying())
|
if (bot->IsFlying())
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ WorldLocation ArrowFormation::GetLocationInternal()
|
|||||||
|
|
||||||
float x = master->GetPositionX() - masterUnit->GetX() + botUnit->GetX();
|
float x = master->GetPositionX() - masterUnit->GetX() + botUnit->GetX();
|
||||||
float y = master->GetPositionY() - masterUnit->GetY() + botUnit->GetY();
|
float y = master->GetPositionY() - masterUnit->GetY() + botUnit->GetY();
|
||||||
float z = master->GetPositionZ() + 5.0f;
|
float z = master->GetPositionZ();
|
||||||
|
|
||||||
float ground = master->GetMap()->GetHeight(x, y, z + 0.5f);
|
float ground = master->GetMap()->GetHeight(x, y, z + 0.5f);
|
||||||
if (ground <= INVALID_HEIGHT)
|
if (ground <= INVALID_HEIGHT)
|
||||||
|
|||||||
Reference in New Issue
Block a user