Fixed itemcomponents being loaded incorrectly if an item has multiple components of the same type.

This commit is contained in:
Joonas Rikkonen
2018-05-07 11:15:49 +03:00
parent 7dd4dca2ed
commit 421e77cc3e

View File

@@ -1763,13 +1763,14 @@ namespace Barotrauma
}
}
List<ItemComponent> unloadedComponents = new List<ItemComponent>(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);
}
}