- server doesn't create a new EntityEvent if there's a duplicate event waiting to be sent

- hull, radar, steering & pump syncing
This commit is contained in:
Regalis
2016-11-14 16:58:21 +02:00
parent 44d87613b9
commit 0c9a55e9e0
10 changed files with 166 additions and 51 deletions
@@ -1,4 +1,5 @@
using FarseerPhysics;
using Barotrauma.Networking;
using FarseerPhysics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
@@ -8,7 +9,7 @@ using Voronoi2;
namespace Barotrauma.Items.Components
{
class Radar : Powered
class Radar : Powered, IServerSerializable, IClientSerializable
{
private float range;
@@ -56,6 +57,14 @@ namespace Barotrauma.Items.Components
isActiveTickBox = new GUITickBox(new Rectangle(0, 0, 20, 20), "Sonar", Alignment.TopLeft, GuiFrame);
isActiveTickBox.OnSelected = (GUITickBox box) =>
{
if (GameMain.Server != null)
{
item.CreateServerEvent(this);
}
else if (GameMain.Client != null)
{
item.CreateClientEvent(this);
}
IsActive = box.Selected;
return true;
@@ -420,6 +429,8 @@ namespace Barotrauma.Items.Components
{
IsActive = msg.ReadBoolean();
isActiveTickBox.Selected = IsActive;
item.CreateServerEvent(this);
}
public void ServerWrite(Lidgren.Network.NetBuffer msg, Barotrauma.Networking.Client c, object[] extraData = null)