Artifacts are spread out better throughout the levels
This commit is contained in:
@@ -31,7 +31,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
protected override void Start()
|
protected override void Start()
|
||||||
{
|
{
|
||||||
Vector2 position = Level.Loaded.GetRandomItemPos(Level.PositionType.Cave, 30.0f);
|
Vector2 position = Level.Loaded.GetRandomItemPos(
|
||||||
|
Level.PositionType.Cave | Level.PositionType.MainPath | Level.PositionType.Ruin, 500.0f, 30.0f);
|
||||||
|
|
||||||
item = new Item(itemPrefab, position, null);
|
item = new Item(itemPrefab, position, null);
|
||||||
item.MoveWithLevel = true;
|
item.MoveWithLevel = true;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override void Start(Level level)
|
public override void Start(Level level)
|
||||||
{
|
{
|
||||||
Vector2 position = Level.Loaded.GetRandomItemPos(spawnPositionType, 30.0f);
|
Vector2 position = Level.Loaded.GetRandomItemPos(spawnPositionType, 100.0f, 30.0f);
|
||||||
|
|
||||||
item = new Item(itemPrefab, position, null);
|
item = new Item(itemPrefab, position, null);
|
||||||
item.MoveWithLevel = true;
|
item.MoveWithLevel = true;
|
||||||
|
|||||||
@@ -203,11 +203,6 @@ namespace Barotrauma
|
|||||||
pathNodes.Add(new Vector2(x, Rand.Range(pathBorders.Y, pathBorders.Bottom, false)));
|
pathNodes.Add(new Vector2(x, Rand.Range(pathBorders.Y, pathBorders.Bottom, false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 2; i < pathNodes.Count; i+=3 )
|
|
||||||
{
|
|
||||||
positionsOfInterest.Add(new InterestingPosition(pathNodes[i], PositionType.MainPath));
|
|
||||||
}
|
|
||||||
|
|
||||||
pathNodes.Add(endPosition);
|
pathNodes.Add(endPosition);
|
||||||
pathNodes.Add(new Vector2(endPosition.X, borders.Height));
|
pathNodes.Add(new Vector2(endPosition.X, borders.Height));
|
||||||
|
|
||||||
@@ -277,6 +272,12 @@ namespace Barotrauma
|
|||||||
List<VoronoiCell> mainPath = CaveGenerator.GeneratePath(pathNodes, cells, cellGrid, GridCellSize,
|
List<VoronoiCell> mainPath = CaveGenerator.GeneratePath(pathNodes, cells, cellGrid, GridCellSize,
|
||||||
new Rectangle(pathBorders.X, pathBorders.Y, pathBorders.Width, borders.Height), 0.3f, mirror);
|
new Rectangle(pathBorders.X, pathBorders.Y, pathBorders.Width, borders.Height), 0.3f, mirror);
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 2; i < mainPath.Count; i += 3)
|
||||||
|
{
|
||||||
|
positionsOfInterest.Add(new InterestingPosition(mainPath[i].Center, PositionType.MainPath));
|
||||||
|
}
|
||||||
|
|
||||||
List<VoronoiCell> pathCells = new List<VoronoiCell>(mainPath);
|
List<VoronoiCell> pathCells = new List<VoronoiCell>(mainPath);
|
||||||
|
|
||||||
EnlargeMainPath(pathCells, minWidth);
|
EnlargeMainPath(pathCells, minWidth);
|
||||||
@@ -734,7 +735,7 @@ namespace Barotrauma
|
|||||||
return newCells;
|
return newCells;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2 GetRandomItemPos(PositionType spawnPosType, float offsetFromWall = 10.0f)
|
public Vector2 GetRandomItemPos(PositionType spawnPosType, float randomSpread, float offsetFromWall = 10.0f)
|
||||||
{
|
{
|
||||||
if (!positionsOfInterest.Any()) return Size*0.5f;
|
if (!positionsOfInterest.Any()) return Size*0.5f;
|
||||||
|
|
||||||
@@ -746,6 +747,8 @@ namespace Barotrauma
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
Vector2 startPos = Level.Loaded.GetRandomInterestingPosition(true, spawnPosType);
|
Vector2 startPos = Level.Loaded.GetRandomInterestingPosition(true, spawnPosType);
|
||||||
|
|
||||||
|
startPos += Rand.Vector(Rand.Range(0.0f, randomSpread, false), false);
|
||||||
|
|
||||||
Vector2 endPos = startPos - Vector2.UnitY * Size.Y;
|
Vector2 endPos = startPos - Vector2.UnitY * Size.Y;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user