Release 1.9.7.0 - Summer Update 2025
This commit is contained in:
@@ -37,7 +37,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public void ServerEventWrite(IWriteMessage msg, Client c, NetEntityEvent.IData extraData = null)
|
||||
{
|
||||
msg.WriteRangedSingle(Health, 0f, (float)MaxHealth, 8);
|
||||
msg.WriteRangedSingle(Health, 0f, (float)MaxWater, 8);
|
||||
if (TryExtractEventData(extraData, out EventData eventData))
|
||||
{
|
||||
int offset = eventData.Offset;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
base.ServerEventWrite(msg, c, extraData);
|
||||
|
||||
bool writeAttachData = attachable && body != null;
|
||||
bool writeAttachData = attachable && originalBody != null;
|
||||
msg.WriteBoolean(writeAttachData);
|
||||
if (!writeAttachData) { return; }
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
|
||||
msg.WriteBoolean(Attached);
|
||||
msg.WriteSingle(body.SimPosition.X);
|
||||
msg.WriteSingle(body.SimPosition.Y);
|
||||
msg.WriteSingle(originalBody.SimPosition.X);
|
||||
msg.WriteSingle(originalBody.SimPosition.Y);
|
||||
msg.WriteUInt16(item.Submarine?.ID ?? Entity.NullEntityID);
|
||||
msg.WriteUInt16(attacherId);
|
||||
}
|
||||
@@ -40,6 +40,9 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
Drop(false, null);
|
||||
item.SetTransform(simPosition, 0.0f, findNewHull: false);
|
||||
//don't find the new hull in SetTransform, because that'd also potentially change the submarine (teleport the item outside if it's attached outside)
|
||||
//instead just find the hull, so the item is considered to be in the right hull
|
||||
item.CurrentHull = Hull.FindHull(item.WorldPosition, item.CurrentHull);
|
||||
AttachToWall();
|
||||
OnUsed.Invoke(new ItemUseInfo(item, c.Character));
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#nullable enable
|
||||
using Barotrauma.Networking;
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
internal partial class PowerDistributor : PowerTransfer, IServerSerializable, IClientSerializable
|
||||
{
|
||||
#region Networking
|
||||
public void ServerEventRead(IReadMessage msg, Client c)
|
||||
{
|
||||
SharedEventRead(msg, out EventType eventType, out PowerGroup powerGroup, out string newName, out float newRatio);
|
||||
|
||||
if (item.CanClientAccess(c))
|
||||
{
|
||||
switch (eventType)
|
||||
{
|
||||
case EventType.NameChange:
|
||||
powerGroup.Name = newName;
|
||||
break;
|
||||
case EventType.RatioChange:
|
||||
powerGroup.SupplyRatio = newRatio;
|
||||
GameServer.Log($"{GameServer.CharacterLogName(c.Character)} changed supply ratio of power group \"{powerGroup.Name}\" to \"{powerGroup.SupplyRatio}\"", ServerLog.MessageType.ItemInteraction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
item.CreateServerEvent(this, new EventData(powerGroup, eventType));
|
||||
}
|
||||
|
||||
public void ServerEventWrite(IWriteMessage msg, Client c, NetEntityEvent.IData? extraData = null) => SharedEventWrite(msg, extraData);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user