Godot game loop harvest

From nix-community/nur-combined · View interactive version

Godot game loop harvest is an AI agent skill from the GitHub repository nix-community/nur-combined. Data-driven resource harvesting system (mining, logging, foraging) for Godot 4. Use when implementing gathering mechanics with tool/tier validation, health depletion, item spawning, and persistence.

How to use this skill

Skill file

Godot Game Loop: Harvest

Implement decoupled, data-driven gathering mechanics. This system handles tool validation, depletion, and respawning.

1. Component Reference

| Component | Asset | Description |

| :--- | :--- | :--- |

| Resource Data | resource_data.gd | Resource: Defines health, yield, and tool requirements. |

| Tool Data | harvest_tool_data.gd | Resource: Defines damage, type, and tier. |

| Harvestable Node | harvestable_node.gd | StaticBody3D: The world interaction entity. |

| Respawn Manager | harvest_respawn_manager.gd | Node: (Singleton) Manages world persistence. |

| Inventory Manager| harvest_inventory_manager.gd | Node: Hub for resource collection. |

2. Implementation Guide

Step 1: Resource Setup

Step 2: Node Configuration

Step 3: Global Systems (Recommended)

3. Interaction & Signals

Calling Hits

When a player interacts (e.g., via RayCast), call apply_hit(tool_data).

if collider is HarvestableNode:
    collider.apply_hit(player_tool)

Signal Map

| Signal | Payload | Integration |

| :--- | :--- | :--- |

| harvested | (data, amount) | Connect to InventoryManager.add_resource. |

| took_damage | (curr, max) | Connect to a Progress Bar or Damage Popups. |

| interaction_failed| (reason: String) | Handles "wrong_tool" or "low_tier" UI feedback. |

NEVER Do


Available Scripts

MANDATORY: Read the appropriate script before implementing the corresponding pattern.

[harvest_loop_patterns.gd](scripts/harvest_loop_patterns.gd)

Expert patterns for idle optimization, UNIX-based offline gains, and threaded resource processing.

[resource_data.gd](scripts/resource_data.gd)

Resource container: Defines health, yield, and tool requirements for a harvestable object.

[harvestable_node.gd](scripts/harvestable_node.gd)

StaticBody3D: The world interaction entity that handles hits, shakes, and depletion.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.