ItemRemover -> EntityRemover, clients reset spawner & remover when starting a new round

This commit is contained in:
Regalis
2016-10-12 20:46:47 +03:00
parent 60b36e020c
commit 170e1a0da8
12 changed files with 144 additions and 115 deletions

View File

@@ -599,10 +599,11 @@ namespace Barotrauma.Networking
case ClientNetObject.SYNC_IDS:
//TODO: might want to use a clever class for this
c.lastRecvGeneralUpdate = Math.Max(c.lastRecvGeneralUpdate, inc.ReadUInt32());
c.lastRecvChatMsgID = Math.Max(c.lastRecvChatMsgID, inc.ReadUInt32());
c.lastRecvEntitySpawnID = Math.Max(c.lastRecvEntitySpawnID, inc.ReadUInt32());
c.lastRecvGeneralUpdate = Math.Max(c.lastRecvGeneralUpdate, inc.ReadUInt32());
c.lastRecvChatMsgID = Math.Max(c.lastRecvChatMsgID, inc.ReadUInt32());
c.lastRecvEntitySpawnID = Math.Max(c.lastRecvEntitySpawnID, inc.ReadUInt32());
c.lastRecvEntityRemoveID = Math.Max(c.lastRecvEntityRemoveID, inc.ReadUInt32());
break;
case ClientNetObject.CHAT_MESSAGE:
ChatMessage.ServerRead(inc, c);
@@ -663,6 +664,14 @@ namespace Barotrauma.Networking
outmsg.WritePadBits();
}
if (Item.Remover.NetStateID > c.lastRecvEntityRemoveID)
{
outmsg.Write((byte)ServerNetObject.ENTITY_REMOVE);
Item.Remover.ServerWrite(outmsg, c);
outmsg.WritePadBits();
}
outmsg.Write((byte)ServerNetObject.END_OF_MESSAGE);
server.SendMessage(outmsg, c.Connection, NetDeliveryMethod.Unreliable);
}