From 2ef7c2f9963c0213e4ae358a5867789e4f9373ec Mon Sep 17 00:00:00 2001 From: Regalis Date: Tue, 13 Dec 2016 23:14:41 +0200 Subject: [PATCH] Preventing ruins from spanning above the top of the level --- Subsurface/Source/Map/Levels/Level.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Subsurface/Source/Map/Levels/Level.cs b/Subsurface/Source/Map/Levels/Level.cs index 70a45bc83..62db9eb78 100644 --- a/Subsurface/Source/Map/Levels/Level.cs +++ b/Subsurface/Source/Map/Levels/Level.cs @@ -692,6 +692,8 @@ namespace Barotrauma int iter = 0; + ruinPos.Y = Math.Min(borders.Y + borders.Height - ruinSize.Y/2, ruinPos.Y); + while (mainPath.Any(p => Vector2.Distance(ruinPos, p.Center) < ruinRadius * 2.0f)) { Vector2 weighedPathPos = ruinPos; @@ -711,6 +713,7 @@ namespace Barotrauma //} weighedPathPos += moveAmount; + weighedPathPos.Y = Math.Min(borders.Y + borders.Height - ruinSize.Y / 2, weighedPathPos.Y); } ruinPos = weighedPathPos;