Skip to main content

ConfirmationCraftingPart

A class in Root.Township, Alta.Crafting.

A crafting part that has to be nailed in before it connects. Attaching it starts a timed nailing step; if the nails aren't finished in time, or someone grabs it, it pops back out.

Constructors​

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

Fields​

11 private and internal fields
MemberWhat it is
private GenericCraftingNail[] nailsThe nails spawned for the current attempt, or null.
private NailSettings nailSettingsNail layout, time limit and damage rules for this part.
private Timeline.IEntry playTimeEndingSoundTimer for the time-running-out sound.
private Timeline.IEntry popoutEntryServer timer that pops the part out when nailing time runs out.
private MethodSyncStruct<uint> syncAttemptCraftMessage sync for SyncAttemptCraft.
private MethodSyncStruct<ConfirmationCraftingPart.ClientSideNailHitSync> syncClientNailHitMessage sync for SyncClientNailHit.
private MethodSync syncCompletedEffectMessage sync for OnCompleteEffect.
private MethodSyncStruct<int> syncNailMessage sync for SyncNail.
private MethodSync syncPopoutMessage sync for SyncPopout.
private MethodSync syncSetupMessage sync for SyncSetup.
private JointSlot targetSlotThe slot being nailed into.

Methods​

MemberWhat it is
override void AttemptCraft(JointSlot slot)Starts nailing into the slot and tells other players.
override void Initialize()Creates the network syncs for setup, nailing, nail hits, pop-out and the done effect.
override void OnConnected(Player player)Sends the current nailing state to a joining player.
protected override void Awake()Clears nailing when crafted or destroyed.
17 private and internal methods
MemberWhat it is
private void Clear()Cancels the pop-out timer, releases the nails and frees the target slot.
private void CraftClear(CraftingPart craftingPart, bool isLoad)Handler for OnCrafted: clears nailing state.
private void DestroyClear(NetworkEntity entity, bool isUnload)Handler for the entity being destroyed: clears nailing state.
private bool Alta.Crafting.INailable.HasOverflow(GenericCraftingNail nail, ImpactHit impact)Always false; nails on this part can't be over-hit.
private void InteractionPopout(Interactable interactable, Interactor interactor)Server: pops the part out when either piece is grabbed during nailing.
private void Alta.Crafting.INailable.OnComplete(GenericCraftingNail nail, bool hasEffects)When every nail is done, plays the done effect and finishes the craft into the slot.
private void OnCompleteEffect(IPlayer player, Stream stream)Network message that plays the piece-completed effect on clients.
private void PlayTimeEndingSound()Client: plays the warning sound shortly before nailing time runs out.
private void Popout()Cancels nailing, turns physics back on and unparents the part. The server tells clients.
private void Alta.Crafting.INailable.ReceiveHit(GenericCraftingNail nail, Vector3 impactDirection, float impactDamage)Applies a hammer hit to a nail and syncs that nail.
private void SetupNailing(JointSlot slot)Aligns the part to the slot, spawns its nails and starts the timers. With no nails it crafts at once.
private void SyncAttemptCraft(IPlayer player, Stream stream, uint slotIdentifier)Network message for starting nailing into a slot; the server relays it to other players.
private void SyncClientNailHit(IPlayer player, Stream stream, ConfirmationCraftingPart.ClientSideNailHitSync arguments)Network message for a client's nail hit; the server works out the damage and applies it.
private void Alta.Crafting.INailable.SyncHit(GenericCraftingNail nail, ImpactHitWithTool hitWithTool)Sends a client's nail hit to the server.
private void SyncNail(IPlayer player, Stream stream, int nailIndex)Network message for one nail's state.
private void SyncPopout(IPlayer player, Stream stream)Network message that pops the part out on remote clients.
private void SyncSetup(IPlayer player, Stream stream)Full sync for joining players: the target slot and every nail's state.