A class in Root.Township, Alta.Woodcutting.
Server decay for a WoodcutTree: once the tree has no chunking parent its decay timer runs, scaled by tree size, and it won't decay within two minutes of being hit.
Constructors
| Member | What it is |
|---|
TreeDecay() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
2 private and internal fields
| Member | What it is |
|---|
private TimeSpan lastDamage | Timeline time of the last hit. |
private WoodcutTree tree | The tree this decays. |
Properties
| Member | What it is |
|---|
protected override float TimerMultiplier { get; } | The tree's total size, so bigger trees probably take longer to decay. |
Methods
| Member | What it is |
|---|
override void InitializeAsServer(SpawnData spawnData) | Gets the WoodcutTree before the base setup. |
protected override void DecayFailed() | Restarts the timer when decay was refused because of recent damage. |
protected override void FinishInitialize() | Hooks the tree's cut and damage events and checks its state a frame later. |
protected override bool IsDecayValid(bool isStarting) | Allowed when the base allows it, the rigidbody isn't kinematic, and it's starting or 120 seconds have passed since the last hit. |
2 private and internal methods
| Member | What it is |
|---|
private void CheckCut(WoodcutTree tree) | On a cut, starts or shortens the timer if the tree has no chunking parent, otherwise cancels it. |
private void PartTookDamage(WoodcutTree tree, float damage) | Records the time of the last hit. |