(f0d812055) v0.9.9.0

This commit is contained in:
Joonas Rikkonen
2020-04-23 19:19:37 +03:00
parent b647059b93
commit ac37a3b0e4
391 changed files with 15054 additions and 5420 deletions
@@ -52,6 +52,9 @@ namespace Barotrauma.Items.Components
set;
}
[Serialize(false, false)]
public bool AccessOnlyWhenBroken { get; set; }
[Serialize(5, false, description: "How many inventory slots the inventory has per row.")]
public int SlotsPerRow { get; set; }
@@ -197,10 +200,21 @@ namespace Barotrauma.Items.Components
}
}
public override bool HasRequiredItems(Character character, bool addMessage, string msg = null)
{
return (!AccessOnlyWhenBroken || Item.Condition <= 0) && base.HasRequiredItems(character, addMessage, msg);
}
public override bool Select(Character character)
{
if (item.Container != null) { return false; }
if (AccessOnlyWhenBroken)
{
if (item.Condition > 0)
{
return false;
}
}
if (AutoInteractWithContained && character.SelectedConstruction == null)
{
foreach (Item contained in Inventory.Items)
@@ -218,6 +232,13 @@ namespace Barotrauma.Items.Components
public override bool Pick(Character picker)
{
if (AccessOnlyWhenBroken)
{
if (item.Condition > 0)
{
return false;
}
}
if (AutoInteractWithContained)
{
foreach (Item contained in Inventory.Items)