Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ModCraftTreeLinkingNode.cs #471

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions Nautilus/Crafting/ModCraftTreeLinkingNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public ModCraftTreeTab AddTabNode(string nameID, string displayText, Sprite spri
/// <summary>
/// Creates a new tab node for the crafting tree and links it to the calling node.
/// </summary>
/// <remarks>
/// Please note that this method will NOT set the language lines for the node and you must do it yourself.
/// </remarks>
/// <param name="nameID">The name/ID of this node.</param>
/// <returns>A new tab node linked to the root node and ready to use.</returns>
public ModCraftTreeTab AddTabNode(string nameID)
Expand Down Expand Up @@ -175,7 +178,6 @@ public void AddCraftingNode(IEnumerable<TechType> techTypes)
{
foreach (TechType tType in techTypes)
{
Assert.AreNotEqual(TechType.None, tType, "Attempt to add TechType.None as a crafting node.");
AddCraftingNode(tType);
}
}
Expand All @@ -190,12 +192,9 @@ public void AddCraftingNode(IEnumerable<TechType> techTypes)
/// </remarks>
public void AddModdedCraftingNode(string moddedTechTypeName)
{
if (EnumHandler.TryGetValue(moddedTechTypeName, out TechType techType))
{
ModCraftTreeCraft craftNode = new(techType);
craftNode.LinkToParent(this);

ChildNodes.Add(craftNode);
}
var techTypeFound = EnumHandler.TryGetValue(moddedTechTypeName, out TechType techType);
Assert.IsTrue(techTypeFound, $"Could not find {moddedTechTypeName} when trying to AddModdedCraftingNode!");

AddCraftingNode(techType);
}
}