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

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Runtime.CompilerServices;
using ModernUO.Serialization;
using Server.Targeting;
using CalcMoves = Server.Movement.Movement;
namespace Server.Items;
@ -233,53 +234,7 @@ public abstract partial class BaseDoor : Item, ILockable, ITelekinesisable
int x = m.X;
int y = m.Y;
switch (m.Direction & Direction.Mask)
{
case Direction.North:
{
--y;
break;
}
case Direction.Right:
{
++x;
--y;
break;
}
case Direction.East:
{
++x;
break;
}
case Direction.Down:
{
++x;
++y;
break;
}
case Direction.South:
{
++y;
break;
}
case Direction.Left:
{
--x;
++y;
break;
}
case Direction.West:
{
--x;
break;
}
case Direction.Up:
{
--x;
--y;
break;
}
}
CalcMoves.Offset(m.Direction, ref x, ref y);
foreach (var item in m.Map.GetItemsAt(x, y))
{