Skip to main content

Gatherer

A class in Root.Township, the global namespace.

Skill that, when a pouch is thrown, pulls nearby loose pickups of the pouch's docked type into it after a delay. The server docks them; clients show them flying in.

Constructors​

MemberWhat it is
Gatherer()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

8 private and internal fields
MemberWhat it is
private HashSet<Rigidbody> activeGatherersPouches waiting to dock, so they don't gather each other.
private bool canGatherCraftedPickupsAllows gathering crafted pickups.
private bool canGatherKinematicPickupsAllows gathering kinematic pickups.
private float dockDelaySeconds between letting go and gathering.
private List<uint> dockedPickupsIdentifiersEntity IDs of the pickups gathered last time, sent to clients.
private float dockingRangeRadius gathered around the pouch.
private Item trainingPouchItemTraining pouch item that also counts as a pouch.
private Item[] validItemsDocked item types this skill works with.

Methods​

MemberWhat it is
override void Deregister(ISkillInputMethod input)When an active pouch is let go, starts DockDelay on the player.
void MovePickupToPouch(PickupDock dock, Pickup pickup)Client visual: spawns a ghost of the pickup that moves into the pouch's dock.
override bool ValidatePickup(HeldPickupHandler pickupHandler)True for a pouch or training pouch whose docked type is in validItems.
protected override void EffectsRequested(NetworkEntity targetEntity, ToolBasedSkillStatus status, bool isLocalPlayer)Client: plays the fly-in effect for each docked pickup once it has spawned.
protected override void RequestToolEffect(NetworkEntity entity)Starts the skill effect on the pouch's renderers.
protected override void SerializeInternal(Stream stream)When the skill was consumed, also syncs the IDs of the pickups that were docked (up to 63).
3 private and internal methods
MemberWhat it is
private void Dock(HeldPickupHandler handler)Finds allowed pickups within dockingRange of the pouch, runs the skill and docks them into the pouch.
private IEnumerator DockDelay(HeldPickupHandler handler) (iterator)Coroutine: waits dockDelay, then docks if the skill is still unlocked; otherwise turns the effect off.
private IEnumerable<MeshRenderer> GetPouchRenderers(NetworkEntity pouchEntity)Pouch renderers, without those of the item docked in it, for the skill effect.