Skip to main content

OnlyAllowDockingWhenEmpty

A class in Root.Township, Alta.Inventory.

Blocks a container from being docked while its own docks hold anything, and blocks its docks from taking items while it is docked.

Constructors​

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

Fields​

5 private and internal fields
MemberWhat it is
private CraftingPart craftingPartCrafting part used to follow the assembly's root pickup.
private DockArray docksThe container's inner docks.
private bool hasContentWhether any inner dock holds an item.
private Pickup pickupThe container's own pickup.
private CraftingPart topThe root crafting part currently followed.

Methods​

MemberWhat it is
override void Initialize()Adds the dock filters, hooks quantity changes and the crafting root, and works out the starting content.
4 private and internal methods
MemberWhat it is
private void DockFilter(Interactor interactor, Pickup pickup, ref bool result)Filter on the inner docks: refuses items while the pickup is docked.
private void PickupFilter(Interactor interactor, PickupDock dock, ref bool result)Dock filter on the pickup (or root pickup): refuses docking while hasContent is true.
private void QuantityChanged()Updates hasContent from whether any of the docks hold an item.
private void RootChanged(CraftingPart newTop)Moves the pickup filter to the new crafting root's pickup.