From c71315f4daf790b9f881a9243b0011215119422e Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Mon, 23 Apr 2018 15:16:51 +0300 Subject: [PATCH] Fixed StatusEffects of child ItemComponents not being added to an item's StatusEffect lists --- .../BarotraumaShared/Source/Items/Item.cs | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Item.cs b/Barotrauma/BarotraumaShared/Source/Items/Item.cs index 45071b9fe..f7bb4f920 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Item.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Item.cs @@ -400,36 +400,39 @@ namespace Barotrauma components.Add(ic); if (ic is IDrawableComponent && ic.Drawable) drawableComponents.Add(ic as IDrawableComponent); - - if (ic.statusEffectLists == null) continue; - - if (statusEffectLists == null) - statusEffectLists = new Dictionary>(); - - //go through all the status effects of the component - //and add them to the corresponding statuseffect list - foreach (List componentEffectList in ic.statusEffectLists.Values) - { - - ActionType actionType = componentEffectList.First().type; - - List statusEffectList; - if (!statusEffectLists.TryGetValue(actionType, out statusEffectList)) - { - statusEffectList = new List(); - statusEffectLists.Add(actionType, statusEffectList); - } - - foreach (StatusEffect effect in componentEffectList) - { - statusEffectList.Add(effect); - } - } - + break; } } + foreach (ItemComponent ic in components) + { + if (ic.statusEffectLists == null) continue; + + if (statusEffectLists == null) + statusEffectLists = new Dictionary>(); + + //go through all the status effects of the component + //and add them to the corresponding statuseffect list + foreach (List componentEffectList in ic.statusEffectLists.Values) + { + + ActionType actionType = componentEffectList.First().type; + + List statusEffectList; + if (!statusEffectLists.TryGetValue(actionType, out statusEffectList)) + { + statusEffectList = new List(); + statusEffectLists.Add(actionType, statusEffectList); + } + + foreach (StatusEffect effect in componentEffectList) + { + statusEffectList.Add(effect); + } + } + } + if (body != null) { body.Submarine = submarine;