Fixed itemcomponents being loaded incorrectly if an item has multiple components of the same type.
This commit is contained in:
@@ -1763,13 +1763,14 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<ItemComponent> unloadedComponents = new List<ItemComponent>(item.components);
|
||||||
foreach (XElement subElement in element.Elements())
|
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;
|
if (component == null) continue;
|
||||||
|
|
||||||
component.Load(subElement);
|
component.Load(subElement);
|
||||||
|
unloadedComponents.Remove(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user