GenericCraftingRecipe
A class in Root.Township, Alta.Crafting.
Recipe asset for a generic crafting station: the ghost pieces to fill and the prefab made at the end. Also a page basis, so it can go in a recipe book.
- Listed in Crafting and making
- Inherits or implements
SimpleHashedGeneralValue<GenericCraftingRecipe>,IPageBasis,ICraftingIngredientProvider - Derived types
GenericCraftingRecipe,GenericCraftingRecipePageProvider - Documented in Crafting
Constructors
| Member | What it is |
|---|---|
GenericCraftingRecipe() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
6 private and internal fields
| Member | What it is |
|---|---|
private static readonly Logger logger | NLog logger for this class. |
private static Dictionary<uint, GenericCraftingRecipe> mappedResult | Static map from result prefab hash to the recipe that makes it. |
private GenericCraftingPieceDefinition[] pieces | Backing field for Pieces: every piece the station shows, with its source item, mesh, nails and level. |
private uint resultHash | Backing field for ResultHash, the prefab spawned when the project is done. |
private SerializedTransform spawnOffset | Backing field for SpawnOffset, relative to the station's pieces parent. |
private Glyph.Positioning[] uniqueGlyphs | Backing field for UniqueGlyphs. |
Properties
| Member | What it is |
|---|---|
GenericCraftingPieceDefinition[] Pieces { get; } | The ghost pieces the recipe needs. |
Dictionary<uint, int> PrefabQuantities { get; } | How many pieces of each prefab the recipe needs, by prefab hash. Built fresh on each read. |
uint ResultHash { get; } | Hash of the prefab made when the recipe is finished. |
SerializedTransform SpawnOffset { get; } | Where the result spawns relative to the station. |
Glyph.Positioning[] UniqueGlyphs { get; } | Glyph positions drawn on the recipe's page. |
Methods
| Member | What it is |
|---|---|
PageData CreatePage(int preferredProvider) | Makes the recipe's page data with the generic crafting page provider. |
GenericCraftingPieceDefinition GetDefinition(uint hash) | The piece definition with the given hash, or null. |
uint GetHash() | The recipe's hash. |
int GetProviderID(int preferredProvider) | Identifier of the generic crafting page provider. |
static GenericCraftingRecipe GetRecipe(NetworkPrefab prefab) | Finds the recipe that makes a prefab. The lookup is built on first use. |
GenericCraftingProject InitializeProject(GenericCraftingStation station) | Starts a crafting project for this recipe at a station. |
1 private and internal method
Used in
Members of other types that take, return or hold a GenericCraftingRecipe:
GenericCraftingProject.GenericCraftingProject, GenericCraftingProject.Recipe, GenericCraftingStation.CheckPageForRecipe, GenericCraftingStation.LoadRecipe, GenericCraftingStationData.recipe, IProject.Recipe, GenericCraftingRecipePageProvider.GeneratePage, GenericCraftingRecipePageProvider.testRecipe.