Class PieceConfig
Configuration class for adding custom pieces.
Use this in a constructor of CustomPiece and Jötunn resolves the references to the game objects at runtime.
Use this in a constructor of CustomPiece and Jötunn resolves the references to the game objects at runtime.
Inherited Members
Namespace: Jotunn.Configs
Assembly: Jotunn.dll
Syntax
public class PieceConfig
Properties
| Name | Description |
|---|---|
| AllowedInDungeons | Can this piece be built in dungeons? Defaults to false. |
| Category | The name of the category this piece belongs to. If the given category can't be found, a new Piece.PieceCategory is created. Pieces of a custom category are shown under an own tag in the build menu, next to the vanilla tags defined by Usage. |
| CraftingStation | The name of the crafting station prefab which needs to be in close proximity to build this piece. |
| Description | The description of your piece. May be tokenized. |
| Enabled | Whether this piece is buildable or not. Defaults to true. |
| ExtendStation | The name of the crafting station prefab to which this piece will be an upgrade to. |
| Icon | Icon which is displayed in the crafting GUI. |
| Name | The name for your piece. May be tokenized. |
| PieceTable | The name of the piece table where this piece will be added. |
| Requirements | Array of RequirementConfigs for all crafting materials it takes to craft the recipe. |
| Usage | Hammer categories where this piece can be selected. See PieceUsages for valid values. If left empty, Jötunn will guess appropriate tags from the piece's category, components and name. |
Methods
| Name | Description |
|---|---|
| AddRequirement(RequirementConfig) | Appends a new RequirementConfig to the array of existing ones. If the requirement is null or is not valid (has not item name or amount set) nothing will be added. |
| AddRequirement(string, int, bool) | Appends a new RequirementConfig to the array of existing ones. If the item name is null or empty or the amount is less than 1 nothing will be added. |
| Apply(GameObject) | Apply this configs values to a piece GameObject. |
| FromJson(string) | Loads a single PieceConfig from a JSON string |
| GetRequirements() | Converts the RequirementConfigs to Valheim style Piece.Requirement array. |
| ListFromJson(string) | Loads a list of PieceConfigs from a JSON string |