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:
parent
9e37879f19
commit
3332fabc39
20 changed files with 354 additions and 223 deletions
|
|
@ -4339,10 +4339,9 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
|||
if (m_NetState != null)
|
||||
{
|
||||
m_NetState._nextMovementTime += ComputeMovementSpeed(d);
|
||||
m_NetState.SendMovementAck(m_NetState.Sequence, this);
|
||||
}
|
||||
|
||||
m_NetState?.SendMovementAck(m_NetState.Sequence, this);
|
||||
|
||||
SetLocation(newLocation, false);
|
||||
SetDirection(d);
|
||||
|
||||
|
|
@ -7282,12 +7281,15 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
|||
box.Close();
|
||||
}
|
||||
|
||||
m_NetState?.ValidateAllTrades();
|
||||
|
||||
if (isTeleport && m_NetState != null && (!m_NetState.HighSeas || !NoMoveHS))
|
||||
if (m_NetState != null)
|
||||
{
|
||||
m_NetState.Sequence = 0;
|
||||
m_NetState.SendMobileUpdate(this);
|
||||
m_NetState.ValidateAllTrades();
|
||||
|
||||
if (isTeleport && (!m_NetState.HighSeas || !NoMoveHS))
|
||||
{
|
||||
m_NetState.Sequence = 0;
|
||||
m_NetState.SendMobileUpdate(this);
|
||||
}
|
||||
}
|
||||
|
||||
var map = m_Map;
|
||||
|
|
@ -7367,6 +7369,7 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
|||
|
||||
m.SendOPLPacketTo(ourState);
|
||||
}
|
||||
|
||||
foreach (var item in map.GetItemsInRange(newLocation, Core.GlobalMaxUpdateRange))
|
||||
{
|
||||
var range = item.GetUpdateRange(this);
|
||||
|
|
@ -8916,7 +8919,12 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
|||
};
|
||||
}
|
||||
|
||||
return ret | (run ? Direction.Running : 0);
|
||||
if (run)
|
||||
{
|
||||
ret |= Direction.Running;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue