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
| Member | What it is |
|---|
OnlyAllowDockingWhenEmpty() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private CraftingPart craftingPart | Crafting part used to follow the assembly's root pickup. |
private DockArray docks | The container's inner docks. |
private bool hasContent | Whether any inner dock holds an item. |
private Pickup pickup | The container's own pickup. |
private CraftingPart top | The root crafting part currently followed. |
Methods
| Member | What 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
| Member | What 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. |