v1.4.4.1 (Blood in the Water Update)
This commit is contained in:
@@ -1,10 +1,22 @@
|
||||
using System;
|
||||
using Barotrauma.Networking;
|
||||
using Barotrauma.Networking;
|
||||
using System;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class Submarine
|
||||
{
|
||||
public readonly struct SetLayerEnabledEventData : NetEntityEvent.IData
|
||||
{
|
||||
public readonly Identifier Layer;
|
||||
public readonly bool Enabled;
|
||||
|
||||
public SetLayerEnabledEventData(Identifier layer, bool enabled)
|
||||
{
|
||||
Layer = layer;
|
||||
Enabled = enabled;
|
||||
}
|
||||
}
|
||||
|
||||
public void ServerWritePosition(ReadWriteMessage tempBuffer, Client c)
|
||||
{
|
||||
subBody.Body.ServerWrite(tempBuffer);
|
||||
@@ -12,7 +24,15 @@ namespace Barotrauma
|
||||
|
||||
public void ServerEventWrite(IWriteMessage msg, Client c, NetEntityEvent.IData extraData = null)
|
||||
{
|
||||
throw new Exception($"Error while writing a network event for the submarine \"{Info.Name} ({ID})\". Submarines are not even supposed to send events!");
|
||||
if (extraData is SetLayerEnabledEventData setLayerEnabledEventData)
|
||||
{
|
||||
msg.WriteIdentifier(setLayerEnabledEventData.Layer);
|
||||
msg.WriteBoolean(setLayerEnabledEventData.Enabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"Error while writing a network event for the submarine \"{Info.Name} ({ID})\". Unrecognized event data: {extraData?.GetType().Name ?? "null"}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user