v1.4.4.1 (Blood in the Water Update)

This commit is contained in:
Regalis11
2024-04-24 18:09:05 +03:00
parent 89b91d1c3e
commit ff1b8951a7
397 changed files with 15250 additions and 6479 deletions
@@ -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"}");
}
}
}
}