> For the complete documentation index, see [llms.txt](https://hiveminddocs.gitbook.io/hivemind/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hiveminddocs.gitbook.io/hivemind/code-systems/ultimate-gathering-system-ugs/classes/bp_ugs_resourcenode_base.md).

# BP\_UGS\_ResourceNode\_Base

This is the base class for all of the resource nodes, including the example content.

If you want to create your own node then this is the class you want to create a child class from.

## <mark style="color:blue;">Functions</mark>

### <mark style="color:yellow;">Initialize Resource Tags</mark>

This function initializes the resource tags and is essential for the system to function correctly. If you override the `BeginPlay` function when creating a subclass of the `BP_UGS_ResourceNode_Base`, make sure to call the parent method. This function is private and cannot be called outside of the this base class.

### <mark style="color:yellow;">Try Harvest</mark>

Use this function to harvest a resource node. It handles:

* Checking if the resource node is harvestable.
* Calculating the gathering rate.
* Verifying depletion conditions

The function returns `true` if the node is successfully harvested and `false` if the harvest fails.

### <mark style="color:yellow;">Harvest</mark>

This function should be overridden in your child class. It is executed only when all Harvest Conditions, such as [#can-harvest](#can-harvest "mention") and [#has-required-item-tags](#has-required-item-tags "mention") has been met.

You should handle item transferring from the resource node to the characters inventory here.

<figure><img src="/files/GspiwXbdtm2J6yn4PKYs" alt=""><figcaption><p>Example of Giving an Item to the Gathering Character upon successfully harvesting a node.</p></figcaption></figure>

### <mark style="color:yellow;">On Node Depleted</mark>

This event will be executed when the [#depletion-condition](#depletion-condition "mention") has been met.

Address post-depletion logic here, such as managing events like chaos destruction or modifying the mesh to reflect a depleted state.

<figure><img src="/files/vEMRv7qiD6PFw6HdXdta" alt=""><figcaption><p><code>OnNodeDepleted()</code> Event Example, setting the Static Mesh to a mesh that indicates its been depleted.</p></figcaption></figure>

### <mark style="color:yellow;">Can Harvest</mark>

If you need to have extra logic for when a resource node can be harvested, then override this function.

Examples could be:

* Resource availability
* Environmental factors
* Time of day
* Harvest Count

<figure><img src="/files/Bi2FSsJ0ThacjfcpXWNw" alt=""><figcaption><p>Example of <code>CanHarvest()</code> with Harvest Count</p></figcaption></figure>

### <mark style="color:yellow;">Has Required Item Tags</mark>

This function returns true if the resource node matches the Gatherer Tag.

### <mark style="color:yellow;">Depletion Condition</mark>

This function allows you to determine when the resource node should be depleted.

Examples of this could be:

* No more available resources left.
* Health has been depleted

This function should be overridden.&#x20;

<figure><img src="/files/w2OhBBXtxCEeeIO3PRKX" alt=""><figcaption><p>Example of <code>DepletionCondition()</code> for a harvest count type resource node.</p></figcaption></figure>

{% hint style="warning" %}
**Important:** Override this function to prevent infinite resource harvesting.
{% endhint %}

### <mark style="color:yellow;">Calculate Gathering Rate</mark>

This guide explains various calculation methods for determining gathering rates based on the Base Resource Rate and the Item Gathering Rate.

* **Average**: Computes the average of the Base Resource Rate and the Item Gathering Rate.
* **Max**: Selects the higher value between the Base Resource Rate and the Item Gathering Rate.
* **Min**: Selects the lower value between the Base Resource Rate and the Item Gathering Rate.
* **Divide**: Divides the Base Resource Rate by the Item Gathering Rate.
* **Multiply**: Multiplies the Item Gathering Rate by the Base Resource Rate.
* **Add**: Sums the Base Resource Rate with the Item Gathering Rate.
* **Base Only**: Utilizes only the Base Resource Gathering Rate.

This system allows you to decide different calculation types based on the Base Resource Gathering Rate and the Item Gathering Rate values.

### <mark style="color:yellow;">Calculate Resource Rate Remainder</mark>

Determine the remaining resources. Use this to track leftover resources in a resource node and account for them over time.

### <mark style="color:yellow;">Is Node Depleted</mark>

Returns `true` if node has been depleted.

<br>
