Console colors, begin RNG rework
This is gonna be a PAIN
This commit is contained in:
@@ -46,7 +46,7 @@ namespace Barotrauma.RuinGeneration
|
||||
{
|
||||
subRooms = new BTRoom[2];
|
||||
|
||||
if (Rand.Range(0.0f, 1.0f, false) < verticalProbability &&
|
||||
if (Rand.Range(0.0f, 1.0f, Rand.RandSync.Server) < verticalProbability &&
|
||||
rect.Width * minDivRatio >= minWidth)
|
||||
{
|
||||
SplitVertical(minDivRatio);
|
||||
@@ -65,7 +65,7 @@ namespace Barotrauma.RuinGeneration
|
||||
|
||||
private void SplitHorizontal(float minDivRatio)
|
||||
{
|
||||
float div = Rand.Range(minDivRatio, 1.0f - minDivRatio, false);
|
||||
float div = Rand.Range(minDivRatio, 1.0f - minDivRatio, Rand.RandSync.Server);
|
||||
subRooms[0] = new BTRoom(new Rectangle(rect.X, rect.Y, rect.Width, (int)(rect.Height * div)));
|
||||
subRooms[1] = new BTRoom(new Rectangle(rect.X, rect.Y + subRooms[0].rect.Height, rect.Width, rect.Height - subRooms[0].rect.Height));
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Barotrauma.RuinGeneration
|
||||
|
||||
private void SplitVertical(float minDivRatio)
|
||||
{
|
||||
float div = Rand.Range(minDivRatio, 1.0f - minDivRatio, false);
|
||||
float div = Rand.Range(minDivRatio, 1.0f - minDivRatio, Rand.RandSync.Server);
|
||||
subRooms[0] = new BTRoom(new Rectangle(rect.X, rect.Y, (int)(rect.Width * div), rect.Height));
|
||||
subRooms[1] = new BTRoom(new Rectangle(rect.X + subRooms[0].rect.Width, rect.Y, rect.Width - subRooms[0].rect.Width, rect.Height));
|
||||
}
|
||||
@@ -118,7 +118,7 @@ namespace Barotrauma.RuinGeneration
|
||||
{
|
||||
if (Adjacent != null && Corridor == null)
|
||||
{
|
||||
Corridor = new Corridor(this, Rand.Range(minWidth, maxWidth, false), corridors);
|
||||
Corridor = new Corridor(this, Rand.Range(minWidth, maxWidth, Rand.RandSync.Server), corridors);
|
||||
}
|
||||
|
||||
if (subRooms != null)
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Barotrauma.RuinGeneration
|
||||
int top = Math.Max(room1.Y, room2.Y);
|
||||
int bottom = Math.Min(room1.Bottom, room2.Bottom);
|
||||
|
||||
int yPos = Rand.Range(top, bottom - width, false);
|
||||
int yPos = Rand.Range(top, bottom - width, Rand.RandSync.Server);
|
||||
|
||||
rect = new Rectangle(left, yPos, right - left, width);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ namespace Barotrauma.RuinGeneration
|
||||
int top = Math.Min(room1.Bottom, room2.Bottom);
|
||||
int bottom = Math.Max(room1.Y, room2.Y);
|
||||
|
||||
int xPos = Rand.Range(left, right - width, false);
|
||||
int xPos = Rand.Range(left, right - width, Rand.RandSync.Server);
|
||||
|
||||
rect = new Rectangle(xPos, top, width, bottom - top);
|
||||
}
|
||||
@@ -146,8 +146,8 @@ namespace Barotrauma.RuinGeneration
|
||||
/// <returns></returns>
|
||||
private BTRoom[] GetSuitableLeafRooms(List<BTRoom> leaves1, List<BTRoom> leaves2, int width, bool isHorizontal)
|
||||
{
|
||||
int iOffset = Rand.Int(leaves1.Count, false);
|
||||
int jOffset = Rand.Int(leaves2.Count, false);
|
||||
int iOffset = Rand.Int(leaves1.Count, Rand.RandSync.Server);
|
||||
int jOffset = Rand.Int(leaves2.Count, Rand.RandSync.Server);
|
||||
|
||||
|
||||
for (int iCount = 0; iCount < leaves1.Count; iCount++)
|
||||
|
||||
@@ -202,9 +202,9 @@ namespace Barotrauma.RuinGeneration
|
||||
|
||||
//area = new Rectangle(area.X, area.Y - area.Height, area.Width, area.Height);
|
||||
|
||||
int iterations = Rand.Range(3, 4, false);
|
||||
int iterations = Rand.Range(3, 4, Rand.RandSync.Server);
|
||||
|
||||
float verticalProbability = Rand.Range(0.4f, 0.6f, false);
|
||||
float verticalProbability = Rand.Range(0.4f, 0.6f, Rand.RandSync.Server);
|
||||
|
||||
BTRoom baseRoom = new BTRoom(area);
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace Barotrauma.RuinGeneration
|
||||
{
|
||||
leaf.Scale
|
||||
(
|
||||
new Vector2(Rand.Range(0.5f, 0.9f, false), Rand.Range(0.5f, 0.9f, false))
|
||||
new Vector2(Rand.Range(0.5f, 0.9f, Rand.RandSync.Server), Rand.Range(0.5f, 0.9f, Rand.RandSync.Server))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ namespace Barotrauma.RuinGeneration
|
||||
wallType = RuinStructureType.CorridorWall;
|
||||
}
|
||||
//rooms further from the entrance are more likely to have hard-to-break walls
|
||||
else if (Rand.Range(0.0f, leaf.DistanceFromEntrance, false) > 1.5f)
|
||||
else if (Rand.Range(0.0f, leaf.DistanceFromEntrance, Rand.RandSync.Server) > 1.5f)
|
||||
{
|
||||
wallType = RuinStructureType.HeavyWall;
|
||||
}
|
||||
@@ -352,28 +352,28 @@ namespace Barotrauma.RuinGeneration
|
||||
{
|
||||
Alignment[] alignments = new Alignment[] { Alignment.Top, Alignment.Bottom, Alignment.Right, Alignment.Left, Alignment.Center };
|
||||
|
||||
var prop = RuinStructure.GetRandom(RuinStructureType.Prop, alignments[Rand.Int(alignments.Length, false)]);
|
||||
var prop = RuinStructure.GetRandom(RuinStructureType.Prop, alignments[Rand.Int(alignments.Length, Rand.RandSync.Server)]);
|
||||
|
||||
Vector2 size = (prop.Prefab is StructurePrefab) ? ((StructurePrefab)prop.Prefab).Size : Vector2.Zero;
|
||||
|
||||
var shape = shapes[Rand.Int(shapes.Count, false)];
|
||||
var shape = shapes[Rand.Int(shapes.Count, Rand.RandSync.Server)];
|
||||
|
||||
Vector2 position = shape.Rect.Center.ToVector2();
|
||||
if (prop.Alignment.HasFlag(Alignment.Top))
|
||||
{
|
||||
position = new Vector2(Rand.Range(shape.Rect.X+size.X, shape.Rect.Right - size.X, false), shape.Rect.Bottom - 64);
|
||||
position = new Vector2(Rand.Range(shape.Rect.X+size.X, shape.Rect.Right - size.X, Rand.RandSync.Server), shape.Rect.Bottom - 64);
|
||||
}
|
||||
else if (prop.Alignment.HasFlag(Alignment.Bottom))
|
||||
{
|
||||
position = new Vector2(Rand.Range(shape.Rect.X + size.X, shape.Rect.Right - size.X, false), shape.Rect.Top + 64);
|
||||
position = new Vector2(Rand.Range(shape.Rect.X + size.X, shape.Rect.Right - size.X, Rand.RandSync.Server), shape.Rect.Top + 64);
|
||||
}
|
||||
else if (prop.Alignment.HasFlag(Alignment.Right))
|
||||
{
|
||||
position = new Vector2(shape.Rect.Right - 64, Rand.Range(shape.Rect.Y + size.X, shape.Rect.Bottom - size.Y, false));
|
||||
position = new Vector2(shape.Rect.Right - 64, Rand.Range(shape.Rect.Y + size.X, shape.Rect.Bottom - size.Y, Rand.RandSync.Server));
|
||||
}
|
||||
else if (prop.Alignment.HasFlag(Alignment.Left))
|
||||
{
|
||||
position = new Vector2(shape.Rect.X + 64, Rand.Range(shape.Rect.Y + size.X, shape.Rect.Bottom - size.Y, false));
|
||||
position = new Vector2(shape.Rect.X + 64, Rand.Range(shape.Rect.Y + size.X, shape.Rect.Bottom - size.Y, Rand.RandSync.Server));
|
||||
}
|
||||
|
||||
if (prop.Prefab is ItemPrefab)
|
||||
@@ -410,7 +410,7 @@ namespace Barotrauma.RuinGeneration
|
||||
Vector2 doorPos = corridor.Center;
|
||||
|
||||
//choose a random wall to place the door next to
|
||||
var wall = suitableWalls[Rand.Int(suitableWalls.Count, false)];
|
||||
var wall = suitableWalls[Rand.Int(suitableWalls.Count, Rand.RandSync.Server)];
|
||||
if (corridor.IsHorizontal)
|
||||
{
|
||||
doorPos.X = (wall.A.X + wall.B.X) / 2.0f;
|
||||
@@ -423,7 +423,7 @@ namespace Barotrauma.RuinGeneration
|
||||
var door = new Item(doorPrefab.Prefab as ItemPrefab, doorPos, null);
|
||||
door.MoveWithLevel = true;
|
||||
|
||||
door.GetComponent<Items.Components.Door>().IsOpen = Rand.Range(0.0f, 1.0f, false) < 0.8f;
|
||||
door.GetComponent<Items.Components.Door>().IsOpen = Rand.Range(0.0f, 1.0f, Rand.RandSync.Server) < 0.8f;
|
||||
|
||||
if (sensorPrefab == null || wirePrefab == null) continue;
|
||||
|
||||
@@ -431,8 +431,8 @@ namespace Barotrauma.RuinGeneration
|
||||
if (sensorRoom == null) continue;
|
||||
|
||||
var sensor = new Item(sensorPrefab, new Vector2(
|
||||
Rand.Range(sensorRoom.Rect.X, sensorRoom.Rect.Right, false),
|
||||
Rand.Range(sensorRoom.Rect.Y, sensorRoom.Rect.Bottom,false)), null);
|
||||
Rand.Range(sensorRoom.Rect.X, sensorRoom.Rect.Right, Rand.RandSync.Server),
|
||||
Rand.Range(sensorRoom.Rect.Y, sensorRoom.Rect.Bottom, Rand.RandSync.Server)), null);
|
||||
sensor.MoveWithLevel = true;
|
||||
|
||||
var wire = new Item(wirePrefab, sensorRoom.Center, null).GetComponent<Items.Components.Wire>();
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Barotrauma.RuinGeneration
|
||||
|
||||
int totalCommonness = matchingStructures.Sum(m => m.commonness);
|
||||
|
||||
int randomNumber = Rand.Int(totalCommonness + 1, false);
|
||||
int randomNumber = Rand.Int(totalCommonness + 1, Rand.RandSync.Server);
|
||||
|
||||
foreach (RuinStructure ruinStructure in matchingStructures)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user