WIP network message validation
This commit is contained in:
@@ -188,8 +188,19 @@ namespace Subsurface.Items.Components
|
||||
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
|
||||
{
|
||||
flowPercentage = message.ReadFloat();
|
||||
isActive = message.ReadBoolean();
|
||||
float newFlow = 0.0f;
|
||||
bool newActive;
|
||||
|
||||
try
|
||||
{
|
||||
newFlow = MathHelper.Clamp(message.ReadFloat(), -100.0f, 100.0f);
|
||||
newActive = message.ReadBoolean();
|
||||
}
|
||||
|
||||
catch { return; }
|
||||
|
||||
flowPercentage = newFlow;
|
||||
isActive = newActive;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,12 +393,28 @@ namespace Subsurface.Items.Components
|
||||
|
||||
public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message)
|
||||
{
|
||||
autoTemp = message.ReadBoolean();
|
||||
temperature = message.ReadFloat();
|
||||
shutDownTemp = message.ReadFloat();
|
||||
bool newAutoTemp;
|
||||
float newTemperature, newShutDownTemp;
|
||||
float newCoolingRate, newFissionRate;
|
||||
|
||||
coolingRate = message.ReadFloat();
|
||||
fissionRate = message.ReadFloat();
|
||||
try
|
||||
{
|
||||
newAutoTemp = message.ReadBoolean();
|
||||
newTemperature = message.ReadFloat();
|
||||
newShutDownTemp = message.ReadFloat();
|
||||
|
||||
newCoolingRate = message.ReadFloat();
|
||||
newFissionRate = message.ReadFloat();
|
||||
}
|
||||
|
||||
catch { return; }
|
||||
|
||||
autoTemp = newAutoTemp;
|
||||
Temperature = newTemperature;
|
||||
shutDownTemp = newShutDownTemp;
|
||||
|
||||
CoolingRate = newCoolingRate;
|
||||
FissionRate = newFissionRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user