diff --git a/Subsurface/Source/Map/MapEntity.cs b/Subsurface/Source/Map/MapEntity.cs index 6ec889944..51c2c3a09 100644 --- a/Subsurface/Source/Map/MapEntity.cs +++ b/Subsurface/Source/Map/MapEntity.cs @@ -464,7 +464,11 @@ namespace Barotrauma Vector2 moveAmount = Submarine.VectorToWorldGrid(cam.WorldViewCenter - center); selectedList = new List(clones); - selectedList.ForEach(c => c.Move(moveAmount)); + foreach (MapEntity clone in selectedList) + { + clone.Move(moveAmount); + clone.Submarine = Submarine.MainSub; + } } } diff --git a/Subsurface/Source/Map/SubmarineBody.cs b/Subsurface/Source/Map/SubmarineBody.cs index 9b4ab743b..876354fd6 100644 --- a/Subsurface/Source/Map/SubmarineBody.cs +++ b/Subsurface/Source/Map/SubmarineBody.cs @@ -160,17 +160,17 @@ namespace Barotrauma private List GenerateConvexHull() { - if (!Structure.WallList.Any()) + List subWalls = Structure.WallList.FindAll(wall => wall.Submarine == submarine); + + if (subWalls.Count == 0) { return new List { new Vector2(-1.0f, 1.0f), new Vector2(1.0f, 1.0f), new Vector2(0.0f, -1.0f) }; } List points = new List(); - foreach (Structure wall in Structure.WallList) + foreach (Structure wall in subWalls) { - if (wall.Submarine != submarine) continue; - points.Add(new Vector2(wall.Rect.X, wall.Rect.Y)); points.Add(new Vector2(wall.Rect.X + wall.Rect.Width, wall.Rect.Y)); points.Add(new Vector2(wall.Rect.X, wall.Rect.Y - wall.Rect.Height)); diff --git a/Subsurface/Source/Utils/MathUtils.cs b/Subsurface/Source/Utils/MathUtils.cs index 0aa6b5760..62f11fab1 100644 --- a/Subsurface/Source/Utils/MathUtils.cs +++ b/Subsurface/Source/Utils/MathUtils.cs @@ -381,6 +381,8 @@ namespace Barotrauma public static List GiftWrap(List points) { + if (points.Count == 0) return points; + Vector2 leftMost = points[0]; foreach (Vector2 point in points) {