Revamp goals as resources

This commit is contained in:
2026-03-19 23:46:24 +01:00
parent 3c8709c834
commit bcf228447d
25 changed files with 561 additions and 343 deletions

View File

@@ -7,6 +7,7 @@ extends Node
signal currency_changed(currency_id: StringName, new_amount: BigNumber)
signal generator_state_changed(generator_id: StringName, state: Dictionary)
signal generator_buff_level_changed(generator_id: StringName, buff_id: StringName, new_level: int)
signal generator_buff_unlocked_changed(generator_id: StringName, buff_id: StringName, unlocked: bool)
# ==========================================
# STATE VARIABLES
@@ -16,6 +17,7 @@ var _total_currency_acquired: Dictionary = {}
var generator_states: Dictionary = {}
var generator_buff_levels: Dictionary = {}
var generator_buff_unlocked: Dictionary = {}
var last_save_time: int = 0 # Unix timestamp
@@ -29,6 +31,7 @@ const GENERATOR_UNLOCKED_KEY: String = "unlocked"
const GENERATOR_AVAILABLE_KEY: String = "available"
const GENERATOR_STATES_KEY: String = "generator_states"
const GENERATOR_BUFF_LEVELS_KEY: String = "generator_buff_levels"
const GENERATOR_BUFF_UNLOCKED_KEY: String = "generator_buff_unlocked"
const CURRENCIES_KEY: String = "currencies"
const CURRENT_KEY: String = "current"
const TOTAL_KEY: String = "total"
@@ -217,6 +220,26 @@ func register_generator_buff(generator_id: StringName, buff_id: StringName, init
generator_buff_levels[generator_key] = levels
generator_buff_level_changed.emit(StringName(generator_key), StringName(buff_key), sanitized_level)
func register_generator_buff_unlocked(generator_id: StringName, buff_id: StringName, initially_unlocked: bool = false) -> void:
var generator_key: String = String(generator_id)
var buff_key: String = String(buff_id)
if generator_key.is_empty() or buff_key.is_empty():
return
var unlocked_map: Dictionary = _get_generator_buff_unlocked_ref(generator_id)
if unlocked_map.has(buff_key):
var existing_unlocked: bool = _to_bool(unlocked_map.get(buff_key, initially_unlocked), initially_unlocked)
if bool(unlocked_map.get(buff_key, initially_unlocked)) != existing_unlocked:
unlocked_map[buff_key] = existing_unlocked
generator_buff_unlocked[generator_key] = unlocked_map
generator_buff_unlocked_changed.emit(StringName(generator_key), StringName(buff_key), existing_unlocked)
return
var sanitized_unlocked: bool = _to_bool(initially_unlocked, false)
unlocked_map[buff_key] = sanitized_unlocked
generator_buff_unlocked[generator_key] = unlocked_map
generator_buff_unlocked_changed.emit(StringName(generator_key), StringName(buff_key), sanitized_unlocked)
func get_generator_buff_level(generator_id: StringName, buff_id: StringName) -> int:
var buff_key: String = String(buff_id)
if buff_key.is_empty():
@@ -240,6 +263,32 @@ func set_generator_buff_level(generator_id: StringName, buff_id: StringName, val
generator_buff_levels[generator_key] = levels
generator_buff_level_changed.emit(StringName(generator_key), StringName(buff_key), next_level)
func is_generator_buff_unlocked(generator_id: StringName, buff_id: StringName) -> bool:
var buff_key: String = String(buff_id)
if buff_key.is_empty():
return false
var unlocked_map: Dictionary = _get_generator_buff_unlocked_ref(generator_id)
return _to_bool(unlocked_map.get(buff_key, false), false)
func set_generator_buff_unlocked(generator_id: StringName, buff_id: StringName, value: bool) -> void:
var generator_key: String = String(generator_id)
var buff_key: String = String(buff_id)
if generator_key.is_empty() or buff_key.is_empty():
return
var unlocked_map: Dictionary = _get_generator_buff_unlocked_ref(generator_id)
var next_unlocked: bool = _to_bool(value, false)
if _to_bool(unlocked_map.get(buff_key, false), false) == next_unlocked:
return
unlocked_map[buff_key] = next_unlocked
generator_buff_unlocked[generator_key] = unlocked_map
generator_buff_unlocked_changed.emit(StringName(generator_key), StringName(buff_key), next_unlocked)
func get_generator_buff_unlocked(generator_id: StringName) -> Dictionary:
return _get_generator_buff_unlocked_ref(generator_id).duplicate(true)
func get_generator_buff_levels(generator_id: StringName) -> Dictionary:
return _get_generator_buff_levels_ref(generator_id).duplicate(true)
@@ -251,6 +300,7 @@ func save_game() -> void:
CURRENCIES_KEY: _serialize_currency_balances(),
GENERATOR_STATES_KEY: _serialize_generator_states(),
GENERATOR_BUFF_LEVELS_KEY: _serialize_generator_buff_levels(),
GENERATOR_BUFF_UNLOCKED_KEY: _serialize_generator_buff_unlocked(),
LAST_SAVE_TIME_KEY: Time.get_unix_time_from_system()
}
@@ -272,6 +322,7 @@ func load_game() -> void:
generator_states = _deserialize_generator_states(parsed_data.get(GENERATOR_STATES_KEY, {}))
generator_buff_levels = _deserialize_generator_buff_levels(parsed_data.get(GENERATOR_BUFF_LEVELS_KEY, {}))
generator_buff_unlocked = _deserialize_generator_buff_unlocked(parsed_data.get(GENERATOR_BUFF_UNLOCKED_KEY, {}))
last_save_time = parsed_data.get(LAST_SAVE_TIME_KEY, Time.get_unix_time_from_system())
func _load_currency_balances(raw_currencies: Variant) -> void:
@@ -446,6 +497,21 @@ func _get_generator_buff_levels_ref(generator_id: StringName) -> Dictionary:
generator_buff_levels[key] = fallback
return fallback
func _get_generator_buff_unlocked_ref(generator_id: StringName) -> Dictionary:
var key: String = String(generator_id)
if key.is_empty():
return {}
var existing_raw: Variant = generator_buff_unlocked.get(key, {})
if existing_raw is Dictionary:
var sanitized: Dictionary = _sanitize_generator_buff_unlocked(existing_raw)
generator_buff_unlocked[key] = sanitized
return sanitized
var fallback: Dictionary = {}
generator_buff_unlocked[key] = fallback
return fallback
func _sanitize_generator_buff_levels(raw_levels: Dictionary) -> Dictionary:
var sanitized_levels: Dictionary = {}
for buff_key_variant in raw_levels.keys():
@@ -457,6 +523,22 @@ func _sanitize_generator_buff_levels(raw_levels: Dictionary) -> Dictionary:
return sanitized_levels
func _sanitize_generator_buff_unlocked(raw_unlocked: Dictionary) -> Dictionary:
var sanitized_unlocked: Dictionary = {}
for buff_key_variant in raw_unlocked.keys():
var buff_key: String = String(buff_key_variant)
if buff_key.is_empty():
continue
# Save format only stores true values, but keep parser tolerant.
var is_unlocked: bool = _to_bool(raw_unlocked.get(buff_key_variant, false), false)
if not is_unlocked:
continue
sanitized_unlocked[buff_key] = true
return sanitized_unlocked
func _serialize_generator_states() -> Dictionary:
var result: Dictionary = {}
for key_variant in generator_states.keys():
@@ -513,6 +595,47 @@ func _deserialize_generator_buff_levels(raw_value: Variant) -> Dictionary:
return result
func _serialize_generator_buff_unlocked() -> Dictionary:
var result: Dictionary = {}
for generator_key_variant in generator_buff_unlocked.keys():
var generator_key: String = String(generator_key_variant)
if generator_key.is_empty():
continue
var raw_unlocked: Variant = generator_buff_unlocked.get(generator_key_variant)
if not (raw_unlocked is Dictionary):
continue
var sanitized_unlocked: Dictionary = _sanitize_generator_buff_unlocked(raw_unlocked)
if sanitized_unlocked.is_empty():
continue
result[generator_key] = sanitized_unlocked
return result
func _deserialize_generator_buff_unlocked(raw_value: Variant) -> Dictionary:
var result: Dictionary = {}
if not (raw_value is Dictionary):
return result
for generator_key_variant in raw_value.keys():
var generator_key: String = String(generator_key_variant)
if generator_key.is_empty():
continue
var raw_unlocked: Variant = raw_value.get(generator_key_variant)
if not (raw_unlocked is Dictionary):
continue
var sanitized_unlocked: Dictionary = _sanitize_generator_buff_unlocked(raw_unlocked)
if sanitized_unlocked.is_empty():
continue
result[generator_key] = sanitized_unlocked
return result
func _serialize_generator_state_entry(raw_state: Dictionary) -> Dictionary:
var owned_value: int = _to_non_negative_int(raw_state.get(GENERATOR_OWNED_KEY, 0), 0)
var purchased_value: int = _to_non_negative_int(raw_state.get(GENERATOR_PURCHASED_COUNT_KEY, owned_value), owned_value)

View File

@@ -56,47 +56,36 @@ not a crash.
## Data Model
## New Config File
## New Config Resources
Add a root JSON file:
- `res://generator_unlock_goals.json`
Goals are now authored as typed resources instead of JSON:
1. `res://core/goals/goal_requirement_data.gd` (`GoalRequirementData`)
2. `res://core/goals/goal_data.gd` (`GoalData`)
3. `res://core/generator-unlock-goals/generator_unlock_goal_data.gd` (`GeneratorUnlockGoalData`)
Schema (v1):
```json
{
"version": 1,
"goals": [
{
"id": "unlock_gems_generator",
"target_generator_id": "Gems",
"requirements": [
{
"currency": "gold",
"amount": { "m": 1.0, "e": 3 }
}
]
}
]
}
```
Example assets:
1. `res://idles/goals/magic_total_30.tres` (goal definition)
2. `res://idles/goals/generator_unlock_knowledge.tres` (goal target binding)
Notes:
1. `amount` uses existing `BigNumber` serialization (`m`, `e`) to avoid float precision/overflow issues.
2. `id` must be unique and stable.
3. `requirements` must contain at least one entry.
1. `GoalData.id` must be unique and stable.
2. `GoalData.requirements` must contain at least one valid `GoalRequirementData`.
3. `GoalRequirementData` stores amount as mantissa/exponent to preserve `BigNumber` semantics.
## Runtime Structures (GDScript)
Recommended internal structs/classes:
Runtime data comes from resource classes:
1. `UnlockGoalRequirement`
- `currency: GameState.CurrencyType`
- `amount: BigNumber`
2. `UnlockGoal`
1. `GoalRequirementData`
- `currency: Resource`
- `amount_mantissa: float`
- `amount_exponent: int`
2. `GoalData`
- `id: StringName`
- `requirements: Array[Resource]` (validated as `GoalRequirementData`)
3. `GeneratorUnlockGoalData`
- `target_generator_id: StringName`
- `requirements: Array[UnlockGoalRequirement]`
- `goal: Resource` (validated as `GoalData`)
No persistent `completed_goals` storage is required for v1 because completion is derived from generator unlock state.
@@ -106,7 +95,7 @@ No persistent `completed_goals` storage is required for v1 because completion is
Add a scene-level controller script (recommended name: `generator_unlock_system.gd`) responsible for:
1. Loading + validating `generator_unlock_goals.json`.
1. Loading + validating exported `GeneratorUnlockGoalData` resources.
2. Subscribing to currency change signals.
3. Evaluating pending goals.
4. Triggering generator unlock transitions.
@@ -173,7 +162,7 @@ func _evaluate_goal(goal: UnlockGoal) -> bool:
## Implementation Plan
1. Add `generator_unlock_goals.json` with initial goals.
1. Add `GoalData` and `GeneratorUnlockGoalData` resources with initial goals.
2. Implement `generator_unlock_system.gd` loader/validator/evaluator.
3. Attach unlock system to gameplay scene (`generator_museum.tscn` or current active scene).
4. Configure at least one generator as initially locked (`starts_unlocked = false`, `starts_available = false`) in its `.tres` data.

View File

@@ -0,0 +1,15 @@
class_name GeneratorUnlockGoalData
extends Resource
const GOAL_DATA_SCRIPT: Script = preload("res://core/goals/goal_data.gd")
@export var target_generator_id: StringName = &""
@export var goal: Resource
func get_goal_data() -> Resource:
if goal == null:
return null
if goal.get_script() != GOAL_DATA_SCRIPT:
return null
return goal

View File

@@ -0,0 +1 @@
uid://dt4df3gwr6n5m

View File

@@ -1,27 +1,19 @@
extends Node
class UnlockGoalRequirement extends RefCounted:
var currency_id: StringName
var amount: BigNumber
func _init(req_currency_id: StringName, req_amount: BigNumber) -> void:
currency_id = req_currency_id
amount = req_amount
class UnlockGoal extends RefCounted:
var id: StringName
class GeneratorUnlockGoal extends RefCounted:
var target_generator_id: StringName
var requirements: Array[UnlockGoalRequirement]
var goal: Resource
func _init(goal_id: StringName, target_id: StringName, goal_requirements: Array[UnlockGoalRequirement]) -> void:
id = goal_id
func _init(target_id: StringName, goal_data: Resource) -> void:
target_generator_id = target_id
requirements = goal_requirements
goal = goal_data
const GOALS_FILE_PATH: String = "res://idles/generator_unlock_goals.json"
const SCHEMA_VERSION: int = 1
const GOAL_DATA_SCRIPT: Script = preload("res://core/goals/goal_data.gd")
const GENERATOR_UNLOCK_GOAL_DATA_SCRIPT: Script = preload("res://core/generator-unlock-goals/generator_unlock_goal_data.gd")
var _goals: Array[UnlockGoal] = []
@export var goals: Array[Resource] = []
var _runtime_goals: Array[GeneratorUnlockGoal] = []
var _known_generator_ids: Dictionary = {}
var _warned_unknown_target_ids: Dictionary = {}
@@ -43,32 +35,35 @@ func _on_generator_state_changed(generator_id: StringName, _state: Dictionary) -
_evaluate_all_goals()
func _evaluate_all_goals() -> void:
if _goals.is_empty():
if _runtime_goals.is_empty():
return
for goal in _goals:
_evaluate_goal(goal)
for runtime_goal in _runtime_goals:
_evaluate_goal(runtime_goal)
func _evaluate_goal(goal: UnlockGoal) -> bool:
if _is_goal_completed(goal):
func _evaluate_goal(runtime_goal: GeneratorUnlockGoal) -> bool:
if runtime_goal == null:
return false
if not _can_resolve_target(goal.target_generator_id):
if runtime_goal.goal == null:
return false
if runtime_goal.goal.get_script() != GOAL_DATA_SCRIPT:
return false
if _is_goal_completed(runtime_goal):
return false
if not _can_resolve_target(runtime_goal.target_generator_id):
return false
if not bool(runtime_goal.goal.call("is_met")):
return false
for requirement in goal.requirements:
var total_amount: BigNumber = _get_total_currency_amount(requirement.currency_id)
if total_amount.is_less_than(requirement.amount):
return false
GameState.set_generator_unlocked(goal.target_generator_id, true)
GameState.set_generator_available(goal.target_generator_id, true)
print("[UnlockSystem] Goal completed: %s -> %s" % [String(goal.id), String(goal.target_generator_id)])
GameState.set_generator_unlocked(runtime_goal.target_generator_id, true)
GameState.set_generator_available(runtime_goal.target_generator_id, true)
print("[UnlockSystem] Goal completed: %s -> %s" % [String(runtime_goal.goal.get("id")), String(runtime_goal.target_generator_id)])
return true
func _is_goal_completed(goal: UnlockGoal) -> bool:
func _is_goal_completed(runtime_goal: GeneratorUnlockGoal) -> bool:
return (
GameState.is_generator_unlocked(goal.target_generator_id)
and GameState.is_generator_available(goal.target_generator_id)
GameState.is_generator_unlocked(runtime_goal.target_generator_id)
and GameState.is_generator_available(runtime_goal.target_generator_id)
)
func _can_resolve_target(target_generator_id: StringName) -> bool:
@@ -85,111 +80,40 @@ func _can_resolve_target(target_generator_id: StringName) -> bool:
return false
func _load_goals() -> void:
_goals.clear()
if not FileAccess.file_exists(GOALS_FILE_PATH):
push_warning("Unlock goals file not found: %s" % GOALS_FILE_PATH)
return
var file: FileAccess = FileAccess.open(GOALS_FILE_PATH, FileAccess.READ)
if file == null:
push_warning("Unable to open unlock goals file: %s" % GOALS_FILE_PATH)
return
var parsed: Variant = JSON.parse_string(file.get_as_text())
if not (parsed is Dictionary):
push_warning("Unlock goals root must be a Dictionary: %s" % GOALS_FILE_PATH)
return
var root: Dictionary = parsed
var version: int = int(root.get("version", SCHEMA_VERSION))
if version != SCHEMA_VERSION:
push_warning("Unlock goals schema version %d is different from expected %d" % [version, SCHEMA_VERSION])
var raw_goals: Variant = root.get("goals", [])
if not (raw_goals is Array):
push_warning("Unlock goals file has invalid 'goals' field (expected Array)")
return
_runtime_goals.clear()
var seen_goal_ids: Dictionary = {}
for raw_goal in raw_goals:
var goal: UnlockGoal = _parse_goal(raw_goal)
if goal == null:
for goal_resource in goals:
if goal_resource == null:
continue
if goal_resource.get_script() != GENERATOR_UNLOCK_GOAL_DATA_SCRIPT:
continue
var goal_data: Resource = goal_resource
if goal_data == null:
continue
var target_generator_id: String = String(goal_data.get("target_generator_id")).strip_edges()
if target_generator_id.is_empty():
push_warning("Skipping unlock goal resource: missing target_generator_id")
continue
var resolved_goal: Resource = goal_data.call("get_goal_data")
if resolved_goal == null:
push_warning("Skipping unlock goal for target '%s': goal is null" % target_generator_id)
continue
if not bool(resolved_goal.call("is_valid")):
push_warning("Skipping unlock goal for target '%s': goal is invalid" % target_generator_id)
continue
var goal_key: String = String(goal.id)
var goal_key: String = String(resolved_goal.get("id"))
if seen_goal_ids.has(goal_key):
push_warning("Duplicate unlock goal id skipped: '%s'" % goal_key)
continue
seen_goal_ids[goal_key] = true
_goals.append(goal)
_runtime_goals.append(GeneratorUnlockGoal.new(StringName(target_generator_id), resolved_goal))
if _goals.is_empty():
if _runtime_goals.is_empty():
push_warning("Unlock goals loaded, but no valid entries were found.")
func _parse_goal(raw_goal: Variant) -> UnlockGoal:
if not (raw_goal is Dictionary):
push_warning("Skipping unlock goal: entry is not a Dictionary")
return null
var goal_dict: Dictionary = raw_goal
var goal_id: String = String(goal_dict.get("id", "")).strip_edges()
var target_id: String = String(goal_dict.get("target_generator_id", "")).strip_edges()
if goal_id.is_empty():
push_warning("Skipping unlock goal: missing 'id'")
return null
if target_id.is_empty():
push_warning("Skipping unlock goal '%s': missing 'target_generator_id'" % goal_id)
return null
var raw_requirements: Variant = goal_dict.get("requirements", [])
if not (raw_requirements is Array):
push_warning("Skipping unlock goal '%s': 'requirements' must be an Array" % goal_id)
return null
var parsed_requirements: Array[UnlockGoalRequirement] = []
for raw_requirement in raw_requirements:
var requirement: UnlockGoalRequirement = _parse_requirement(raw_requirement, goal_id)
if requirement != null:
parsed_requirements.append(requirement)
if parsed_requirements.is_empty():
push_warning("Skipping unlock goal '%s': no valid requirements" % goal_id)
return null
return UnlockGoal.new(StringName(goal_id), StringName(target_id), parsed_requirements)
func _parse_requirement(raw_requirement: Variant, goal_id: String) -> UnlockGoalRequirement:
if not (raw_requirement is Dictionary):
push_warning("Skipping requirement in goal '%s': entry is not a Dictionary" % goal_id)
return null
var requirement_dict: Dictionary = raw_requirement
var currency_id: StringName = _parse_currency(requirement_dict.get("currency", ""))
if currency_id == &"" or not GameState.is_known_currency_id(currency_id):
push_warning("Skipping requirement in goal '%s': unknown currency '%s'" % [goal_id, String(requirement_dict.get("currency", ""))])
return null
var raw_amount: Variant = requirement_dict.get("amount", {})
if not (raw_amount is Dictionary):
push_warning("Skipping requirement in goal '%s': 'amount' must be a Dictionary" % goal_id)
return null
var amount: BigNumber = BigNumber.deserialize(raw_amount)
if amount.mantissa < 0.0:
push_warning("Skipping requirement in goal '%s': amount must be non-negative" % goal_id)
return null
return UnlockGoalRequirement.new(currency_id, amount)
func _parse_currency(raw_currency: Variant) -> StringName:
return GameState.parse_currency_id(raw_currency)
func _get_total_currency_amount(currency_id: StringName) -> BigNumber:
return GameState.get_total_currency_acquired_by_id(currency_id)
func _collect_known_generator_ids() -> void:
_known_generator_ids.clear()

View File

@@ -1,22 +1,16 @@
extends PanelContainer
class GoalRequirement extends RefCounted:
var currency_id: StringName
var amount: BigNumber
func _init(req_currency_id: StringName, req_amount: BigNumber) -> void:
currency_id = req_currency_id
amount = req_amount
class GoalDefinition extends RefCounted:
var id: StringName
var target_generator_id: StringName
var requirements: Array[GoalRequirement]
var goal: Resource
func _init(goal_id: StringName, target_id: StringName, goal_requirements: Array[GoalRequirement]) -> void:
id = goal_id
func _init(target_id: StringName, goal_data: Resource) -> void:
target_generator_id = target_id
requirements = goal_requirements
goal = goal_data
const GOAL_DATA_SCRIPT: Script = preload("res://core/goals/goal_data.gd")
const GOAL_REQUIREMENT_SCRIPT: Script = preload("res://core/goals/goal_requirement_data.gd")
const GENERATOR_UNLOCK_GOAL_DATA_SCRIPT: Script = preload("res://core/generator-unlock-goals/generator_unlock_goal_data.gd")
class GoalRow extends RefCounted:
var goal: GoalDefinition
@@ -30,12 +24,12 @@ class GoalRow extends RefCounted:
requirements_label = requirements
button = unlock_button
const GOALS_FILE_PATH: String = "res://idles/generator_unlock_goals.json"
@export var goals: Array[GeneratorUnlockGoalData] = []
@onready var _summary_label: Label = $MarginContainer/VBoxContainer/SummaryLabel
@onready var _goals_list: VBoxContainer = $MarginContainer/VBoxContainer/ScrollContainer/GoalsList
var _goals: Array[GoalDefinition] = []
var _loaded_goals: Array[GoalDefinition] = []
var _rows_by_goal_id: Dictionary = {}
var _known_generator_ids: Dictionary = {}
var _warned_unknown_target_ids: Dictionary = {}
@@ -59,101 +53,52 @@ func _on_generator_state_changed(generator_id: StringName, _state: Dictionary) -
_refresh_ui()
func _load_goals() -> void:
_goals.clear()
if not FileAccess.file_exists(GOALS_FILE_PATH):
push_warning("Goals debug UI: goals file not found at %s" % GOALS_FILE_PATH)
return
var file: FileAccess = FileAccess.open(GOALS_FILE_PATH, FileAccess.READ)
if file == null:
push_warning("Goals debug UI: could not open goals file at %s" % GOALS_FILE_PATH)
return
var parsed: Variant = JSON.parse_string(file.get_as_text())
if not (parsed is Dictionary):
push_warning("Goals debug UI: goals root must be a Dictionary")
return
var goals_raw: Variant = parsed.get("goals", [])
if not (goals_raw is Array):
push_warning("Goals debug UI: goals must be an Array")
return
_loaded_goals.clear()
var seen_goal_ids: Dictionary = {}
for raw_goal in goals_raw:
var goal: GoalDefinition = _parse_goal(raw_goal)
if goal == null:
for goal_resource in goals:
if goal_resource == null:
continue
if goal_resource.get_script() != GENERATOR_UNLOCK_GOAL_DATA_SCRIPT:
continue
var goal_data: Resource = goal_resource
if goal_data == null:
continue
var target_generator_id: String = String(goal_data.get("target_generator_id")).strip_edges()
if target_generator_id.is_empty():
continue
var resolved_goal: Resource = goal_data.call("get_goal_data")
if resolved_goal == null:
continue
if not bool(resolved_goal.call("is_valid")):
continue
var goal_key: String = String(goal.id)
var goal_key: String = String(resolved_goal.get("id"))
if seen_goal_ids.has(goal_key):
push_warning("Goals debug UI: duplicate goal id '%s' skipped" % goal_key)
continue
seen_goal_ids[goal_key] = true
_goals.append(goal)
func _parse_goal(raw_goal: Variant) -> GoalDefinition:
if not (raw_goal is Dictionary):
return null
var goal_dict: Dictionary = raw_goal
var goal_id: String = String(goal_dict.get("id", "")).strip_edges()
var target_id: String = String(goal_dict.get("target_generator_id", "")).strip_edges()
if goal_id.is_empty() or target_id.is_empty():
return null
var raw_requirements: Variant = goal_dict.get("requirements", [])
if not (raw_requirements is Array):
return null
var requirements: Array[GoalRequirement] = []
for raw_requirement in raw_requirements:
var requirement: GoalRequirement = _parse_requirement(raw_requirement)
if requirement != null:
requirements.append(requirement)
if requirements.is_empty():
return null
return GoalDefinition.new(StringName(goal_id), StringName(target_id), requirements)
func _parse_requirement(raw_requirement: Variant) -> GoalRequirement:
if not (raw_requirement is Dictionary):
return null
var requirement_dict: Dictionary = raw_requirement
var currency_id: StringName = _parse_currency(requirement_dict.get("currency", ""))
if currency_id == &"" or not GameState.is_known_currency_id(currency_id):
return null
var raw_amount: Variant = requirement_dict.get("amount", {})
if not (raw_amount is Dictionary):
return null
var amount: BigNumber = BigNumber.deserialize(raw_amount)
if amount.mantissa < 0.0:
return null
return GoalRequirement.new(currency_id, amount)
func _parse_currency(raw_currency: Variant) -> StringName:
return GameState.parse_currency_id(raw_currency)
_loaded_goals.append(GoalDefinition.new(StringName(target_generator_id), resolved_goal))
func _build_goal_rows() -> void:
_rows_by_goal_id.clear()
for child in _goals_list.get_children():
child.queue_free()
for goal in _goals:
for goal in _loaded_goals:
if goal.goal == null:
continue
if goal.goal.get_script() != GOAL_DATA_SCRIPT:
continue
var row_container: HBoxContainer = HBoxContainer.new()
row_container.size_flags_horizontal = Control.SIZE_EXPAND_FILL
row_container.add_theme_constant_override("separation", 12)
var title_label: Label = Label.new()
title_label.custom_minimum_size = Vector2(220.0, 0.0)
title_label.text = "%s -> %s" % [String(goal.id), String(goal.target_generator_id)]
title_label.text = "%s -> %s" % [String(goal.goal.get("id")), String(goal.target_generator_id)]
var status_label: Label = Label.new()
status_label.custom_minimum_size = Vector2(95.0, 0.0)
@@ -165,7 +110,7 @@ func _build_goal_rows() -> void:
unlock_button.custom_minimum_size = Vector2(90.0, 0.0)
unlock_button.text = "Unlock"
unlock_button.disabled = true
unlock_button.pressed.connect(_on_unlock_pressed.bind(goal.id))
unlock_button.pressed.connect(_on_unlock_pressed.bind(goal.goal.get("id")))
row_container.add_child(title_label)
row_container.add_child(status_label)
@@ -173,17 +118,22 @@ func _build_goal_rows() -> void:
row_container.add_child(unlock_button)
_goals_list.add_child(row_container)
_rows_by_goal_id[String(goal.id)] = GoalRow.new(goal, status_label, requirements_label, unlock_button)
_rows_by_goal_id[String(goal.goal.get("id"))] = GoalRow.new(goal, status_label, requirements_label, unlock_button)
func _refresh_ui() -> void:
if _goals.is_empty():
if _loaded_goals.is_empty():
_summary_label.text = "No valid goals loaded"
return
var ready_to_unlock: int = 0
var unlocked: int = 0
for goal in _goals:
var row: GoalRow = _rows_by_goal_id.get(String(goal.id))
for goal in _loaded_goals:
if goal.goal == null:
continue
if goal.goal.get_script() != GOAL_DATA_SCRIPT:
continue
var row: GoalRow = _rows_by_goal_id.get(String(goal.goal.get("id")))
if row == null:
continue
_refresh_goal_row(row)
@@ -193,7 +143,7 @@ func _refresh_ui() -> void:
elif _is_goal_met(goal):
ready_to_unlock += 1
_summary_label.text = "Goals: %d | Ready: %d | Unlocked: %d" % [_goals.size(), ready_to_unlock, unlocked]
_summary_label.text = "Goals: %d | Ready: %d | Unlocked: %d" % [_loaded_goals.size(), ready_to_unlock, unlocked]
func _refresh_goal_row(row: GoalRow) -> void:
var goal: GoalDefinition = row.goal
@@ -221,11 +171,14 @@ func _refresh_goal_row(row: GoalRow) -> void:
row.status_label.text = "Locked"
func _is_goal_met(goal: GoalDefinition) -> bool:
for requirement in goal.requirements:
var total_amount: BigNumber = GameState.get_total_currency_acquired_by_id(requirement.currency_id)
if total_amount.is_less_than(requirement.amount):
return false
return true
if goal == null:
return false
if goal.goal == null:
return false
if goal.goal.get_script() != GOAL_DATA_SCRIPT:
return false
return bool(goal.goal.call("is_met"))
func _is_goal_completed(goal: GoalDefinition) -> bool:
return (
@@ -248,7 +201,7 @@ func _on_unlock_pressed(goal_id: StringName) -> void:
GameState.set_generator_unlocked(goal.target_generator_id, true)
GameState.set_generator_available(goal.target_generator_id, true)
print("[GoalsDebugUI] Unlocked goal '%s' -> %s" % [String(goal.id), String(goal.target_generator_id)])
print("[GoalsDebugUI] Unlocked goal '%s' -> %s" % [String(goal.goal.get("id")), String(goal.target_generator_id)])
_refresh_ui()
func _can_resolve_target(target_generator_id: StringName) -> bool:
@@ -282,14 +235,28 @@ func _collect_known_generator_ids() -> void:
_known_generator_ids[generator_key] = true
func _get_requirements_text(goal: GoalDefinition) -> String:
if goal == null:
return ""
if goal.goal == null:
return ""
if goal.goal.get_script() != GOAL_DATA_SCRIPT:
return ""
var parts: Array[String] = []
for requirement in goal.requirements:
var total_amount: BigNumber = GameState.get_total_currency_acquired_by_id(requirement.currency_id)
for requirement_resource in goal.goal.call("get_valid_requirements"):
if requirement_resource == null:
continue
if requirement_resource.get_script() != GOAL_REQUIREMENT_SCRIPT:
continue
var requirement_currency_id: StringName = requirement_resource.call("get_currency_id")
var total_amount: BigNumber = GameState.get_total_currency_acquired_by_id(requirement_currency_id)
var required_amount: BigNumber = requirement_resource.call("get_amount")
parts.append(
"%s %s / %s" % [
_currency_label(requirement.currency_id),
_currency_label(requirement_currency_id),
total_amount.to_string_suffix(2),
requirement.amount.to_string_suffix(2)
required_amount.to_string_suffix(2)
]
)
return " | ".join(parts)

View File

@@ -1,11 +1,14 @@
[gd_scene format=3 uid="uid://dirvi76rkoowf"]
[ext_resource type="Script" uid="uid://bmrbaulftvvwm" path="res://core/generator-unlock-goals/goals_debug_ui.gd" id="1_s7s8v"]
[ext_resource type="Resource" uid="uid://mnuihnwb70ba" path="res://idles/goals/generator_unlock_knowledge.tres" id="2_jyi2u"]
[ext_resource type="Resource" uid="uid://8wrqdjewfdq5" path="res://idles/goals/generator_unlock_wood.tres" id="3_0nfd8"]
[node name="GoalsDebugUI" type="PanelContainer" unique_id=1494700185]
offset_right = 640.0
offset_bottom = 260.0
script = ExtResource("1_s7s8v")
goals = [ExtResource("2_jyi2u"), ExtResource("3_0nfd8")]
[node name="MarginContainer" type="MarginContainer" parent="." unique_id=1582529872]
layout_mode = 2

View File

@@ -95,6 +95,7 @@ func _ready() -> void:
_ensure_registered()
cycle_progress_seconds = 0.0
GameState.currency_changed.connect(_on_currency_changed)
GameState.generator_state_changed.connect(_on_generated_state_changed)
## Updates click cooldown/click grants and runs automatic production cycles.
@@ -209,10 +210,16 @@ func get_buff_level(buff_id: StringName) -> int:
_ensure_registered()
return GameState.get_generator_buff_level(_generator_id, buff_id)
func is_buff_unlocked(buff_id: StringName) -> bool:
_ensure_registered()
return GameState.is_generator_buff_unlocked(_generator_id, buff_id)
func get_buff_cost(buff_id: StringName) -> BigNumber:
var buff: GeneratorBuffData = _find_buff(buff_id)
if buff == null:
return BigNumber.from_float(0.0)
if not is_buff_unlocked(buff.id):
return BigNumber.from_float(0.0)
var level: int = get_buff_level(buff.id)
return buff.get_cost_for_level(level)
@@ -231,6 +238,9 @@ func can_buy_buff(buff_id: StringName) -> bool:
if buff == null:
return false
if not is_buff_unlocked(buff.id):
return false
var current_level: int = get_buff_level(buff.id)
if not buff.can_purchase_next_level(current_level):
return false
@@ -251,6 +261,9 @@ func buy_buff(buff_id: StringName) -> bool:
if buff == null:
return false
if not is_buff_unlocked(buff.id):
return false
var current_level: int = get_buff_level(buff.id)
if not buff.can_purchase_next_level(current_level):
return false
@@ -274,6 +287,8 @@ func is_buff_maxed(buff_id: StringName) -> bool:
var buff: GeneratorBuffData = _find_buff(buff_id)
if buff == null:
return true
if not is_buff_unlocked(buff.id):
return false
return not buff.can_purchase_next_level(get_buff_level(buff.id))
@@ -438,6 +453,8 @@ func _get_multiplier_for_buff_kind(kind: GeneratorBuffData.BuffKind) -> float:
continue
if buff.kind != kind:
continue
if not is_buff_unlocked(buff.id):
continue
multiplier *= buff.get_effect_multiplier(get_buff_level(buff.id))
@@ -494,7 +511,38 @@ func _register_buffs() -> void:
if buff_id_text.is_empty():
continue
GameState.register_generator_buff(_generator_id, StringName(buff_id_text), 0)
var buff_id: StringName = StringName(buff_id_text)
GameState.register_generator_buff(_generator_id, buff_id, 0)
var persisted_level: int = GameState.get_generator_buff_level(_generator_id, buff_id)
var starts_unlocked: bool = buff.unlocked or persisted_level > 0
GameState.register_generator_buff_unlocked(_generator_id, buff_id, starts_unlocked)
_evaluate_buff_unlock_goals()
func _evaluate_buff_unlock_goals() -> void:
for buff in get_buffs():
_try_unlock_buff_from_goal(buff)
func _try_unlock_buff_from_goal(buff: GeneratorBuffData) -> void:
if buff == null:
return
var buff_id_text: String = String(buff.id).strip_edges()
if buff_id_text.is_empty():
return
var buff_id: StringName = StringName(buff_id_text)
if GameState.is_generator_buff_unlocked(_generator_id, buff_id):
return
if not buff.has_unlock_goal():
return
if not buff.is_unlock_goal_met():
return
GameState.set_generator_buff_unlocked(_generator_id, buff_id, true)
func _on_currency_changed(_changed_currency_id: StringName, _new_amount: BigNumber) -> void:
_evaluate_buff_unlock_goals()
## Default unlocked state loaded from generator data.
func _default_unlocked_state() -> bool:

View File

@@ -8,6 +8,8 @@ enum BuffKind {
}
const HUGE_EXPONENT: int = 1000000
const GOAL_DATA_SCRIPT: Script = preload("res://core/goals/goal_data.gd")
const GOAL_REQUIREMENT_SCRIPT: Script = preload("res://core/goals/goal_requirement_data.gd")
@export var id: StringName = &""
@export var kind: BuffKind = BuffKind.AUTO_PRODUCTION_MULTIPLIER
@@ -15,6 +17,10 @@ const HUGE_EXPONENT: int = 1000000
@export var icon: Texture2D
@export var max_level: int = -1
@export_group("Unlock")
@export var unlocked: bool = false
@export var unlock_goal: Resource
@export_group("Effect")
@export var base_effect: float = 1.0
@export var effect_increment: float = 0.1
@@ -31,6 +37,60 @@ const HUGE_EXPONENT: int = 1000000
@export var resource_purchase_base_exponent: int = 0
@export var resource_purchase_increment_multiplier: float = 1.2
func has_unlock_goal() -> bool:
if unlock_goal == null:
return false
if unlock_goal.get_script() != GOAL_DATA_SCRIPT:
return false
return bool(unlock_goal.call("is_valid"))
func get_unlock_goal_amount() -> BigNumber:
if unlock_goal == null:
return BigNumber.from_float(0.0)
if unlock_goal.get_script() != GOAL_DATA_SCRIPT:
return BigNumber.from_float(0.0)
var valid_requirements: Array[Resource] = unlock_goal.call("get_valid_requirements")
if valid_requirements.is_empty():
return BigNumber.from_float(0.0)
var requirement_resource: Resource = valid_requirements[0]
if requirement_resource == null:
return BigNumber.from_float(0.0)
if requirement_resource.get_script() != GOAL_REQUIREMENT_SCRIPT:
return BigNumber.from_float(0.0)
var required_amount: Variant = requirement_resource.call("get_amount")
if required_amount is BigNumber:
return required_amount
return BigNumber.from_float(0.0)
func get_unlock_goal_currency() -> Resource:
if unlock_goal == null:
return null
if unlock_goal.get_script() != GOAL_DATA_SCRIPT:
return null
var valid_requirements: Array[Resource] = unlock_goal.call("get_valid_requirements")
if valid_requirements.is_empty():
return null
var requirement_resource: Resource = valid_requirements[0]
if requirement_resource == null:
return null
if requirement_resource.get_script() != GOAL_REQUIREMENT_SCRIPT:
return null
return requirement_resource.get("currency")
func is_unlock_goal_met() -> bool:
if unlock_goal == null:
return false
if unlock_goal.get_script() != GOAL_DATA_SCRIPT:
return false
return bool(unlock_goal.call("is_met"))
func can_purchase_next_level(current_level: int) -> bool:
if max_level < 0:
return true

43
core/goals/goal_data.gd Normal file
View File

@@ -0,0 +1,43 @@
class_name GoalData
extends Resource
@export var id: StringName = &""
@export var requirements: Array[GoalRequirementData] = []
func has_id() -> bool:
return not String(id).strip_edges().is_empty()
func get_valid_requirements() -> Array[Resource]:
var result: Array[Resource] = []
for requirement_resource in requirements:
if requirement_resource == null:
continue
if not bool(requirement_resource.call("is_valid")):
continue
result.append(requirement_resource)
return result
func is_valid() -> bool:
if not has_id():
return false
return not get_valid_requirements().is_empty()
func is_met() -> bool:
var valid_requirements: Array[Resource] = get_valid_requirements()
if valid_requirements.is_empty():
return false
for requirement_resource in valid_requirements:
if not bool(requirement_resource.call("is_met")):
return false
return true
func get_first_requirement_summary() -> String:
var valid_requirements: Array[Resource] = get_valid_requirements()
if valid_requirements.is_empty():
return ""
return String(valid_requirements[0].call("get_summary_text"))

View File

@@ -0,0 +1 @@
uid://dx4kmh33rrkpy

View File

@@ -0,0 +1,42 @@
class_name GoalRequirementData
extends Resource
@export var currency: Resource
@export var amount_mantissa: float = 0.0
@export var amount_exponent: int = 0
func get_currency_id() -> StringName:
if currency == null:
return &""
return GameState.get_currency_id(currency)
func get_amount() -> BigNumber:
return BigNumber.new(amount_mantissa, amount_exponent)
func has_valid_currency() -> bool:
var currency_id: StringName = get_currency_id()
if currency_id == &"":
return false
return GameState.is_known_currency_id(currency_id)
func has_valid_amount() -> bool:
return get_amount().mantissa >= 0.0
func is_valid() -> bool:
return has_valid_currency() and has_valid_amount()
func is_met() -> bool:
if not is_valid():
return false
var total_amount: BigNumber = GameState.get_total_currency_acquired_by_id(get_currency_id())
return not total_amount.is_less_than(get_amount())
func get_summary_text() -> String:
if not is_valid():
return ""
var currency_name: String = GameState.get_currency_name(get_currency_id())
return "%s %s" % [get_amount().to_string_suffix(2), currency_name]

View File

@@ -0,0 +1 @@
uid://r4js5eajolio

View File

@@ -7,6 +7,9 @@
[ext_resource type="Resource" uid="uid://brqaojindcxa5" path="res://idles/currencies/magic.tres" id="5_dl3gy"]
[ext_resource type="PackedScene" uid="uid://ckos7f22pnmyh" path="res://generator_container.tscn" id="6_miduw"]
[ext_resource type="PackedScene" uid="uid://dirvi76rkoowf" path="res://core/generator-unlock-goals/goals_debug_ui.tscn" id="7_7i63j"]
[ext_resource type="Script" uid="uid://1sykgtg24a7g" path="res://core/generator-unlock-goals/generator_unlock_system.gd" id="8_bhig6"]
[ext_resource type="Resource" uid="uid://mnuihnwb70ba" path="res://idles/goals/generator_unlock_knowledge.tres" id="9_l765j"]
[ext_resource type="Resource" uid="uid://8wrqdjewfdq5" path="res://idles/goals/generator_unlock_wood.tres" id="10_x0wp6"]
[node name="GeneratorMuseum" type="Node2D" unique_id=1219373683]
@@ -61,3 +64,7 @@ offset_left = 846.0
offset_top = 390.0
offset_right = 1153.0
offset_bottom = 649.0
[node name="GeneratorUnlockSystem" type="Node" parent="." unique_id=1909967402]
script = ExtResource("8_bhig6")
goals = Array[Resource]([ExtResource("9_l765j"), ExtResource("10_x0wp6")])

View File

@@ -37,6 +37,7 @@ func _ready() -> void:
GameState.generator_state_changed.connect(_on_generator_state_changed)
GameState.generator_buff_level_changed.connect(_on_generator_buff_level_changed)
GameState.generator_buff_unlocked_changed.connect(_on_generator_buff_unlocked_changed)
_name_label.text = _generator.data.name if _generator.data != null else "Generator"
_build_buff_rows()
@@ -71,6 +72,12 @@ func _on_generator_buff_level_changed(generator_id: StringName, _buff_id: String
_refresh_generator_ui()
func _on_generator_buff_unlocked_changed(generator_id: StringName, _buff_id: StringName, _unlocked: bool) -> void:
if generator_id != _generator.get_generator_id():
return
_refresh_generator_ui()
func _on_buy_buff_pressed(buff_id: StringName) -> void:
_generator.buy_buff(buff_id)
_refresh_generator_ui()
@@ -108,6 +115,19 @@ func _refresh_buff_rows(can_interact: bool) -> void:
continue
var buff: GeneratorBuffData = row.buff
var buff_unlocked: bool = _generator.is_buff_unlocked(buff.id)
if not buff_unlocked:
var locked_hint: String = "Locked"
var unlock_goal_currency: Resource = buff.get_unlock_goal_currency()
if buff.has_unlock_goal() and unlock_goal_currency != null:
var goal_currency_id: StringName = GameState.get_currency_id(unlock_goal_currency)
var currency_name: String = GameState.get_currency_name(goal_currency_id)
var required_text: String = buff.get_unlock_goal_amount().to_string_suffix(2)
locked_hint = "Unlock at %s %s" % [required_text, currency_name]
row.tile.set_runtime(0, "Locked", locked_hint, false, false)
continue
var level: int = _generator.get_buff_level(buff.id)
var effect_text: String = buff.get_effect_description(level)

View File

@@ -1,14 +0,0 @@
[gd_resource type="Resource" script_class="GeneratorBuffData" format=3 uid="uid://b4ne724qqo4d8"]
[ext_resource type="Script" uid="uid://dnhocfsuvmeyb" path="res://core/generator/generator_buff_data.gd" id="1_4w6kt"]
[ext_resource type="Resource" uid="uid://bnhqk8b31mm4e" path="res://idles/currencies/knowledge.tres" id="2_hk5d2"]
[resource]
script = ExtResource("1_4w6kt")
id = &"knowledge_auto_treatise"
text = "Ancient Treatise"
max_level = 35
effect_increment = 0.2
cost_currency = ExtResource("2_hk5d2")
base_cost_mantissa = 40.0
cost_multiplier = 1.75

View File

@@ -1,15 +0,0 @@
[gd_resource type="Resource" script_class="GeneratorBuffData" format=3 uid="uid://l5a300wieavc"]
[ext_resource type="Script" uid="uid://dnhocfsuvmeyb" path="res://core/generator/generator_buff_data.gd" id="1_l4lhm"]
[ext_resource type="Resource" uid="uid://bnhqk8b31mm4e" path="res://idles/currencies/knowledge.tres" id="2_9xja7"]
[resource]
script = ExtResource("1_l4lhm")
id = &"knowledge_click_notes"
kind = 1
text = "Quick Notes"
max_level = 25
effect_increment = 0.25
cost_currency = ExtResource("2_9xja7")
base_cost_mantissa = 15.0
cost_multiplier = 1.6

View File

@@ -1,19 +0,0 @@
[gd_resource type="Resource" script_class="GeneratorBuffData" format=3 uid="uid://dxljqpqhdfqn6"]
[ext_resource type="Script" uid="uid://dnhocfsuvmeyb" path="res://core/generator/generator_buff_data.gd" id="1_8ee3d"]
[ext_resource type="Resource" uid="uid://brqaojindcxa5" path="res://idles/currencies/magic.tres" id="2_j7l8a"]
[ext_resource type="Resource" uid="uid://bnhqk8b31mm4e" path="res://idles/currencies/knowledge.tres" id="3_ynr4x"]
[resource]
script = ExtResource("1_8ee3d")
id = &"knowledge_grant_program"
kind = 2
text = "Research Grant"
max_level = 20
effect_increment = 0.0
cost_currency = ExtResource("2_j7l8a")
base_cost_mantissa = 90.0
cost_multiplier = 1.8
resource_target_currency = ExtResource("3_ynr4x")
resource_purchase_base_mantissa = 8.0
resource_purchase_increment_multiplier = 1.35

View File

@@ -8,6 +8,7 @@ script = ExtResource("1_r7ak1")
id = &"magic_auto_flux"
text = "Arcane Dynamo"
max_level = 40
unlocked = true
effect_increment = 0.15
cost_currency = ExtResource("2_h3we5")
base_cost_mantissa = 25.0

View File

@@ -1,25 +0,0 @@
{
"version": 1,
"goals": [
{
"id": "first_goal",
"target_generator_id": "Knowledge",
"requirements": [
{
"currency": "magic",
"amount": { "m": 30, "e": 0 }
}
]
},
{
"id": "second_goal",
"target_generator_id": "Wood",
"requirements": [
{
"currency": "magic",
"amount": { "m": 1.3, "e": 3 }
}
]
}
]
}

View File

@@ -1,9 +1,7 @@
[gd_resource type="Resource" script_class="CurrencyGeneratorData" format=3 uid="uid://04pmc034qupd"]
[ext_resource type="Script" uid="uid://dnhocfsuvmeyb" path="res://core/generator/generator_buff_data.gd" id="1_d86db"]
[ext_resource type="Script" uid="uid://b00tqsuhxdy0d" path="res://core/generator/currency_generator_data.gd" id="1_s3g28"]
[ext_resource type="Resource" uid="uid://b4ne724qqo4d8" path="res://idles/buffs/knowledge_auto_treatise.tres" id="2_kxvfc"]
[ext_resource type="Resource" uid="uid://l5a300wieavc" path="res://idles/buffs/knowledge_click_notes.tres" id="3_q64x8"]
[ext_resource type="Resource" uid="uid://dxljqpqhdfqn6" path="res://idles/buffs/knowledge_grant_program.tres" id="4_l77sg"]
[resource]
script = ExtResource("1_s3g28")
@@ -15,5 +13,4 @@ initial_cost = 60.0
initial_time = 3.0
initial_revenue = 60.0
initial_productivity = 20.0
buffs = [ExtResource("2_kxvfc"), ExtResource("3_q64x8"), ExtResource("4_l77sg")]
metadata/_custom_type_script = "uid://b00tqsuhxdy0d"

View File

@@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="GeneratorUnlockGoalData" format=3 uid="uid://mnuihnwb70ba"]
[ext_resource type="Script" uid="uid://dt4df3gwr6n5m" path="res://core/generator-unlock-goals/generator_unlock_goal_data.gd" id="1_hv2u1"]
[ext_resource type="Resource" uid="uid://qyxct5gbrxwa" path="res://idles/goals/magic_total_30.tres" id="2_7r0qe"]
[resource]
script = ExtResource("1_hv2u1")
target_generator_id = &"Knowledge"
goal = ExtResource("2_7r0qe")

View File

@@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="GeneratorUnlockGoalData" format=3 uid="uid://8wrqdjewfdq5"]
[ext_resource type="Script" uid="uid://dt4df3gwr6n5m" path="res://core/generator-unlock-goals/generator_unlock_goal_data.gd" id="1_phux3"]
[ext_resource type="Resource" uid="uid://bmlhoeasl7xor" path="res://idles/goals/magic_total_1300.tres" id="2_w06cq"]
[resource]
script = ExtResource("1_phux3")
target_generator_id = &"Wood"
goal = ExtResource("2_w06cq")

View File

@@ -0,0 +1,16 @@
[gd_resource type="Resource" script_class="GoalData" format=3 uid="uid://bmlhoeasl7xor"]
[ext_resource type="Script" uid="uid://dx4kmh33rrkpy" path="res://core/goals/goal_data.gd" id="1_b11ou"]
[ext_resource type="Script" uid="uid://r4js5eajolio" path="res://core/goals/goal_requirement_data.gd" id="2_d507t"]
[ext_resource type="Resource" uid="uid://brqaojindcxa5" path="res://idles/currencies/magic.tres" id="3_tu3fx"]
[sub_resource type="Resource" id="Resource_tvl3d"]
script = ExtResource("2_d507t")
currency = ExtResource("3_tu3fx")
amount_mantissa = 1.3
amount_exponent = 3
[resource]
script = ExtResource("1_b11ou")
id = &"magic_total_1300"
requirements = Array[ExtResource("2_d507t")]([SubResource("Resource_tvl3d")])

View File

@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="GoalData" format=3 uid="uid://qyxct5gbrxwa"]
[ext_resource type="Script" uid="uid://dx4kmh33rrkpy" path="res://core/goals/goal_data.gd" id="1_rh4uj"]
[ext_resource type="Script" uid="uid://r4js5eajolio" path="res://core/goals/goal_requirement_data.gd" id="2_58n5q"]
[ext_resource type="Resource" uid="uid://brqaojindcxa5" path="res://idles/currencies/magic.tres" id="3_qm5e7"]
[sub_resource type="Resource" id="Resource_v4v16"]
script = ExtResource("2_58n5q")
currency = ExtResource("3_qm5e7")
amount_mantissa = 30.0
[resource]
script = ExtResource("1_rh4uj")
id = &"magic_total_30"
requirements = Array[ExtResource("2_58n5q")]([SubResource("Resource_v4v16")])