Hotfix after recent changes related to the refactoring of IsMovingAllowed (#1933)

Hotfix for the issue where bots can't enter/move on transports
(elevators, zeppelins, ships, etc.). Change the logic to determine if
bot is on a vehicle. According to the current implementation in
AzerothCore, `GetVehicle()` is the most common approach for this.
Additionally, other checks related to the vehicle: `GetBase`, `IsAlive`,
`GetVehicleInfo`, and `GetSeatForPassenger` -- are processed inside
`IsInVehicle`.

This should be more than enough to determine if the bot is on a vehicle
and can/cant control it.

Issue: https://github.com/mod-playerbots/mod-playerbots/issues/1927
This commit is contained in:
privatecore
2025-12-20 23:51:32 +01:00
committed by GitHub
parent f5c84ee7ff
commit cafbd4681e

View File

@@ -972,8 +972,7 @@ bool MovementAction::IsMovingAllowed()
// Vehicle state: is in the vehicle and can control it (rare, content-specific). // Vehicle state: is in the vehicle and can control it (rare, content-specific).
// We need to check charmed state AFTER vehicle one, cuz that's how it works: // We need to check charmed state AFTER vehicle one, cuz that's how it works:
// passengers are set to charmed by vehicle with CHARM_TYPE_VEHICLE. // passengers are set to charmed by vehicle with CHARM_TYPE_VEHICLE.
if ((bot->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && !botAI->IsInVehicle(true)) || if ((bot->GetVehicle() && !botAI->IsInVehicle(true)) || bot->IsCharmed())
bot->IsCharmed())
return false; return false;
return true; return true;