Skip to main content

MeltingModel

An abstract class in Root.Township, Alta.Blacksmithing.

Base for items that can be melted down in a smelter (ingots, forged parts). The smelter checks whether every counted heat point is hot enough, then adds IngotValue of the material.

Constructors​

MemberWhat it is
protected MeltingModel()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

6 private and internal fields
MemberWhat it is
private MeshFilter androidMeshFilterMesh filter used for the Android version of the model.
private HeatPointCollection heatPointCollectionHeat points checked by IsAtMeltingPoint. Found in children if not set.
private float ingotValueBacking value for IngotValue: how much of an ingot melting this gives (0.3 by default).
private bool istriggeringAbilitiesBacking field for IsTriggeringAbilities.
private MeshFilter mainMeshFilterMesh filter used for MeshBounds and FilterTransform. Found from a child ForgedModel if not set.
private MeltingModelModifier[] modifiersMelting modifiers initialised on the server and terminated when the model goes.

Properties​

MemberWhat it is
Transform FilterTransform { get; }Transform of the main mesh.
float IngotValue { get; }Amount of material it melts into, after yieldMultiplierFilter handlers. Default 0.3.
bool IsAtMeltingPoint { get; }True when every heat point counted for melting is at or above the material's glowing end temperature.
bool IsMeltingAllowed { get; }True unless an isAllowedFilter handler says no. The smelter skips items that are not allowed.
bool IsTriggeringAbilities { get; }Whether ember composers treat this item as triggering abilities. Default true.
Bounds MeshBounds { get; }Bounds of the main mesh.
abstract PhysicalMaterial PhysicalMaterial { get; }Material the item is made of.

Events​

MemberWhat it is
event MeltingModelAllowed isAllowedFilterLets other code block melting for this item.
event MeltingModelYield yieldMultiplierFilterLets other code change the melt yield.

Methods​

MemberWhat it is
override void InitializeAsServer(SpawnData spawnData)Server: starts the item's melting modifiers.
virtual void OnValidate()Finds the heat point collection and main mesh in the editor.
void Setup(PhysicalMaterial material, float ingotValue)Sets the material, and optionally the ingot value.
void Setup(PhysicalMaterial material)Sets the material, and optionally the ingot value.
protected abstract void InternalSetup(PhysicalMaterial material)Sets the item's material. Subclasses implement it.
2 private and internal methods
MemberWhat it is
private void OnDestroy()On the server (unless the entity is being destroyed), terminates the modifiers. Clears the filter events.
private void SceneDestroy(NetworkEntity entity, bool isUnload)Server: terminates the modifiers when the entity is destroyed by the scene.

Used in​

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