MouldDefinition
A class in Root.Township, the global namespace.
A hashed asset describing a smithing mould: the item it casts, the ingots it takes, the cost and how its picture looks on the mould. Look one up by product with GetDefinition.
- Listed in Global namespace: M to O
- Inherits or implements
HashedGeneralValue<MouldDefinition> - Derived types
MouldDefinition,MouldDefinition.Create - Nested types
Create - Attributes
TypeConverter - Documented in Arguments and results, Smelting and forging
Constructors
| Member | What it is |
|---|---|
MouldDefinition() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
15 private and internal fields
| Member | What it is |
|---|---|
private ItemSet allowedMaterials | Backing field for AllowedMaterials. Must be ingots. |
private int cost | Backing field for Cost, shown as the input count on the mould. |
private Vector3 countNumberGraphicPosition | Backing field for CountNumberGraphicPosition. |
private Vector3 countXGraphicPosition | Backing field for CountXGraphicPosition. |
private static Dictionary<Item, MouldDefinition> definitions | Static lookup from product item to its mould definition. |
private static List<MouldDefinition> findable | Static list of findable moulds that GetRandom picks from. |
private float gap | Backing field for Gap. |
private Mesh graphic | Backing field for Graphic. |
private Vector3 graphicPosition | Backing field for GraphicPosition. |
private Vector3 graphicRotation | Backing field for GraphicRotation, as Euler angles. |
private float graphicScale | Old uniform scale. Unused; GraphicScale returns graphicScaleNew. |
private Vector3 graphicScaleNew | Backing field for GraphicScale. |
private bool isFindable | Backing field for IsFindable. Defaults to true. |
private Item product | Backing field for Product. OnValidate names the asset after it. |
private int quantityProduced | Backing field for QuantityProduced. Defaults to 1. |
Properties
| Member | What it is |
|---|---|
ItemSet AllowedMaterials { get; } | The ingot items that can be poured into this mould. |
int Cost { get; } | How many ingots one cast takes. The smelter also scales the fuel needed by it. |
Vector3 CountNumberGraphicPosition { get; } | Where the quantity number is drawn on the mould. |
Vector3 CountXGraphicPosition { get; } | Where the multiplication sign before the quantity is drawn on the mould. |
float Gap { get; } | A float set per mould. Nothing in the server build reads it. |
Mesh Graphic { get; } | Mesh of the picture shown on the mould. |
Vector3 GraphicPosition { get; } | Local position of the mould's picture. |
Vector3 GraphicRotation { get; } | Local rotation (Euler angles) of the mould's picture. |
Vector3 GraphicScale { get; } | Local scale of the mould's picture. |
bool IsFindable { get; } | Whether GetRandom can return this mould. |
Item Product { get; } | The item this mould casts. |
int QuantityProduced { get; } | How many items one cast makes. |
Methods
| Member | What it is |
|---|---|
static MouldDefinition GetDefinition(Item product) | Returns the mould whose product is the given item, or null. Builds the lookup on first use. |
static MouldDefinition GetRandom() | Returns a random mould marked findable. |
protected override void OnValidate() | Editor: renames the asset to the product's name plus " Mould". |
1 private and internal method
Used in
Members of other types that take, return or hold a MouldDefinition:
Smelter.CheckMould, SpawnCommandModule.MouldDefinitionInfo.op_Implicit, SpawnCommandModule.Moulds.DropPackage, SpawnCommandModule.Moulds.SpawnFull, MouldRestrictor.mouldDefinitions, Mould.definition, Mould.Definition, Mould.SetDefinition, MouldItemComponent.definition, MouldItemComponent.Definition, MouldSaveData.definition, MouldSaveData1.definition.