From 428ae46bf485f7face6d94ae5d1ab3446b72b54f Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sat, 20 Jul 2024 17:51:29 -0700 Subject: [PATCH] fix: Fixes boat turning abandoning entities (#1878) --- Projects/Server/IEntity.cs | 4 ++-- Projects/UOContent/Multis/Boats/BaseBoat.cs | 18 +++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Projects/Server/IEntity.cs b/Projects/Server/IEntity.cs index 9187c7801..4ebc26562 100644 --- a/Projects/Server/IEntity.cs +++ b/Projects/Server/IEntity.cs @@ -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); @@ -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; diff --git a/Projects/UOContent/Multis/Boats/BaseBoat.cs b/Projects/UOContent/Multis/Boats/BaseBoat.cs index 55131dcd9..29746547f 100644 --- a/Projects/UOContent/Multis/Boats/BaseBoat.cs +++ b/Projects/UOContent/Multis/Boats/BaseBoat.cs @@ -2088,10 +2088,11 @@ 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.Create(); foreach (var e in GetMovingEntities()) { if (e == this) @@ -2099,15 +2100,18 @@ public bool SetFacing(Direction facing) 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)