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
|
|
@ -545,11 +545,7 @@ namespace Server.Factions
|
|||
Action = ActionType.Combat;
|
||||
}
|
||||
|
||||
if (m_Mobile.CurrentSpeed != m_Mobile.ActiveSpeed)
|
||||
{
|
||||
m_Mobile.CurrentSpeed = m_Mobile.ActiveSpeed;
|
||||
}
|
||||
|
||||
m_Mobile.SetCurrentSpeedToActive();
|
||||
m_Guard.Warmode = true;
|
||||
|
||||
RunTo(toFollow);
|
||||
|
|
@ -561,11 +557,7 @@ namespace Server.Factions
|
|||
Action = ActionType.Wander;
|
||||
}
|
||||
|
||||
if (m_Mobile.CurrentSpeed != m_Mobile.PassiveSpeed)
|
||||
{
|
||||
m_Mobile.CurrentSpeed = m_Mobile.PassiveSpeed;
|
||||
}
|
||||
|
||||
m_Mobile.SetCurrentSpeedToPassive();
|
||||
m_Guard.Warmode = false;
|
||||
|
||||
WalkRandomInHome(2, 2, 1);
|
||||
|
|
|
|||
|
|
@ -186,35 +186,29 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
quester.ControlSlots = 0;
|
||||
quester.SetControlMaster(pm);
|
||||
|
||||
quester.ActiveSpeed = 0.1;
|
||||
quester.PassiveSpeed = 0.2;
|
||||
|
||||
quester.ControlOrder = OrderType.Follow;
|
||||
quester.ControlTarget = pm;
|
||||
|
||||
quester.CantWalk = false;
|
||||
quester.CurrentSpeed = 0.1;
|
||||
|
||||
quester.SetSpeed(0.1, 0.2, false);
|
||||
}
|
||||
|
||||
public static void EndFollow(BaseCreature quester)
|
||||
{
|
||||
quester.ActiveSpeed = 0.2;
|
||||
quester.PassiveSpeed = 1.0;
|
||||
|
||||
quester.ControlOrder = OrderType.None;
|
||||
quester.ControlTarget = null;
|
||||
|
||||
quester.CurrentSpeed = 1.0;
|
||||
|
||||
quester.SetControlMaster(null);
|
||||
|
||||
quester.SetSpeed(0.1, 0.2);
|
||||
|
||||
(quester as BaseEscortable)?.BeginDelete();
|
||||
}
|
||||
|
||||
public override void OnQuestAccepted()
|
||||
{
|
||||
var instance = Instance;
|
||||
var pm = instance.Player;
|
||||
var pm = Instance.Player;
|
||||
|
||||
pm.LastEscortTime = Core.Now;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
namespace Server
|
||||
{
|
||||
public delegate MoveResult MoveMethod(Direction d);
|
||||
public delegate MoveResult MoveMethod(Direction d, bool badStateOk);
|
||||
|
||||
public enum MoveResult
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace Server
|
|||
}
|
||||
|
||||
public MoveResult Move(Direction d) =>
|
||||
Mover?.Invoke(d) ?? (m_From.Move(d) ? MoveResult.Success : MoveResult.Blocked);
|
||||
Mover?.Invoke(d, true) ?? (m_From.Move(d) ? MoveResult.Success : MoveResult.Blocked);
|
||||
|
||||
public Point3D GetGoalLocation() => (Goal as Item)?.GetWorldLocation() ?? new Point3D(Goal);
|
||||
|
||||
|
|
@ -102,14 +102,14 @@ namespace Server
|
|||
|
||||
if (!(Enabled && m_Path.Success))
|
||||
{
|
||||
d = m_From.GetDirectionTo(goal);
|
||||
d = m_From.GetDirectionTo(goal, run);
|
||||
m_From.SetDirection(d);
|
||||
Move(d);
|
||||
|
||||
return Check(m_From.Location, goal, range);
|
||||
return Move(d) is MoveResult.Success or MoveResult.SuccessAutoTurn
|
||||
&& Check(m_From.Location, goal, range);
|
||||
}
|
||||
|
||||
d = m_From.GetDirectionTo(m_Next);
|
||||
d = m_From.GetDirectionTo(m_Next, run);
|
||||
m_From.SetDirection(d);
|
||||
var res = Move(d);
|
||||
|
||||
|
|
@ -127,9 +127,9 @@ namespace Server
|
|||
{
|
||||
d = m_From.GetDirectionTo(goal);
|
||||
m_From.SetDirection(d);
|
||||
Move(d);
|
||||
|
||||
return Check(m_From.Location, goal, range);
|
||||
return Move(d) is MoveResult.Success or MoveResult.SuccessAutoTurn
|
||||
&& Check(m_From.Location, goal, range);
|
||||
}
|
||||
|
||||
d = m_From.GetDirectionTo(m_Next);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue