The server keeps track of which ID a client is going to switch to when midround syncing is done, and switches the ID immediately when the client is in sync (instead of waiting for the client to report the new ID).
Fixes clients occasionally getting kicked out the moment they're in sync, because their latest received ID is still set to the ID of the last unique event and the server thinks they're requesting some old event that doesn't necessarily exist anymore. + added a debug command that creates a ton of entity events
This commit is contained in:
@@ -708,6 +708,39 @@ namespace Barotrauma
|
||||
|
||||
GameMain.Server.ShowNetStats = !GameMain.Server.ShowNetStats;
|
||||
break;
|
||||
#if DEBUG
|
||||
case "spamevents":
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
for (int i = 0; i<item.components.Count; i++)
|
||||
{
|
||||
if (item.components[i] is IServerSerializable)
|
||||
{
|
||||
GameMain.Server.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.ComponentState, i });
|
||||
}
|
||||
var itemContainer = item.GetComponent<ItemContainer>();
|
||||
if (itemContainer != null)
|
||||
{
|
||||
GameMain.Server.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.InventoryState });
|
||||
}
|
||||
|
||||
GameMain.Server.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.Status });
|
||||
|
||||
item.NeedsPositionUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Character c in Character.CharacterList)
|
||||
{
|
||||
GameMain.Server.CreateEntityEvent(c, new object[] { NetEntityEvent.Type.Status });
|
||||
}
|
||||
|
||||
foreach (Structure wall in Structure.WallList)
|
||||
{
|
||||
GameMain.Server.CreateEntityEvent(wall);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case "cleanbuild":
|
||||
GameMain.Config.MusicVolume = 0.5f;
|
||||
GameMain.Config.SoundVolume = 0.5f;
|
||||
|
||||
Reference in New Issue
Block a user