v1.4.4.1 (Blood in the Water Update)

This commit is contained in:
Regalis11
2024-04-24 18:09:05 +03:00
parent 89b91d1c3e
commit ff1b8951a7
397 changed files with 15250 additions and 6479 deletions
@@ -3,6 +3,7 @@ using Barotrauma.Extensions;
using System.Linq;
using System.Collections.Generic;
using System.Collections.Immutable;
using System;
namespace Barotrauma
{
@@ -24,6 +25,12 @@ namespace Barotrauma
public bool CheckPathForEachItem { get; set; }
public bool RequireNonEmpty { get; set; }
public bool RequireAllItems { get; set; }
public bool RequireDivingSuitAdequate { get; set; }
/// <summary>
/// T1 = item to check, T2 = tag we're trying to find a suitable item for
/// </summary>
public Func<Item, Identifier, bool>? ItemFilter;
private readonly ImmutableArray<Identifier> gearTags;
private readonly ImmutableHashSet<Identifier> ignoredTags;
@@ -48,7 +55,8 @@ namespace Barotrauma
int count = gearTags.Count(t => t == tag);
AIObjectiveGetItem? getItem = null;
TryAddSubObjective(ref getItem, () =>
new AIObjectiveGetItem(character, tag, objectiveManager, Equip, CheckInventory && count <= 1)
{
var getItem = new AIObjectiveGetItem(character, tag, objectiveManager, Equip, CheckInventory && count <= 1)
{
AllowVariants = AllowVariants,
Wear = Wear,
@@ -58,29 +66,36 @@ namespace Barotrauma
CheckPathForEachItem = CheckPathForEachItem,
RequireNonEmpty = RequireNonEmpty,
ItemCount = count,
SpeakIfFails = RequireAllItems
},
onCompleted: () =>
SpeakIfFails = RequireAllItems,
};
if (ItemFilter != null)
{
var item = getItem?.TargetItem;
if (item?.IsOwnedBy(character) != null)
{
achievedItems.Add(item);
}
},
onAbandon: () =>
getItem.ItemFilter = (Item it) => ItemFilter(it, tag);
}
return getItem;
},
onCompleted: () =>
{
var item = getItem?.TargetItem;
if (item?.IsOwnedBy(character) != null)
{
var item = getItem?.TargetItem;
if (item != null)
{
achievedItems.Remove(item);
}
RemoveSubObjective(ref getItem);
if (RequireAllItems)
{
Abandon = true;
}
});
achievedItems.Add(item);
}
},
onAbandon: () =>
{
var item = getItem?.TargetItem;
if (item != null)
{
achievedItems.Remove(item);
}
RemoveSubObjective(ref getItem);
if (RequireAllItems)
{
Abandon = true;
}
});
}
subObjectivesCreated = true;
}