- clients ignore lobby updates if they already received a more up-to-date one

- server tells clients their ID in the first lobby update
- clients take control of a spawned character if their ID matches the ownerID of the character (-> respawning works now)
This commit is contained in:
Regalis
2017-01-11 21:31:19 +02:00
parent dc3885a2da
commit 037bd09c2c
3 changed files with 53 additions and 45 deletions

View File

@@ -717,12 +717,17 @@ namespace Barotrauma.Networking
{
outmsg.Write(true);
outmsg.WritePadBits();
outmsg.Write(GameMain.NetLobbyScreen.LastUpdateID);
outmsg.Write(GameMain.NetLobbyScreen.GetServerName());
outmsg.Write(GameMain.NetLobbyScreen.ServerMessage.Text);
var subList = GameMain.NetLobbyScreen.GetSubList();
outmsg.Write(c.lastRecvGeneralUpdate < 1);
if (c.lastRecvGeneralUpdate < 1)
{
outmsg.Write(c.ID);
outmsg.Write((UInt16)subList.Count);
for (int i = 0; i < subList.Count; i++)
{
@@ -730,10 +735,6 @@ namespace Barotrauma.Networking
outmsg.Write(subList[i].MD5Hash.ToString());
}
}
else
{
outmsg.Write((UInt16)0);
}
outmsg.Write((GameMain.NetLobbyScreen.SubList.SelectedData as Submarine).Name);
outmsg.Write((GameMain.NetLobbyScreen.SubList.SelectedData as Submarine).MD5Hash.ToString());
outmsg.Write((GameMain.NetLobbyScreen.ShuttleList.SelectedData as Submarine).Name);
@@ -1009,9 +1010,7 @@ namespace Barotrauma.Networking
msg.Write(AllowRespawn && missionAllowRespawn);
msg.Write(Submarine.MainSubs[1] != null); //loadSecondSub
msg.Write(client.Character.ID);
server.SendMessage(msg, client.Connection, NetDeliveryMethod.ReliableUnordered);
}