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
+2 -5
View File
@@ -38,9 +38,7 @@ namespace Barotrauma.Networking
public UInt16 lastSentEntityEventID = 0;
public UInt16 lastRecvEntityEventID = 0;
public UInt16 lastRecvEntitySpawnID = 0;
public List<ChatMessage> chatMsgQueue = new List<ChatMessage>();
public UInt16 lastChatMsgQueueID;
public float ChatSpamSpeed;
@@ -76,8 +74,7 @@ namespace Barotrauma.Networking
lastRecvChatMsgID = ChatMessage.LastID;
lastRecvGeneralUpdate = 0;
lastRecvEntitySpawnID = 0;
lastRecvEntityEventID = 0;
UnreceivedEntityEventCount = 0;