mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
Compare commits
No commits in common. "e1f5064c9df720d33bbe7a52525b44ee895e283b" and "6db44b5296b259de52618f05cb0b4adc2866d955" have entirely different histories.
e1f5064c9d
...
6db44b5296
@ -7,7 +7,7 @@ INSERT INTO `ai_playerbot_texts`
|
||||
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
||||
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
||||
VALUES (
|
||||
1743,
|
||||
1740,
|
||||
'bot_not_your_master',
|
||||
"You are not my master!",
|
||||
0, 0,
|
||||
@ -35,7 +35,7 @@ INSERT INTO `ai_playerbot_texts`
|
||||
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
||||
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
||||
VALUES (
|
||||
1744,
|
||||
1741,
|
||||
'bot_rndbot_no_logout',
|
||||
"You can't command me to logout!",
|
||||
0, 0,
|
||||
|
||||
@ -948,15 +948,14 @@ void MovementAction::UpdateMovementState()
|
||||
const auto liquidState = bot->GetLiquidData().Status;
|
||||
const float gZ = bot->GetMapWaterOrGroundLevel(bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ());
|
||||
const bool onGroundZ = bot->GetPositionZ() < gZ + 1.f;
|
||||
const bool wantsSwim = liquidState == LIQUID_MAP_IN_WATER || liquidState == LIQUID_MAP_UNDER_WATER;
|
||||
const bool wantsFly = bot->HasIncreaseMountedFlightSpeedAura() || bot->HasFlyAura();
|
||||
const bool canSwim = liquidState == LIQUID_MAP_IN_WATER || liquidState == LIQUID_MAP_UNDER_WATER;
|
||||
const bool canFly = bot->HasIncreaseMountedFlightSpeedAura() || bot->HasFlyAura();
|
||||
const bool canWaterWalk = bot->HasWaterWalkAura();
|
||||
const bool isMasterFlying = master ? master->HasUnitMovementFlag(MOVEMENTFLAG_FLYING) : true;
|
||||
const bool isMasterSwimming = master ? master->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) : true;
|
||||
const bool isFlying = bot->HasUnitMovementFlag(MOVEMENTFLAG_FLYING);
|
||||
const bool isSwimming = bot->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
|
||||
const bool isWaterWalking = bot->HasUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
||||
const bool hasGravityDisabled = bot->HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
||||
bool movementFlagsUpdated = false;
|
||||
|
||||
// handle water (fragile logic do not alter without testing every detail, animation and transition)
|
||||
@ -971,11 +970,11 @@ void MovementAction::UpdateMovementState()
|
||||
else if ((!canWaterWalk || isMasterSwimming) && isWaterWalking)
|
||||
{
|
||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
||||
if (wantsSwim)
|
||||
if (canSwim)
|
||||
bot->SetSwim(true);
|
||||
movementFlagsUpdated = true;
|
||||
}
|
||||
else if (!wantsSwim && isSwimming)
|
||||
else if (!canSwim && isSwimming)
|
||||
{
|
||||
bot->SetSwim(false);
|
||||
movementFlagsUpdated = true;
|
||||
@ -991,21 +990,17 @@ void MovementAction::UpdateMovementState()
|
||||
}
|
||||
|
||||
// handle flying
|
||||
if (wantsFly && !isFlying && isMasterFlying)
|
||||
if ((canFly && !isFlying) && isMasterFlying)
|
||||
{
|
||||
bot->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
||||
bot->AddUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
||||
bot->AddUnitMovementFlag(MOVEMENTFLAG_FLYING);
|
||||
movementFlagsUpdated = true;
|
||||
|
||||
// required for transition and state monitoring.
|
||||
if (MotionMaster* mm = bot->GetMotionMaster())
|
||||
mm->MoveTakeoff(0, {bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ() + 1.F}, 0.F, true);
|
||||
}
|
||||
else if (!wantsFly && !isWaterWalking && (isFlying || hasGravityDisabled))
|
||||
{
|
||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING);
|
||||
movementFlagsUpdated = true;
|
||||
}
|
||||
else if (!isMasterFlying && isFlying && onGroundZ)
|
||||
else if ((!canFly && !isWaterWalking && isFlying) || (!isMasterFlying && isFlying && onGroundZ))
|
||||
{
|
||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user