Skip to main content

BuilderDock

A class in Root.Township, Alta.Carpentry.

The dock on a ChisellingDeck where players put wood wedges. Each WedgesPerBlock wedges grows the timber block by one size, and it shows the wedges stacked up.

Constructors​

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

Fields​

MemberWhat it is
BuilderDock.BoolDelegate ActiveChangedDelegate called with whether the dock holds any wedges, whenever that changes.
9 private and internal fields
MemberWhat it is
private float animationDurationSeconds before docked wedges turn into block size.
private Transform builderParentParent of the wedge pieces, moved along x to follow the block.
private Renderer[] builderPiecesRenderers for the wedge pieces shown as wedges are added.
private MeshFilter[] builderPiecesFiltersMesh filters of the wedge pieces. Not read in this build.
private ChisellingDeck deckThe chiselling deck this dock feeds.
private PickupDock dockThe PickupDock on this object.
private Transform undockingTargetWhere ejected wedges and refuse are dropped.
private Coroutine updatingRoutinePrivate: the running EnsureSpace coroutine.
private Item wedgeItemThe only item the dock accepts.

Properties​

MemberWhat it is
PhysicalMaterial CurrentPhysicalMaterial { get; private set; }Material of the wedges in the dock, used for the block and refuse.
bool IsActive { get; private set; }Whether the dock currently holds wedges.
1 private and internal property
MemberWhat it is
private int IBuildRendererBakeable.SortingOrder { get; }Always 0.

Methods​

MemberWhat it is
void ReduceSize()Ejects all wedges and marks the dock inactive.
void SetupPhysicalMaterial(PhysicalMaterial physicalMaterial)Sets CurrentPhysicalMaterial directly.
void SpawnRefuse(int refuse)Server: spawns wedges of the current material at the undocking point, in a pouch if more than one.
void UpdatePosition()Moves the wedge display to the block positioner's BuilderX.
void UpdateQuantity()Called when the docked amount changes. The server starts EnsureSpace; clients update visuals.
7 private and internal methods
MemberWhat it is
private void Awake()Hooks the dock filter and quantity change, and empties the dock whenever the block is chiselled.
private void IBuildRendererBakeable.Bake(bool isSaving)Hides the wedge pieces when baked.
private void BlockFilter(Interactor interactor, Pickup pickup, ref bool result)Private: accepts only the wedge item, matching the block's material, while the deck has space and the block is unchiselled.
private void IBuildRendererBakeable.Clean()Does nothing.
private IEnumerator EnsureSpace() (iterator)Private, server: updates the visuals and active state, grows the block if there are enough wedges, then makes room on the deck.
private IEnumerator SpawnAnimation() (iterator)Private: waits animationDuration, then turns docked wedges into block size, up to the deck's or positioner's limit. Ejects if the block was chiselled.
private void UpdateImage()Private: shows wedge pieces in proportion to how many wedges are docked, with the wedges' material.

Used in​

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