v1.1.18.0 (Treacherous Tides Update)

This commit is contained in:
Regalis11
2023-10-19 19:28:43 +03:00
parent 34ffc520cc
commit df7e8f1625
21 changed files with 196 additions and 89 deletions
@@ -79,8 +79,11 @@ namespace Barotrauma
{
DebugConsole.ThrowError($"Error in event \"{ParentEvent.Prefab.Identifier}\". {nameof(CheckItemAction)} does't define either tags or identifiers of the item to check.");
}
checkPercentage = element.GetAttribute(nameof(RequiredConditionalMatchPercentage)) is not null;
if (checkPercentage && conditionals.None())
{
DebugConsole.ThrowError($"Error in event \"{ParentEvent.Prefab.Identifier}\". {nameof(CheckItemAction)} requires conditionals to be met on {requiredConditionalMatchPercentage}% of the targets, but there are no conditionals defined.");
}
if (Amount != 1 && checkPercentage)
{
DebugConsole.ThrowError($"Error in event \"{ParentEvent.Prefab.Identifier}\". Cannot define both '{Amount}' and '{RequiredConditionalMatchPercentage}' in {nameof(CheckItemAction)}.");
@@ -134,7 +137,8 @@ namespace Barotrauma
foreach (var target in targets)
{
if (target is not Item item) { continue; }
if (itemTags.Any(item.HasTag) || itemIdentifierSplit.Contains(item.Prefab.Identifier))
if (itemTags.Any(item.HasTag) || itemIdentifierSplit.Contains(item.Prefab.Identifier) ||
(itemTags.None() && itemIdentifierSplit.None() && conditionals.Any()))
{
if (ConditionalsMatch(item, character: null))
{
@@ -28,6 +28,9 @@ namespace Barotrauma
[Serialize(false, IsPropertySaveable.Yes)]
public bool ChooseRandom { get; set; }
[Serialize(false, IsPropertySaveable.Yes, description: "Should the event continue if the TagAction can't find any valid targets?")]
public bool ContinueIfNoTargetsFound { get; set; }
[Serialize(0.0f, IsPropertySaveable.Yes, description: "If larger than 0, the specified percentage of the matching targets are tagged. Between 0-100.")]
public float ChoosePercentage { get; set; }
@@ -279,7 +282,14 @@ namespace Barotrauma
}
}
isFinished = !targetNotFound;
if (ContinueIfNoTargetsFound)
{
isFinished = true;
}
else
{
isFinished = !targetNotFound;
}
}
public override string ToDebugString()