Sending NetEntityEvents from client to server, ItemComponent class doesn't implement the INetSerializable interfaces (only the derived classes do), reactor syncing

This commit is contained in:
Regalis
2016-11-13 19:34:23 +02:00
parent 724172fe7c
commit 3d234aef73
16 changed files with 146 additions and 59 deletions
+4 -3
View File
@@ -7,10 +7,11 @@ using FarseerPhysics.Factories;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Barotrauma.Lights;
using Barotrauma.Networking;
namespace Barotrauma.Items.Components
{
class Door : ItemComponent, IDrawableComponent
class Door : ItemComponent, IDrawableComponent, IServerSerializable
{
private Gap linkedGap;
@@ -493,13 +494,13 @@ namespace Barotrauma.Items.Components
}
}
public override void ServerWrite(Lidgren.Network.NetBuffer msg, Barotrauma.Networking.Client c, object[] extraData = null)
public void ServerWrite(Lidgren.Network.NetBuffer msg, Barotrauma.Networking.Client c, object[] extraData = null)
{
msg.Write(isOpen);
msg.WriteRangedSingle(stuck, 0.0f, 100.0f, 8);
}
public override void ClientRead(Lidgren.Network.NetIncomingMessage msg, float sendingTime)
public void ClientRead(Lidgren.Network.NetIncomingMessage msg, float sendingTime)
{
SetState(msg.ReadBoolean(), true);
Stuck = msg.ReadRangedSingle(0.0f, 100.0f, 8);