Build 1.1.4.0
This commit is contained in:
@@ -8,10 +8,12 @@ namespace Barotrauma.Items.Components
|
||||
private readonly struct EventData : IEventData
|
||||
{
|
||||
public readonly bool Launch;
|
||||
public readonly byte SpreadCounter;
|
||||
|
||||
public EventData(bool launch)
|
||||
public EventData(bool launch, byte spreadCounter = 0)
|
||||
{
|
||||
Launch = launch;
|
||||
SpreadCounter = spreadCounter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +34,7 @@ namespace Barotrauma.Items.Components
|
||||
msg.WriteSingle(launchPos.X);
|
||||
msg.WriteSingle(launchPos.Y);
|
||||
msg.WriteSingle(launchRot);
|
||||
msg.WriteByte(eventData.SpreadCounter);
|
||||
}
|
||||
|
||||
bool stuck = StickTarget != null && !item.Removed && !StickTargetRemoved();
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace Barotrauma.Items.Components
|
||||
//already connected, no need to do anything
|
||||
if (Connections[i].Wires.Contains(newWire)) { continue; }
|
||||
|
||||
newWire.Connect(Connections[i], true, true);
|
||||
newWire.TryConnect(Connections[i], true, true);
|
||||
Connections[i].TryAddLink(newWire);
|
||||
|
||||
var otherConnection = newWire.OtherConnection(Connections[i]);
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
string newOutputValue = msg.ReadString();
|
||||
|
||||
if (item.CanClientAccess(c))
|
||||
if (item.CanClientAccess(c) && !Readonly)
|
||||
{
|
||||
if (newOutputValue.Length > MaxMessageLength)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using Barotrauma.Networking;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Barotrauma.Extensions;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -135,6 +136,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
EnsureItemsInBothHands(c.Character);
|
||||
|
||||
CreateNetworkEvent();
|
||||
foreach (Inventory prevInventory in prevItemInventories.Distinct())
|
||||
{
|
||||
@@ -174,6 +177,29 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private void EnsureItemsInBothHands(Character character)
|
||||
{
|
||||
if (this is not CharacterInventory charInv) { return; }
|
||||
|
||||
int leftHandSlot = charInv.FindLimbSlot(InvSlotType.LeftHand),
|
||||
rightHandSlot = charInv.FindLimbSlot(InvSlotType.RightHand);
|
||||
|
||||
TryPutInOppositeHandSlot(rightHandSlot, leftHandSlot);
|
||||
TryPutInOppositeHandSlot(leftHandSlot, rightHandSlot);
|
||||
|
||||
void TryPutInOppositeHandSlot(int originalSlot, int otherHandSlot)
|
||||
{
|
||||
const InvSlotType bothHandSlot = InvSlotType.LeftHand | InvSlotType.RightHand;
|
||||
|
||||
foreach (Item it in slots[originalSlot].Items)
|
||||
{
|
||||
if (it.AllowedSlots.None(static s => s.HasFlag(bothHandSlot)) || slots[otherHandSlot].Contains(it)) { continue; }
|
||||
|
||||
TryPutItem(it, otherHandSlot, true, true, character, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ServerEventWrite(IWriteMessage msg, Client c, NetEntityEvent.IData extraData = null)
|
||||
{
|
||||
SharedWrite(msg, extraData);
|
||||
|
||||
@@ -65,7 +65,8 @@ namespace Barotrauma
|
||||
msg.WriteUInt16(GameMain.Server.EntityEventManager.Events.Last()?.ID ?? (ushort)0);
|
||||
itemContainer.Inventory.ServerEventWrite(msg, c);
|
||||
break;
|
||||
case ItemStatusEventData _:
|
||||
case ItemStatusEventData statusEvent:
|
||||
msg.WriteBoolean(statusEvent.LoadingRound);
|
||||
msg.WriteSingle(condition);
|
||||
break;
|
||||
case AssignCampaignInteractionEventData _:
|
||||
@@ -253,6 +254,7 @@ namespace Barotrauma
|
||||
msg.WriteBoolean(hasIdCard);
|
||||
if (hasIdCard)
|
||||
{
|
||||
msg.WriteInt32(idCardComponent.SubmarineSpecificID);
|
||||
msg.WriteString(idCardComponent.OwnerName);
|
||||
msg.WriteString(idCardComponent.OwnerTags);
|
||||
msg.WriteByte((byte)Math.Max(0, idCardComponent.OwnerBeardIndex+1));
|
||||
|
||||
Reference in New Issue
Block a user