EntitySpawner sends spawn/removal messages to clients using EntityEvents.

EntityEvents and EntitySpawner used to work independently of each other, with separate IDs, and there was no guarantee that spawning and events would happen in the correct order. For example, a client could fail to read events during midround syncing because the entity has been removed, or read an event for an incorrect entity because the entity has been removed and the ID taken by some other entity.
This commit is contained in:
Regalis
2017-03-27 20:44:20 +03:00
parent 6a6486e270
commit 1a3c18c727
13 changed files with 121 additions and 196 deletions

View File

@@ -320,11 +320,6 @@ namespace Barotrauma
+ "/" + commands[1].ToLower() + ".xml", spawnPosition);
}
if (spawnedCharacter != null && GameMain.Server != null)
{
Entity.Spawner.AddToSpawnedList(spawnedCharacter);
}
break;
case "spawnitem":
if (commands.Length < 2) return;