Skip to main content

ChiselableSurfaceDock

A class in Root.Township, Features.Gameplay.Inventory.SurfaceDock.

Placed surface dock that players can chisel off. Server: it ignores hits while any of its docks hold an item, and when broken it is replaced with the unplaced dock prefab.

Constructors​

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

Fields​

2 private and internal fields
MemberWhat it is
private PickupDock[] pickupDocksDocks checked before damage is taken.
private NetworkPrefab unplacedSurfaceDockPrefabPrefab spawned in place of this one when it breaks.

Methods​

MemberWhat it is
protected override void OnBrokenServer(float damage, Vector3 position, Vector3 direction, ChiselingTool tool, Collider hitCollider)Server: runs the base break, then replaces this entity with unplacedSurfaceDockPrefab.
protected override bool OnDamageTakenServer(float damage, Vector3 position, Vector3 direction, ChiselingTool tool, Collider hitCollider)Server: refuses damage while any listed pickup dock has an item in it.