fix: Reverts to RunUO speeds, fixes direction glitching, adds movement speed interpolation (#1695)

> [!IMPORTANT]  
> Please read through these changes, as they changed certain expectations for how the internal AI thinking/movement work.
> Note that some mobs still don't have smooth movement on ClassicUO due to how the client handles animations/movement.

### Summary
- **Important Change**: Mobs will now move at a more regular pace. If the OnThink results in a move, but the cooldown would otherwise prevent the move, then the movement is scheduled on another timer.
- Added a 400ms delay to mobs turning to face a player to attack in order to avoid glitching between moving and turning.
- Reverted AI thinking speeds back to RunUO specific speeds.
- Reverted the AI thinking to moving conversion delays back to RunUO.
- For thinking speeds that are not exactly the predefined speeds from RunUO, there is a new calculation to determine the correct conversion to movement speed. This stops speeds like `0.35` from being faster than `0.3`

> [!NOTE]  
> **Developer Note**
> BaseAI.CheckMove() no longer contains the check for whether or not a mob is on movement cooldown. This function can now be overwritten without causing issues to figuring out that cooldown.
This commit is contained in:
Kamron Batman 2024-03-18 14:13:41 -07:00 • committed by GitHub
parent 9e37879f19
commit 3332fabc39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 354 additions and 223 deletions

View file

@ -10,11 +10,6 @@ public class MeleeAI : BaseAI
public override bool DoActionWander()
{
if (m_Mobile.Debug)
{
m_Mobile.DebugSay("I have no combatant");
}
if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
{
if (m_Mobile.Debug)
@ -27,6 +22,13 @@ public class MeleeAI : BaseAI
}
else
{
if (m_Mobile.Debug)
{
m_Mobile.DebugSay("I am wandering");
}
m_Mobile.Warmode = false;
base.DoActionWander();
}
@ -79,6 +81,7 @@ public class MeleeAI : BaseAI
if (!MoveTo(combatant, true, m_Mobile.RangeFight))
{
m_Mobile.Direction = m_Mobile.GetDirectionTo(combatant);
if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
{
if (m_Mobile.Debug)
@ -107,6 +110,10 @@ public class MeleeAI : BaseAI
m_Mobile.DebugSay($"I cannot find {combatant.Name}, so my guard is up");
}
}
else if (Core.TickCount - m_Mobile.LastMoveTime > 400)
{
m_Mobile.Direction = m_Mobile.GetDirectionTo(combatant);
}
if (!m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CanFlee)
{
@ -128,7 +135,6 @@ public class MeleeAI : BaseAI
}
}
m_Mobile.Direction = m_Mobile.GetDirectionTo(combatant);
if (m_Mobile.TriggerAbility(MonsterAbilityTrigger.CombatAction, combatant))
{
if (m_Mobile.Debug)