Fixed monster/artifact events being out of sync between the server and the clients

This commit is contained in:
Regalis
2016-10-25 18:58:56 +03:00
parent c33a4ba5e5
commit ac8edb5b2a
5 changed files with 10 additions and 10 deletions

View File

@@ -64,14 +64,14 @@ namespace Barotrauma
var wayPoints = WayPoint.WayPointList.FindAll(wp => wp.Submarine==null);
if (wayPoints.Any())
{
WayPoint wp = wayPoints[Rand.Int(wayPoints.Count)];
WayPoint wp = wayPoints[Rand.Int(wayPoints.Count, false)];
pos = new Vector2(wp.Rect.X, wp.Rect.Y);
pos += Rand.Vector(200.0f);
pos += Rand.Vector(200.0f, false);
}
else
{
pos = Rand.Vector(2000.0f);
pos = Rand.Vector(2000.0f, false);
}
}
else
@@ -80,9 +80,9 @@ namespace Barotrauma
}
var prefab = prefabs[Rand.Int(prefabs.Count)];
var prefab = prefabs[Rand.Int(prefabs.Count, false)];
int amount = Rand.Range(prefab.SwarmMin, prefab.SwarmMax);
int amount = Rand.Range(prefab.SwarmMin, prefab.SwarmMax, false);
List<BackgroundCreature> swarmMembers = new List<BackgroundCreature>();
for (int n = 0; n < amount; n++)

View File

@@ -53,7 +53,7 @@ namespace Barotrauma
return;
}
WayPoint cargoSpawnPos = WayPoint.GetRandom(SpawnType.Cargo, null, Submarine.MainSub);
WayPoint cargoSpawnPos = WayPoint.GetRandom(SpawnType.Cargo, null, Submarine.MainSub, true);
if (cargoSpawnPos==null)
{
DebugConsole.ThrowError("Couldn't spawn items for cargo mission, cargo spawnpoint not found");

View File

@@ -201,7 +201,7 @@ namespace Barotrauma
{
rect = rectangle;
OxygenPercentage = Rand.Range(90.0f, 100.0f, false);
OxygenPercentage = 100.0f;
fireSources = new List<FireSource>();

View File

@@ -636,7 +636,7 @@ namespace Barotrauma
if (!wayPoint2.linkedTo.Contains(this)) wayPoint2.linkedTo.Add(this);
}
public static WayPoint GetRandom(SpawnType spawnType = SpawnType.Human, Job assignedJob = null, Submarine sub = null)
public static WayPoint GetRandom(SpawnType spawnType = SpawnType.Human, Job assignedJob = null, Submarine sub = null, bool useSyncedRand = false)
{
List<WayPoint> wayPoints = new List<WayPoint>();
@@ -651,7 +651,7 @@ namespace Barotrauma
if (!wayPoints.Any()) return null;
return wayPoints[Rand.Int(wayPoints.Count(), false)];
return wayPoints[Rand.Int(wayPoints.Count, !useSyncedRand)];
}
public static WayPoint[] SelectCrewSpawnPoints(List<CharacterInfo> crew, Submarine submarine)

View File

@@ -976,7 +976,7 @@ namespace Barotrauma.Networking
var cargoRoom = cargoSpawnPos.CurrentHull;
Vector2 position = new Vector2(
cargoSpawnPos.Position.X + Rand.Range(-20.0f, 20.0f, false),
cargoSpawnPos.Position.X + Rand.Range(-20.0f, 20.0f),
cargoRoom.Rect.Y - cargoRoom.Rect.Height);
foreach (string s in extraCargo.Keys)