From 7eed555522869fddab47719a94ae095c27514200 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Wed, 29 Aug 2018 14:50:44 +0300 Subject: [PATCH] Another docking port fix: EntityGrids are made slightly larger than the borders of the submarine, because docking ports may create gaps and hulls outside the borders, causing FindHull to fail and characters to get teleported outside the sub when from sub to another. Closes #551, hopefully for good now! --- Barotrauma/BarotraumaShared/Source/Map/EntityGrid.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaShared/Source/Map/EntityGrid.cs b/Barotrauma/BarotraumaShared/Source/Map/EntityGrid.cs index efd1088ef..5efcead74 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/EntityGrid.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/EntityGrid.cs @@ -16,7 +16,15 @@ namespace Barotrauma public EntityGrid(Submarine submarine, float cellSize) { - this.limits = submarine.Borders; + //make the grid slightly larger than the borders of the submarine, + //because docking ports may create gaps and hulls outside the borders + int padding = 128; + + this.limits = new Rectangle( + submarine.Borders.X - padding, + submarine.Borders.Y + padding, + submarine.Borders.Width + padding * 2, + submarine.Borders.Height + padding * 2); this.Submarine = submarine; this.cellSize = cellSize;