From e39ab10a71eeaf6792b0ed982e4a4244f38f61eb Mon Sep 17 00:00:00 2001 From: Regalis Date: Wed, 23 Nov 2016 17:52:23 +0200 Subject: [PATCH] Level generation fixes --- Subsurface/Source/Map/Levels/Level.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Subsurface/Source/Map/Levels/Level.cs b/Subsurface/Source/Map/Levels/Level.cs index e81bf75e3..a48a4ca3d 100644 --- a/Subsurface/Source/Map/Levels/Level.cs +++ b/Subsurface/Source/Map/Levels/Level.cs @@ -187,11 +187,11 @@ namespace Barotrauma minWidth = Math.Max(minWidth, 6500.0f); startPosition = new Vector2( - Rand.Range(minWidth * 2, minWidth * 4, false), + Rand.Range(minWidth, minWidth * 2, false), Rand.Range(borders.Height * 0.5f, borders.Height - minWidth * 2, false)); endPosition = new Vector2( - borders.Width - Rand.Range(minWidth * 2, minWidth * 4, false), + borders.Width - Rand.Range(minWidth, minWidth * 2, false), Rand.Range(borders.Height * 0.5f, borders.Height - minWidth * 2, false)); List pathNodes = new List(); @@ -211,8 +211,12 @@ namespace Barotrauma pathNodes.Add(new Vector2(endPosition.X, borders.Height)); - List> smallTunnels = new List>(); + if (pathNodes.Count <= 2) + { + pathNodes.Add((startPosition + endPosition) / 2); + } + List> smallTunnels = new List>(); for (int i = 0; i < generationParams.SmallTunnelCount; i++) { var tunnelStartPos = pathNodes[Rand.Range(2, pathNodes.Count - 2, false)]; @@ -421,7 +425,8 @@ namespace Barotrauma cellGrid[x, y].Add(cell); } - + + ruins = new List(); for (int i = 0; i(); ruins.Add(ruin); ruin.RuinShapes.Sort((shape1, shape2) => shape2.DistanceFromEntrance.CompareTo(shape1.DistanceFromEntrance));