Skip to main content

GenericCraftingResult

A class in Root.Township, Alta.Crafting.

Component on a finished generic-crafting item (one built from pieces on a crafting station). It maps part hashes to their materials, and lets the item be put back on a station to take it apart. Both sides.

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private LODBaker bakerLOD baker run on clients after the bake message.
private MonoBehaviour[] blockDecraftingSerialized components that implement IBlockGenericDecrafting. Any of them can stop the item being taken apart.
private IBlockGenericDecrafting[] blockDecraftingComponentsblockDecrafting cast to IBlockGenericDecrafting, filled in after deserialization.
private int[] hashesHashes matching each entry in parts, by index.
private PhysicalMaterialPart[] partsMaterial parts that make up the item.
private MethodSync syncBakeMethod sync that tells clients to bake the item's LODs.

Properties​

MemberWhat it is
Dictionary<int, PhysicalMaterialPart> Parts { get; }Material parts of the item keyed by their hash. Built after deserialization.
1 private and internal property
MemberWhat it is
private bool Alta.Crafting.IGenericCraftingComponent.IsAddingProject { get; }Always true: this item starts a new project when added, so a station only accepts it while empty.

Methods​

MemberWhat it is
override void Initialize()Sets up the SyncBake method sync on the entity.
override void OnConnected(Player player)Server: when a player connects, sends them the bake message if the item has an LOD baker.
7 private and internal methods
MemberWhat it is
private bool Alta.Utilities.Atlas.IPreventAtlasing.IsPreventAtlasing(Renderer renderer)True if any of the item's material parts says the renderer must not be atlased.
private void UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize()Rebuilds Parts from the serialized hash and part arrays, and casts the decraft blockers to their interface.
private void UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize()Does nothing.
private void OnValidate()Editor: keeps hashes the same length as parts, drops empty parts and fills in missing hashes.
private void Alta.Crafting.IGenericCraftingComponent.Released(GenericCraftingStation station)Called when the item is let go on a crafting station. Unless a decraft blocker says no, the station sets up a project from this item.
private void SyncBake(IPlayer player, Stream stream)Client: on the bake message, waits one second and bakes the LODs. Skipped on headless builds.
private void Alta.Crafting.IGenericCraftingComponent.Track(GenericCraftingStation station)Does nothing for a result.

Used in​

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