Skip to content

Commit

Permalink
fix: Fixes boat turning abandoning entities (#1878)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman authored Jul 21, 2024
1 parent b4611ab commit 428ae46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Projects/Server/IEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Server;

public interface IEntity : IPoint3D, ISerializable
{
Point3D Location { get; }
Point3D Location { get; set; }
Map Map { get; }
void MoveToWorld(Point3D location, Map map);

Expand Down Expand Up @@ -53,7 +53,7 @@ public Entity(Serial serial, Point3D loc, Map map) : this(serial)

public Serial Serial { get; }

public Point3D Location { get; private set; }
public Point3D Location { get; set; }

public int X => Location.X;

Expand Down
18 changes: 11 additions & 7 deletions Projects/UOContent/Multis/Boats/BaseBoat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2088,26 +2088,30 @@ public bool SetFacing(Direction facing)

var xOffset = 0;
var yOffset = 0;
Movement.Movement.Offset(facing, ref xOffset, ref yOffset);
CalcMoves.Offset(facing, ref xOffset, ref yOffset);

var count = ((_facing - old) & 0x7) / 2;

using var queue = PooledRefQueue<IEntity>.Create();
foreach (var e in GetMovingEntities())
{
if (e == this)
{
continue;
}

if (e is Item item)
{
item.Location = Rotate(item.Location, count);
}
else if (e is Mobile m)
if (e is Mobile m)
{
m.Direction = (m.Direction - old + facing) & Direction.Mask;
m.Location = Rotate(m.Location, count);
}

queue.Enqueue(e);
}

while (queue.Count > 0)
{
var e = queue.Dequeue();
e.Location = Rotate(e.Location, count);
}

if (TillerMan != null)
Expand Down

0 comments on commit 428ae46

Please sign in to comment.