Rerwite is moving allowed logic - from common to rare checks, fix roo…#40
Conversation
…t flag hertbeat spam
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| // passengers are set to charmed by vehicle with CHARM_TYPE_VEHICLE. | ||
| if ((bot->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && !botAI->IsInVehicle(true)) || | ||
| bot->IsCharmed()) | ||
| return false; |
There was a problem hiding this comment.
Bug: Transport movement wrongly blocked by vehicle check
The vehicle check uses MOVEMENTFLAG_ONTRANSPORT which is set for both vehicles AND transports (ships, zeppelins, elevators). Since botAI->IsInVehicle(true) returns false when on a transport (not a vehicle), this condition incorrectly blocks movement for bots traveling on boats/zeppelins. The original code used botAI->IsInVehicle() as the first check, which only triggers for actual vehicles, not transports.
| // passengers are set to charmed by vehicle with CHARM_TYPE_VEHICLE. | ||
| if ((bot->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && !botAI->IsInVehicle(true)) || | ||
| bot->IsCharmed()) | ||
| return false; |
There was a problem hiding this comment.
Bug: Transport movement wrongly blocked by vehicle check
The vehicle check uses MOVEMENTFLAG_ONTRANSPORT which is set for both vehicles AND transports (ships, zeppelins, elevators). Since botAI->IsInVehicle(true) returns false when on a transport (not a vehicle), this condition incorrectly blocks movement for bots traveling on boats/zeppelins. The original code used botAI->IsInVehicle() as the first check, which only triggers for actual vehicles, not transports.
…t flag hertbeat spam
Note
Reworks movement-allowed logic with prioritized state checks and adds explicit handling for control, CC, flight/teleport, and vehicle/charm; simplifies movement restriction detection.
UNIT_STATE_LOST_CONTROL, death/PLAYER_FLAGS_GHOSTandSpiritOfRedemption, common CC (IsRooted/isFrozen/IsPolymorphed), controlled motion slot, travel states (IsInFlight,FLIGHT_MOTION_TYPE,IsBeingTeleported), and vehicle/charm (MOVEMENTFLAG_ONTRANSPORT,IsCharmed).HasUnitState(UNIT_STATE_LOST_CONTROL),IsRooted,isFrozen,IsPolymorphed; avoids movement-flag updates while restricted.Written by Cursor Bugbot for commit acd1918. This will update automatically on new commits. Configure here.