Class ModCraftTreeRoot
The root node of a CraftTree. The whole tree starts here.
Build up your custom crafting tree from this root node using the AddCraftingNode and AddTabNode methods.
This tree will be automatically patched into the game. For more advanced usage, you can replace the default value of CraftTreeCreation with your own custom function.
This tree will be automatically patched into the game. For more advanced usage, you can replace the default value of CraftTreeCreation with your own custom function.
public class ModCraftTreeRoot : ModCraftTreeLinkingNode
- Inheritance
-
ModCraftTreeRoot
- Inherited Members
- Extension Methods
Fields
CraftTreeCreation
The craft tree creation function.
Default implementaion returns a new CraftTree instantiated with SchemeAsString and the root CraftNode. You can replace this function with your own to have more control of the crafting tree when it is being created.
Default implementaion returns a new CraftTree instantiated with SchemeAsString and the root CraftNode. You can replace this function with your own to have more control of the crafting tree when it is being created.
public Func<CraftTree> CraftTreeCreation
Field Value
- Func<CraftTree>
Methods
AddCraftNode(string, string)
Safely attempts to add a new crafting node to the custom crafting tree of this fabricator.
If the modded TechType is not found, the craft node will not be added.
public ModCraftTreeRoot AddCraftNode(string moddedTechType, string parentTabId = null)
Parameters
moddedTechType
string- The modded item to craft.
parentTabId
string- Optional. The parent tab of this craft node. When this value is null, the craft node will be added to the root of the craft tree.
Returns
AddCraftNode(TechType, string)
Adds a new crafting node to the custom crafting tree of this fabricator.
public ModCraftTreeRoot AddCraftNode(TechType techType, string parentTabId = null)
Parameters
techType
TechType- The item to craft.
parentTabId
string- Optional. The parent tab of this craft node. When this value is null, the craft node will be added to the root of the craft tree.
Returns
AddTabNode(string, string, Sprite, string, string)
Adds a new tab node to the custom crafting tree of this fabricator.
public ModCraftTreeRoot AddTabNode(string tabId, string displayText, Atlas.Sprite tabSprite, string language = "English", string parentTabId = null)
Parameters
tabId
string- The internal ID for the tab node.
displayText
string- The in-game text shown for the tab node. If null or empty, this will use the language line "{CraftTreeName}_{
tabId
}" instead. tabSprite
Atlas.Sprite- The sprite used for the tab node.
language
string- The language for the display name. Defaults to English.
parentTabId
string- Optional. The parent tab of this tab. When this value is null, the tab will be added to the root of the craft tree.
Returns
AddTabNode(string, string, Sprite, string, string)
Adds a new tab node to the custom crafting tree of this fabricator.
public ModCraftTreeRoot AddTabNode(string tabId, string displayText, Sprite tabSprite, string language = "English", string parentTabId = null)
Parameters
tabId
string- The internal ID for the tab node.
displayText
string- The in-game text shown for the tab node. If null or empty, this will use the language line "{CraftTreeName}_{
tabId
}" instead. tabSprite
Sprite- The sprite used for the tab node.
language
string- The language for the display name. Defaults to English.
parentTabId
string- Optional. The parent tab of this tab. When this value is null, the tab will be added to the root of the craft tree.
Returns
GetNode(params string[])
Gets the node at the specified path from the root.
public ModCraftTreeNode GetNode(params string[] stepsToNode)
Parameters
stepsToNode
string[]The steps to the target tab.
These must match the id value of the CraftNode in the crafting tree you're targeting.
Do not include "root" in this path.
Returns
- ModCraftTreeNode
- If the specified tab node is found, returns that ModCraftTreeNode; Otherwise, returns null.
GetTabNode(params string[])
Gets the tab node at the specified path from the root.
public ModCraftTreeTab GetTabNode(params string[] stepsToTab)
Parameters
stepsToTab
string[]The steps to the target tab.
These must match the id value of the CraftNode in the crafting tree you're targeting.
Do not include "root" in this path.
Returns
- ModCraftTreeTab
- If the specified tab node is found, returns that ModCraftTreeTab; Otherwise, returns null.