Skip to main content

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.

Constructors​

MemberWhat it is
GenericCraftingRecipe()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

6 private and internal fields
MemberWhat it is
private static readonly Logger loggerNLog logger for this class.
private static Dictionary<uint, GenericCraftingRecipe> mappedResultStatic map from result prefab hash to the recipe that makes it.
private GenericCraftingPieceDefinition[] piecesBacking field for Pieces: every piece the station shows, with its source item, mesh, nails and level.
private uint resultHashBacking field for ResultHash, the prefab spawned when the project is done.
private SerializedTransform spawnOffsetBacking field for SpawnOffset, relative to the station's pieces parent.
private Glyph.Positioning[] uniqueGlyphsBacking field for UniqueGlyphs.

Properties​

MemberWhat 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​

MemberWhat 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
MemberWhat it is
private static void MapResults()Builds the static map from result prefab hash to recipe on first use of GetRecipe.

Used in​

Members of other types that take, return or hold a GenericCraftingRecipe: