v0.13.0.11

This commit is contained in:
Joonas Rikkonen
2021-04-22 17:33:08 +03:00
parent 0697d7fc64
commit 8bb31f2893
391 changed files with 17271 additions and 5949 deletions
@@ -34,6 +34,10 @@ namespace Barotrauma
public float ConditionLevel { get; set; } = 1;
public bool Equip { get; set; }
public bool RemoveEmpty { get; set; } = true;
public bool RemoveExisting { get; set; }
public bool MoveWholeStack { get; set; }
public AIObjectiveContainItem(Character character, Item item, ItemContainer container, AIObjectiveManager objectiveManager, float priorityModifier = 1)
: base(character, objectiveManager, priorityModifier)
@@ -102,47 +106,38 @@ namespace Barotrauma
}
if (character.CanInteractWith(container.Item, checkLinked: false))
{
if (RemoveEmpty && container.Inventory.AllItems.Any(it => it.Condition <= 0.0f))
if (RemoveExisting)
{
foreach (var emptyItem in container.Inventory.AllItemsMod)
{
if (emptyItem.Condition <= 0)
{
emptyItem.Drop(character);
}
}
HumanAIController.UnequipContainedItems(container.Item);
}
// Contain the item
if (ItemToContain.ParentInventory == character.Inventory)
else if (RemoveEmpty)
{
if (!container.Inventory.CanBePut(ItemToContain))
HumanAIController.UnequipEmptyItems(container.Item);
}
Inventory originalInventory = ItemToContain.ParentInventory;
var slots = originalInventory?.FindIndices(ItemToContain);
if (container.Inventory.TryPutItem(ItemToContain, null))
{
if (MoveWholeStack && slots != null)
{
Abandon = true;
}
else
{
character.Inventory.RemoveItem(ItemToContain);
if (container.Inventory.TryPutItem(ItemToContain, null))
foreach (int slot in slots)
{
IsCompleted = true;
}
else
{
ItemToContain.Drop(character);
Abandon = true;
foreach (Item item in originalInventory.GetItemsAt(slot).ToList())
{
container.Inventory.TryPutItem(item, null);
}
}
IsCompleted = true;
}
}
else
{
if (container.Combine(ItemToContain, character))
if (ItemToContain.ParentInventory == character.Inventory && character.Submarine == Submarine.MainSub)
{
IsCompleted = true;
}
else
{
Abandon = true;
ItemToContain.Drop(character);
}
Abandon = true;
}
}
else
@@ -151,7 +146,8 @@ namespace Barotrauma
{
DialogueIdentifier = "dialogcannotreachtarget",
TargetName = container.Item.Name,
abortCondition = () => !ItemToContain.IsOwnedBy(character)
abortCondition = obj => !ItemToContain.IsOwnedBy(character),
SpeakIfFails = !objectiveManager.IsCurrentOrder<AIObjectiveCleanupItems>()
},
onAbandon: () => Abandon = true,
onCompleted: () => RemoveSubObjective(ref goToObjective));