FillNetworkData uses NetBuffer instead of OutgoingMessage
This commit is contained in:
@@ -355,7 +355,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public override bool FillNetworkData(NetworkEventType type, NetOutgoingMessage message, object data)
|
||||
public override bool FillNetworkData(NetworkEventType type, NetBuffer message, object data)
|
||||
{
|
||||
for (int i = 0; i < 5; i++ )
|
||||
{
|
||||
@@ -371,7 +371,7 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message)
|
||||
public override void ReadNetworkData(NetworkEventType type, NetBuffer message)
|
||||
{
|
||||
for (int i = 0; i<5; i++)
|
||||
{
|
||||
|
||||
@@ -263,13 +263,13 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
message.Write(item.SimPosition.X);
|
||||
message.Write(item.SimPosition.Y);
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
Vector2 newPos = Vector2.Zero;
|
||||
|
||||
|
||||
@@ -701,11 +701,11 @@ namespace Barotrauma.Items.Components
|
||||
return ic;
|
||||
}
|
||||
|
||||
public virtual void FillNetworkData(NetworkEventType type, NetOutgoingMessage message)
|
||||
public virtual void FillNetworkData(NetworkEventType type, NetBuffer message)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void ReadNetworkData(NetworkEventType type, NetIncomingMessage message)
|
||||
public virtual void ReadNetworkData(NetworkEventType type, NetBuffer message)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,14 +166,14 @@ namespace Barotrauma.Items.Components
|
||||
if (!IsActive) currPowerConsumption = 0.0f;
|
||||
}
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
message.WriteRangedInteger(-10,10,(int)(flowPercentage/10.0f));
|
||||
message.Write(IsActive);
|
||||
message.WritePadBits();
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
float newFlow = 0.0f;
|
||||
bool newActive;
|
||||
|
||||
@@ -296,12 +296,12 @@ namespace Barotrauma.Items.Components
|
||||
spriteBatch.DrawString(GUI.SmallFont, (int)(dist / 80.0f) + " m", new Vector2(markerPos.X + 10, markerPos.Y + 15), Color.LightGreen);
|
||||
}
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
message.Write(IsActive);
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -423,7 +423,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void FillNetworkData(NetworkEventType type, NetOutgoingMessage message)
|
||||
public override void FillNetworkData(NetworkEventType type, NetBuffer message)
|
||||
{
|
||||
message.Write(autoTemp);
|
||||
message.WriteRangedSingle(temperature, 0.0f, 10000.0f, 16);
|
||||
@@ -433,7 +433,7 @@ namespace Barotrauma.Items.Components
|
||||
message.WriteRangedSingle(fissionRate, 0.0f, 100.0f, 8);
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message)
|
||||
public override void ReadNetworkData(NetworkEventType type, NetBuffer message)
|
||||
{
|
||||
bool newAutoTemp;
|
||||
float newTemperature, newShutDownTemp;
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
message.Write(targetVelocity.X);
|
||||
message.Write(targetVelocity.Y);
|
||||
@@ -217,7 +217,7 @@ namespace Barotrauma.Items.Components
|
||||
message.Write(autoPilot);
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
Vector2 newTargetVelocity = Vector2.Zero;
|
||||
bool newAutoPilot = false;
|
||||
|
||||
@@ -196,13 +196,13 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
message.WriteRangedSingle(MathHelper.Clamp(rechargeSpeed/MaxRechargeSpeed, 0.0f, 1.0f), 0.0f, 1.0f, 8);
|
||||
message.WriteRangedSingle(MathHelper.Clamp(charge/capacity,0.0f, 1.0f), 0.0f, 1.0f, 8);
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
float newRechargeSpeed = 0f;
|
||||
float newCharge = 0.0f;
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace Barotrauma.Items.Components
|
||||
base.Remove();
|
||||
}
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
foreach (Connection c in connections)
|
||||
{
|
||||
@@ -137,7 +137,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("connectionpanel update");
|
||||
foreach (Connection c in connections)
|
||||
|
||||
@@ -428,7 +428,7 @@ namespace Barotrauma.Items.Components
|
||||
base.Remove();
|
||||
}
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
message.Write((byte)Math.Min(Nodes.Count, 10));
|
||||
for (int i = 0; i < Math.Min(Nodes.Count,10); i++)
|
||||
@@ -438,7 +438,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
Nodes.Clear();
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ namespace Barotrauma
|
||||
spriteBatch.DrawString(GUI.Font, (int)item.Condition + " %", new Vector2(rect.X + rect.Width / 2, rect.Y + rect.Height / 2), Color.Red);
|
||||
}
|
||||
|
||||
public virtual bool FillNetworkData(NetworkEventType type, NetOutgoingMessage message, object data)
|
||||
public virtual bool FillNetworkData(NetworkEventType type, NetBuffer message, object data)
|
||||
{
|
||||
for (int i = 0; i<capacity; i++)
|
||||
{
|
||||
@@ -306,7 +306,7 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void ReadNetworkData(NetworkEventType type, NetIncomingMessage message)
|
||||
public virtual void ReadNetworkData(NetworkEventType type, NetBuffer message)
|
||||
{
|
||||
List<ushort> newItemIDs = new List<ushort>();
|
||||
|
||||
|
||||
@@ -1223,7 +1223,7 @@ namespace Barotrauma
|
||||
NetworkEventType.ImportantComponentUpdate : NetworkEventType.ComponentUpdate, ID, isClient, index);
|
||||
}
|
||||
|
||||
public override bool FillNetworkData(NetworkEventType type, NetOutgoingMessage message, object data)
|
||||
public override bool FillNetworkData(NetworkEventType type, NetBuffer message, object data)
|
||||
{
|
||||
message.Write((byte)MathHelper.Clamp(condition*2.55f,0.0f,255.0f));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user