- 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 Microsoft.Xna.Framework;
using Barotrauma.Networking;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Specialized;
@@ -7,15 +8,13 @@ using System.Xml.Linq;
namespace Barotrauma.Items.Components
{
class Pump : Powered
class Pump : Powered, IServerSerializable, IClientSerializable
{
private float flowPercentage;
private float maxFlow;
private float? targetLevel;
private float lastUpdate;
public Hull hull1;
private GUITickBox isActiveTickBox;
@@ -75,6 +74,15 @@ namespace Barotrauma.Items.Components
IsActive = !IsActive;
if (!IsActive) currPowerConsumption = 0.0f;
if (GameMain.Server != null)
{
item.CreateServerEvent(this);
}
else if (GameMain.Client != null)
{
item.CreateClientEvent(this);
}
return true;
};
@@ -83,6 +91,15 @@ namespace Barotrauma.Items.Components
{
FlowPercentage -= 10.0f;
if (GameMain.Server != null)
{
item.CreateServerEvent(this);
}
else if (GameMain.Client != null)
{
item.CreateClientEvent(this);
}
return true;
};
@@ -91,6 +108,15 @@ namespace Barotrauma.Items.Components
{
FlowPercentage += 10.0f;
if (GameMain.Server != null)
{
item.CreateServerEvent(this);
}
else if (GameMain.Client != null)
{
item.CreateClientEvent(this);
}
return true;
};
}