Cleanup goal unlocks behaviour

This commit is contained in:
2026-04-04 16:56:39 +02:00
parent cd23125739
commit 0ab63ebe8c
8 changed files with 70 additions and 97 deletions

View File

@@ -23,6 +23,16 @@ extends Resource
@export var id: StringName = &"" # Unique identifier
@export var requirements: Array[GoalRequirementData] # Conditions to complete
@export var unlock_behavior: UnlockBehavior = MANUAL # AUTOMATIC or MANUAL
```
### Enum
```gdscript
enum UnlockBehavior {
AUTOMATIC, # Goal completes immediately when met
MANUAL, # Goal requires player to click unlock button
}
```
### Methods
@@ -94,9 +104,11 @@ func _on_currency_changed(currency_id, new_amount):
### Manual Unlock vs Automatic
Generators can be configured to:
- **Automatic**: Unlock immediately when goal completes
- **Manual**: Goal completion enables a button player must click
Goals control their own unlock behavior via `unlock_behavior`:
- **AUTOMATIC**: Goal completes immediately when requirements are met
- **MANUAL**: Goal stays incomplete until player clicks unlock button
Generators with `unlock_goal` automatically unlock when the goal completes.
## Usage Example
@@ -130,9 +142,10 @@ amount_exponent = 6 # 1,000,000
In `CurrencyGeneratorData`:
```gdscript
@export var unlock_goal: GoalData # Assign goal resource
@export var unlock_goal_behavior: UnlockGoalBehavior = AUTOMATIC
```
The goal's `unlock_behavior` determines if the generator unlocks automatically or requires manual button click.
## Signals
```gdscript