Skip to main content

BasicDigable

A class in Root.Township, the global namespace.

Something a digging tool can dig up (IDigable). The server runs the dug event and sends dig or hit effects to clients in nearby chunks.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private PositionEvent onDigHitEffectsEffect for a digging hit, played at this position.
private PositionEvent onDugEffectsEffect for being dug up, played at this position.
private PositionEvent onDugServerServer-only event when dug, for the gameplay result.
private MethodSyncStruct<bool> syncDigNetwork sync for dig effects, sent as an effect request.

Methods​

MemberWhat it is
virtual void Dig(float diggingDamage)Server: plays dug effects (unless headless), syncs them to clients and invokes onDugServer. Virtual.
void DiggingToolHit()Server: plays the hit effect for a dig that didn't finish and syncs it to clients.
override void Initialize()Creates the sync message used to send dig effects.
1 private and internal method
MemberWhat it is
private void SyncDig(IPlayer player, Stream stream, bool isDig)Message handler: clients play the dug effect when the flag is true and the hit effect when false.