Server sends ServerEntityEvents to clients, NetEntityEvents can contain an object array which will be passed to the serializable entity (now only used for ItemComponent indices)

This commit is contained in:
Regalis
2016-11-13 13:56:48 +02:00
parent c314b37029
commit 498c72c64a
24 changed files with 133 additions and 43 deletions
@@ -196,7 +196,7 @@ namespace Barotrauma.Items.Components
if (!IsActive) currPowerConsumption = 0.0f;
}
public override void ClientWrite(Lidgren.Network.NetBuffer msg)
public override void ClientWrite(Lidgren.Network.NetBuffer msg, object[] extraData = null)
{
//flowpercentage can only be adjusted at 10% intervals -> no need for more accuracy than this
msg.WriteRangedInteger(-10, 10, (int)(flowPercentage / 10.0f));
@@ -209,7 +209,7 @@ namespace Barotrauma.Items.Components
IsActive = msg.ReadBoolean();
}
public override void ServerWrite(Lidgren.Network.NetBuffer msg, Barotrauma.Networking.Client c)
public override void ServerWrite(Lidgren.Network.NetBuffer msg, Barotrauma.Networking.Client c, object[] extraData = null)
{
//flowpercentage can only be adjusted at 10% intervals -> no need for more accuracy than this
msg.WriteRangedInteger(-10, 10, (int)(flowPercentage / 10.0f));