From 2c17675288d15f02351718665e405143bff5aff8 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Tue, 19 Mar 2019 15:06:48 +0200 Subject: [PATCH] 817c58e...af8a4af commit af8a4af10c665a1f539c008a9440b4f89df55fa5 Author: Joonas Rikkonen Date: Tue Mar 19 15:06:21 2019 +0200 Fixed default StatusEffect conditional comparison type back to OR. Using AND caused a variety of bugs, for example flares would not activate or oxygen tanks explode when on fire because the conditional would have to be true on all the components of the item, and the Item object itself. Closes #1307 --- .../Source/StatusEffects/StatusEffect.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaShared/Source/StatusEffects/StatusEffect.cs b/Barotrauma/BarotraumaShared/Source/StatusEffects/StatusEffect.cs index 610ea7ce3..f5b7c4323 100644 --- a/Barotrauma/BarotraumaShared/Source/StatusEffects/StatusEffect.cs +++ b/Barotrauma/BarotraumaShared/Source/StatusEffects/StatusEffect.cs @@ -107,7 +107,7 @@ namespace Barotrauma public string[] propertyNames; private object[] propertyEffects; - private PropertyConditional.Comparison conditionalComparison = PropertyConditional.Comparison.And; + private PropertyConditional.Comparison conditionalComparison = PropertyConditional.Comparison.Or; private List propertyConditionals; private bool setValue; @@ -465,6 +465,13 @@ namespace Barotrauma if (target == null || target.SerializableProperties == null) { continue; } foreach (PropertyConditional pc in propertyConditionals) { + if (!string.IsNullOrEmpty(pc.TargetItemComponentName)) + { + if (!(target is ItemComponent ic) || ic.GetType().ToString() != pc.TargetItemComponentName) + { + continue; + } + } if (pc.Matches(target)) { return true; } } } @@ -475,6 +482,13 @@ namespace Barotrauma if (target == null || target.SerializableProperties == null) { continue; } foreach (PropertyConditional pc in propertyConditionals) { + if (!string.IsNullOrEmpty(pc.TargetItemComponentName)) + { + if (!(target is ItemComponent ic) || ic.GetType().ToString() != pc.TargetItemComponentName) + { + continue; + } + } if (!pc.Matches(target)) { return false; } } }