Skip to main content

DisableLightOnDock

A class in Root.Township, Alta.Crafting.

Turns off a platform light on a crafting part when its root pickup is shrunk into a dock that does not allow glowing items, and back on when undocked.

  • Listed in Crafting and making
  • Inherits or implements MonoBehaviour
  • Attributes RequireComponent

Constructors​

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

Fields​

2 private and internal fields
MemberWhat it is
private Pickup pickupPickup of the current root part.
private PlatformLight targetLightThe light to turn on and off.

Methods​

5 private and internal methods
MemberWhat it is
private void Awake()Starts listening for the crafting part's root changes.
private void CheckEnabledEnable(Interactor interactor, Pickup pickup, PickupDock dock)On docking: keeps the light on only if the dock allows glowing items or is not scaling the pickup.
private void ForceEnable(Interactor interactor, Pickup pickup, PickupDock dock)On undocking: turns the light back on.
private void OnDestroy()Removes the dock and undock hooks from the pickup.
private void RootSet(CraftingPart root)Moves the dock and undock hooks to the new root's pickup.