fix: Consolidates and fixes movement/direction checks (#1861)
This commit is contained in:
parent
06e05f2e52
commit
e6bfc45228
11 changed files with 146 additions and 320 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue