PickupDecay
A class in Root.Township, the global namespace.
Server-side decay timer for a loose pickup: it counts down only while the item sits untouched, not held, docked or crafted into something, then the item decays. Settings come from PickupDecaySettings.
- Listed in Global namespace: P
- Inherits or implements
BasicDecay - Documented in Items, interaction and damage
Constructors
| Member | What it is |
|---|---|
PickupDecay() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Properties
| Member | What it is |
|---|---|
PickupDecaySettings PickuDecaySettings { get; } | The decay settings cast to PickupDecaySettings. Name misspelt in the game code. |
protected override float TimerMultiplier { get; } | CraftedDecayTimeMultiplier for crafted items when crafted decay is allowed, otherwise 1. |
Methods
| Member | What it is |
|---|---|
override void InitializeAsServer(SpawnData spawnData) | Disables decay for items spawned by a chunk's first load, until someone grabs them. |
protected override void FinishInitialize() | Watches crafting root changes and starts decay unless the item is a crafted child. |
protected override bool IsDecayValid(bool isStarting) | Decay only runs if the item isn't held, docked or a crafted child, and the settings allow its crafted and kinematic state. |
7 private and internal methods
| Member | What it is |
|---|---|
private void CraftedAsChild(CraftingPart newRoot) | When the crafting root changes, stops decay if the item became part of another object, or restarts it if it's the root again. |
private void DeregisterDecay() | Unhooks the grab and dock events. |
private void Docked(Interactor interactor, Pickup pickup, PickupDock dock) | Cancels the timer when docked. |
private void InteractionEnded(Interactable interactable, Interactor interactor) | Restarts the timer from full once nobody holds the item. |
private void InteractionStarted(Interactable interactable, Interactor interactor) | Enables decay and cancels the timer while held. |
private void RegisterDecay() | Hooks grab and dock events and starts or continues the timer. |
private void Undocked(Interactor interactor, Pickup pickup, PickupDock dock) | Restarts the timer from full when undocked and not held. |