fix: Consolidates and fixes movement/direction checks (#1861)

This commit is contained in:
Kamron Batman 2024-07-06 12:41:45 -07:00 • committed by GitHub
parent 06e05f2e52
commit e6bfc45228
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 146 additions and 320 deletions

View file

@ -176,23 +176,22 @@ namespace Server.Spells
return false;
}
public static void Turn(Mobile from, object to)
public static void Turn(Mobile from, IPoint3D to)
{
if (to is not IPoint3D target)
if (from == null)
{
return;
}
if (target is Item item)
var root = (to as Item)?.RootParent;
if (from != root)
{
if (item.RootParent != from)
{
from.Direction = from.GetDirectionTo(item.GetWorldLocation());
}
to = root;
}
else if (!from.Equals(target))
if (!from.Equals(to))
{
from.Direction = from.GetDirectionTo(target);
from.Direction = from.GetDirectionTo(to);
}
}