Commit 5f697e8
authored
Rerwite is moving allowed logic + fix root flag heartbeat spam (mod-playerbots#1908)
Okay, what have been done:
1. Fix heartbeat spam for root flag: check against `MOVEMENTFLAG_ROOT`
flag (`IsRooted`) instead of `HasRootAura`.
2. Rewrite `IsMovingAllowed` - place checks from most common to the
rarest.
3. Remove unnecessary checks: `HasRootAura`, `HasConfuseAura`,
`HasStunAura` - handled by AuraEffects and set unit state flags
`UNIT_STATE_ROOT`, `UNIT_STATE_CONFUSED`, `UNIT_STATE_STUNNED` -
`UNIT_STATE_LOST_CONTROL` already handles confused and stunned (rooted
checked with `IsRooted` method).
4. Combine traveling state checks for taxi flights:
`UNIT_STATE_IN_FLIGHT` + MM flag `FLIGHT_MOTION_TYPE`.
5. Simplify check against being in vehicle: use
`MOVEMENTFLAG_ONTRANSPORT` as an indicator that the unit is in the
vehicle.
Also, update `UpdateMovementState` method with simplified checks and the
updated logic (common > rare).
This should fix issues:
mod-playerbots#1903 and
mod-playerbots#1902
NOTE: The `PlayerbotAI` class has a method `CanMove` with the same
checks, but this method is only used once in the code. We should decide
how to properly check if the bot can move or not:
1. Place all logic into `IsMovingAllowed` and drop `CanMove`.
2. Place all logic into `CanMove` and use it inside `IsMovingAllowed`.
3. Use them for different approaches:
- `CanMove`: simple checks (unit flags, CC state, death state, travel
state, vehicle state);
- `IsMovingAllowed`: everything from `CanMove` + MM flags checks (not
sure about rooted since it still checks for movement flags...).1 parent 934e73a commit 5f697e8
1 file changed
Lines changed: 27 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
946 | 946 | | |
947 | 947 | | |
948 | 948 | | |
949 | | - | |
950 | | - | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
951 | 953 | | |
952 | 954 | | |
953 | | - | |
954 | | - | |
955 | | - | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
956 | 961 | | |
957 | 962 | | |
| 963 | + | |
958 | 964 | | |
959 | | - | |
960 | 965 | | |
961 | | - | |
962 | 966 | | |
963 | | - | |
964 | | - | |
965 | | - | |
966 | | - | |
967 | | - | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
968 | 980 | | |
969 | 981 | | |
970 | 982 | | |
971 | 983 | | |
972 | 984 | | |
973 | 985 | | |
974 | 986 | | |
| 987 | + | |
| 988 | + | |
975 | 989 | | |
976 | | - | |
977 | | - | |
978 | | - | |
979 | | - | |
980 | | - | |
| 990 | + | |
981 | 991 | | |
982 | 992 | | |
983 | 993 | | |
| |||
0 commit comments