Skip to content

Rerwite is moving allowed logic - from common to rare checks, fix roo…#40

Merged
zhangbo8418 merged 1 commit intozhangbo8418:Testfrom
privatecore:fix-moving-allowed
Dec 11, 2025
Merged

Rerwite is moving allowed logic - from common to rare checks, fix roo…#40
zhangbo8418 merged 1 commit intozhangbo8418:Testfrom
privatecore:fix-moving-allowed

Conversation

@zhangbo8418
Copy link
Copy Markdown
Owner

@zhangbo8418 zhangbo8418 commented Dec 11, 2025

…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.

  • Movement logic:
    • IsMovingAllowed: Rewritten with ordered checks: UNIT_STATE_LOST_CONTROL, death/PLAYER_FLAGS_GHOST and SpiritOfRedemption, common CC (IsRooted/isFrozen/IsPolymorphed), controlled motion slot, travel states (IsInFlight, FLIGHT_MOTION_TYPE, IsBeingTeleported), and vehicle/charm (MOVEMENTFLAG_ONTRANSPORT, IsCharmed).
    • UpdateMovementState: Simplifies restriction detection to 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.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

// passengers are set to charmed by vehicle with CHARM_TYPE_VEHICLE.
if ((bot->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && !botAI->IsInVehicle(true)) ||
bot->IsCharmed())
return false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

@zhangbo8418 zhangbo8418 merged commit 39ff617 into zhangbo8418:Test Dec 11, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants