- previous networkevent of an item isn't overridden if the event is for a different itemcomponent

- batteries are restored to full capacity and all items repaired when resetting the respawn shuttle
- some respawnmanager refactoring (characters/items arent created in WriteNetworkEvent anymore)
- syncing respawnmanager state with clients who join mid-round
- LOS is turned back on when respawning
This commit is contained in:
Regalis
2016-08-13 18:42:55 +03:00
parent aa2dbab579
commit fbe6c91d67
4 changed files with 136 additions and 72 deletions

View File

@@ -897,6 +897,11 @@ namespace Barotrauma.Networking
yield return new WaitForSeconds(0.1f);
SendRespawnManagerMsg(null, null, new List<NetConnection>() { sender.Connection });
yield return new WaitForSeconds(0.1f);
sender.inGame = true;
yield return CoroutineStatus.Success;
@@ -1266,14 +1271,16 @@ namespace Barotrauma.Networking
}
public void SendRespawnManagerMsg()
public void SendRespawnManagerMsg(List<Character> spawnedCharacters = null, List<Item> spawnedItems = null, List<NetConnection> recipients = null)
{
if (respawnManager == null) return;
NetOutgoingMessage msg = server.CreateMessage();
respawnManager.WriteNetworkEvent(msg);
msg.Write((byte)PacketTypes.Respawn);
SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
respawnManager.WriteNetworkEvent(msg, spawnedCharacters, spawnedItems);
SendMessage(msg, NetDeliveryMethod.ReliableUnordered, recipients);
}
private void DisconnectClient(NetConnection senderConnection, string msg = "", string targetmsg = "")