(23df6915f) Added: Possibility of having a status effect trigger if a requiredItem is missing
This commit is contained in:
@@ -1553,7 +1553,7 @@ namespace Barotrauma
|
||||
|
||||
public void Use(float deltaTime, Character character = null, Limb targetLimb = null)
|
||||
{
|
||||
if (RequireAimToUse && (character == null || !character.IsKeyDown(InputType.Aim)))
|
||||
if (RequireAimToUse && !character.IsKeyDown(InputType.Aim))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
public bool IsOptional { get; set; }
|
||||
|
||||
public bool MatchOnEmpty { get; set; }
|
||||
|
||||
public bool IgnoreInEditor { get; set; }
|
||||
|
||||
private string[] excludedIdentifiers;
|
||||
@@ -99,6 +100,11 @@ namespace Barotrauma
|
||||
var containedItems = parentItem.ContainedItems;
|
||||
if (containedItems == null) return false;
|
||||
|
||||
if (MatchOnEmpty && !containedItems.Any(ci => ci != null))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (Item contained in containedItems)
|
||||
{
|
||||
if (contained.Condition > 0.0f && MatchesItem(contained)) return true;
|
||||
@@ -222,6 +228,7 @@ namespace Barotrauma
|
||||
|
||||
ri.IsOptional = element.GetAttributeBool("optional", false);
|
||||
ri.IgnoreInEditor = element.GetAttributeBool("ignoreineditor", false);
|
||||
ri.MatchOnEmpty = element.GetAttributeBool("matchonempty", false);
|
||||
return ri;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,6 +424,7 @@ namespace Barotrauma
|
||||
public virtual bool HasRequiredConditions(List<ISerializableEntity> targets)
|
||||
{
|
||||
if (!propertyConditionals.Any()) return true;
|
||||
if (requiredItems.All(ri => ri.MatchOnEmpty) && targets.Count == 0) return true;
|
||||
switch (conditionalComparison)
|
||||
{
|
||||
case PropertyConditional.Comparison.Or:
|
||||
|
||||
Reference in New Issue
Block a user