Unstable 1.8.4.0

This commit is contained in:
Markus Isberg
2025-03-12 12:56:27 +00:00
parent a4c3e868e4
commit a4a3427e4e
627 changed files with 29860 additions and 10018 deletions
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
using System;
using System.Collections.Generic;
@@ -82,8 +82,13 @@ namespace Barotrauma.Items.Components
public bool IsFull => ComponentContainer?.Inventory is { } inventory && inventory.IsFull(true);
/// <summary>
/// Works the same way as the Locked property, but isn't persistent.
/// </summary>
public bool TemporarilyLocked;
[Editable, Serialize(false, IsPropertySaveable.Yes, description: "Locked circuit boxes can only be viewed and not interacted with.")]
public bool Locked { get; set; }
public bool Locked { get; private set; }
public CircuitBox(Item item, ContentXElement element) : base(item, element)
{
@@ -635,6 +640,18 @@ namespace Barotrauma.Items.Components
OnViewUpdateProjSpecific();
}
public void RemoveWire(Wire wireItem)
{
foreach (CircuitBoxWire wire in Wires.ToImmutableArray())
{
if (wire.BackingWire.TryUnwrap(out var backingWire) && backingWire == wireItem.Item)
{
RemoveWireCollectionUnsafe(wire);
}
}
OnViewUpdateProjSpecific();
}
private void RemoveWireCollectionUnsafe(CircuitBoxWire wire)
{
foreach (CircuitBoxOutputConnection output in Outputs)
@@ -756,6 +773,8 @@ namespace Barotrauma.Items.Components
_ => true
};
public bool IsLocked() => Locked || TemporarilyLocked;
public static Option<Item> GetApplicableResourcePlayerHas(ItemPrefab prefab, Character? character)
{
if (character is null) { return Option.None; }