/// <summary> /// Creates a new crafting node for the crafting tree and links it to the calling node. /// </summary> /// <param name="techType">The TechType to be crafted.</param> public void AddCraftingNode(TechType techType) { Assert.AreNotEqual(TechType.None, techType, "Attempt to add TechType.None as a crafting node."); var craftNode = new ModCraftTreeCraft(techType); craftNode.LinkToParent(this); ChildNodes.Add(craftNode); }
/// <summary> /// <para>Creates a new crafting node for a modded item and links it to the calling node.</para> /// <para>If the modded item isn't present for the player, this call is safely ignored.</para> /// </summary> /// <param name="moddedTechTypeName">The internal name of the custom TechType to be crafted.</param> /// <remarks> /// If the player doesn't have the mod for this TechType installed, then nothing will happen. /// </remarks> public void AddModdedCraftingNode(string moddedTechTypeName) { EnumTypeCache cache = TechTypePatcher.cacheManager.RequestCacheForTypeName(moddedTechTypeName); if (cache != null) { var techType = (TechType)cache.Index; var craftNode = new ModCraftTreeCraft(techType); craftNode.LinkToParent(this); ChildNodes.Add(craftNode); } }