From 421e77cc3e549a812ee18a7c1ec3f12f41536af0 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Mon, 7 May 2018 11:15:49 +0300 Subject: [PATCH] Fixed itemcomponents being loaded incorrectly if an item has multiple components of the same type. --- Barotrauma/BarotraumaShared/Source/Items/Item.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Item.cs b/Barotrauma/BarotraumaShared/Source/Items/Item.cs index f7bb4f920..21548bfcb 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Item.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Item.cs @@ -1763,13 +1763,14 @@ namespace Barotrauma } } + List unloadedComponents = new List(item.components); foreach (XElement subElement in element.Elements()) { - ItemComponent component = item.components.Find(x => x.Name == subElement.Name.ToString()); - + ItemComponent component = unloadedComponents.Find(x => x.Name == subElement.Name.ToString()); if (component == null) continue; component.Load(subElement); + unloadedComponents.Remove(component); } }