Skip to content

GatherInteraction ​

Inherits: InteractableObjectInteraction < Interaction < Resource

A gathering node (an ore vein, an herb, a tree to chop, a fishing spot): using it gives the player what its loot rules of the trigger "On Gathered" roll, straight to the bag. The node has a number of charges (3 uses before it is gone), can be used up and come back later, can raise the skill of a profession, and uses everything every interactable has: requirements (a profession level, a tool), a time to gather with a cast bar, and the animation of the gatherer.

Description ​

The loot goes to the bag or not at all: a gatherer whose bag has no room for the roll gets nothing, the charge is not used and the node stays as it was. Or the node can have a loot window like a chest: each gather puts what it rolls in the inventory of the node and opens it; what is not taken stays, and until the node is emptied another attempt opens the same window again (no charge, no skill).

Properties ​

intcharges1
WhenDepletedwhen_depletedWhenDepleted.STAYS
floatrespawn_seconds0.0
LootModeloot_modeLootMode.TO_THE_BAG
floatauto_close_distance4.0
intcraft_school_id0
intskill_points1
intskill_up_from1
intskill_up_until0
CalculationFormulaskill_up_curve
Stringfull_animation""
Stringgather_animation""
Stringdepleted_animation""

Variables ​

intcharges_remaining1

Methods ​

voidsetup_for_interactable_objects( interactable: InteractableObject )
Stringget_interaction_prompt()
boolis_depleted()
boolcan_interact( player: Player )
boolneeds_use_time( _entity: Entity )
boolhas_loot_waiting()
Stringget_block_reason( entity: Entity )
voidstart_interaction( player: Player )
voidreplenish()
Dictionarysave_state()
voidload_state( state: Dictionary )
voidcleanup()
Array[Dictionary]validate()

Signals ​

gathered( gatherer: Entity ) ​

Emitted when an entity gathers from the node.

depleted() ​

Emitted when the node has no charges left.

replenished() ​

Emitted when the node has charges again.

Enumerations ​

enum LootMode ​

The options of loot mode: to the bag, window.

  • TO_THE_BAG = 0 - What a gather rolls goes straight to the bag of the gatherer (all of it, or nothing)
  • WINDOW = 1 - What a gather rolls goes into the inventory of the node and its window opens, like a chest. What is not taken stays: the next attempt opens the same window, with no new roll
  • ON_THE_GROUND = 2 - What a gather rolls lies on the ground around the node as dropped items (the gatherer picks them up). A bag that is full does not stop the gather

enum WhenDepleted ​

The options of when depleted: stays, disappears.

  • STAYS = 0 - The node stays where it is and plays its depleted animation, but cannot be used
  • DISAPPEARS = 1 - The node vanishes (it cannot be seen, hit or used) until it comes back

Property descriptions ​

Uses

int charges = 1 ​

How many times the node can be gathered from before it is used up

WhenDepleted when_depleted = WhenDepleted.STAYS ​

What a used-up node looks like

float respawn_seconds = 0.0 ​

Seconds of game time until a used-up node is full again. 0 = never (until an event or a spawner brings it back)

Loot

LootMode loot_mode = LootMode.TO_THE_BAG ​

Where the loot goes: straight to the bag, or into a window that the gatherer takes from

float auto_close_distance = 4.0 ​

Window: the window closes by itself when the gatherer walks this far from the node

Skill

int craft_school_id = 0 ​

The profession that a gather raises (a craft school: Mining, Herbalism). 0 = none. Using the node is gated by the requirements of the interactable (a profession level)

int skill_points = 1 ​

The skill points one gather gives (Points mode) or the weight of the chance (Skill-ups mode)

int skill_up_from = 1 ​

The skill level at which the node teaches the most

int skill_up_until = 0 ​

The skill level at which the node stops teaching anything (grey). 0 = it never stops

CalculationFormula skill_up_curve ​

How much the node teaches inside its range: 1 at its start, 0 at its end. Empty = a straight line down (as the recipes of a profession)

Animations

String full_animation = "" ​

The animation of the object when it is full (played when it is set up and when it comes back). Empty = none

String gather_animation = "" ​

The animation of the object each time it is gathered from

String depleted_animation = "" ​

The animation of the object when it is used up

Variable descriptions ​

int charges_remaining = 1 ​

Uses left

Method descriptions ​

void setup_for_interactable_objects( interactable: InteractableObject ) ​

Sets the charges of the node.

String get_interaction_prompt() ​

The text of the prompt above the node ("Gather").

bool is_depleted() ​

Has the node run out of charges?

bool can_interact( player: Player ) ​

Can the node be gathered from now? (it is not used up, and the gatherer's bag has some room)

bool needs_use_time( _entity: Entity ) ​

Does the use take its time? Not when it only opens the window again (loot is waiting)

bool has_loot_waiting() ​

Window: is there loot in the node that nobody has taken?

String get_block_reason( entity: Entity ) ​

Why the node cannot be used ("" = it can)

void start_interaction( player: Player ) ​

The player gathers: uses up a charge and rolls the loot.

void replenish() ​

The node is full again (its respawn time passed, or an event or a spawner brought it back)

Dictionary save_state() ​

The state of the node for a save (the charges and whether it is depleted).

void load_state( state: Dictionary ) ​

Restores the state of the node from a save.

void cleanup() ​

Stops the timers of the node.

Array[Dictionary] validate() ​

Checks the settings. Gives the problems found (empty when it is fine).