(b6f451292) Moved crafting recipes from the fabricator xml to the xmls of the items. Makes it possible for modders to add new craftable items without having to modify the fabricators. Closes #1001

This commit is contained in:
Joonas Rikkonen
2019-04-01 22:51:37 +03:00
parent 508bd960be
commit 8b12f85f48
8 changed files with 260 additions and 188 deletions
@@ -773,20 +773,12 @@ namespace Barotrauma
commands.Add(new Command("checkcrafting", "checkcrafting: Checks item deconstruction & crafting recipes for inconsistencies.", (string[] args) =>
{
List<FabricableItem> fabricableItems = new List<FabricableItem>();
List<FabricationRecipe> fabricableItems = new List<FabricationRecipe>();
foreach (MapEntityPrefab mapEntityPrefab in MapEntityPrefab.List)
{
if (mapEntityPrefab is ItemPrefab itemPrefab)
{
var fabricatorElement = itemPrefab.ConfigElement.Element("Fabricator");
if (fabricatorElement == null) { continue; }
foreach (XElement element in fabricatorElement.Elements())
{
if (element.Name.ToString().ToLowerInvariant() != "fabricableitem") { continue; }
fabricableItems.Add(new FabricableItem(element));
}
fabricableItems.AddRange(itemPrefab.FabricationRecipes);
}
}
foreach (MapEntityPrefab mapEntityPrefab in MapEntityPrefab.List)
@@ -962,8 +954,6 @@ namespace Barotrauma
}
}
}
element.Value = lines[i];
i++;
}
}, isCheat: false));
#endif