AutoContainerLid
A class in Root.Township, the global namespace.
Server component that puts a liquid container's lid back on automatically: when it's docked, or a few seconds after a player lets go of it.
- Listed in Global namespace: A to B
- Inherits or implements
NetworkEntityBehaviour - Attributes
RequireComponent
Constructors
| Member | What it is |
|---|---|
AutoContainerLid() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|---|
private Pickup containerPickup | The container's pickup. |
private bool isClosingIfEmpty | If true, the lid closes even when the container is empty. |
private LiquidContainerLid lid | The lid component on this object. |
private AltaCoroutine relidCoroutine | The running recork coroutine, if any. |
private float relidTimer | Seconds after release before the lid goes back on (5 by default). |
Methods
| Member | What it is |
|---|---|
override void InitializeAsServer(SpawnData spawnData) | Server: hooks the pickup's dock and interaction events, and the content level change unless isClosingIfEmpty. |
6 private and internal methods
| Member | What it is |
|---|---|
private void AddLid(Interactor interactor, Pickup pickup, PickupDock dock) | Closes the lid if it's off and the container isn't empty (or isClosingIfEmpty is set). The overload is the dock handler. |
private void AddLid() | Closes the lid if it's off and the container isn't empty (or isClosingIfEmpty is set). The overload is the dock handler. |
private void ContentLevelChanged(ILiquidContainer container, int oldLevel, int newLevel) | When the container gains liquid while nobody holds it, closes the lid now if docked or starts the delayed recork. |
private void InteractionEnded(Interactable interactable, Interactor interactor) | Starts the delayed recork when the container is released undocked. |
private void InteractionStarted(Interactable interactable, Interactor interactor) | Cancels a pending recork when someone grabs the container. |
private IEnumerator Recork() (iterator) | Coroutine: waits relidTimer seconds, then closes the lid. |