Fixed clients not getting notified when a character is spawned midround by a repeating MonsterEvent (eventually causing them to be kicked out because of desync).

Closes #59
This commit is contained in:
Joonas Rikkonen
2017-12-03 15:32:51 +02:00
parent f0225e4312
commit b36d3fc70e

View File

@@ -73,14 +73,14 @@ namespace Barotrauma
{
base.Init();
monsters = SpawnMonsters(Rand.Range(minAmount, maxAmount, Rand.RandSync.Server));
monsters = SpawnMonsters(Rand.Range(minAmount, maxAmount, Rand.RandSync.Server), false);
if (GameSettings.VerboseLogging)
{
DebugConsole.NewMessage("Initialized MonsterEvent (" + monsters[0]?.SpeciesName + " x" + monsters.Length + ")", Color.White);
}
}
private Character[] SpawnMonsters(int amount)
private Character[] SpawnMonsters(int amount, bool createNetworkEvent)
{
if (disallowed) return null;
@@ -101,7 +101,7 @@ namespace Barotrauma
{
spawnPos.X += Rand.Range(-0.5f, 0.5f, Rand.RandSync.Server);
spawnPos.Y += Rand.Range(-0.5f, 0.5f, Rand.RandSync.Server);
monsters[i] = Character.Create(characterFile, spawnPos, null, GameMain.Client != null, true, false);
monsters[i] = Character.Create(characterFile, spawnPos, null, GameMain.Client != null, true, createNetworkEvent);
}
return monsters;
@@ -127,7 +127,7 @@ namespace Barotrauma
{
if (monsters[i] == null || monsters[i].Removed || monsters[i].IsDead)
{
monsters[i] = SpawnMonsters(1)[0];
monsters[i] = SpawnMonsters(1, true)[0];
}
}
}