Move generator panel ui inside generator

This commit is contained in:
2026-03-20 00:50:49 +01:00
parent bcf228447d
commit 64e9fbbe6f
6 changed files with 61 additions and 52 deletions

View File

@@ -34,7 +34,8 @@ const HUGE_COST_EXPONENT: int = 1000000
## Extra multiplier applied to automatic production output.
@export var run_multiplier: float = 1.0
## Reference to generator UI
@onready var info_generator_container: GeneratorPanel = $GeneratorPanel
## True while the pointer is inside the generator Area2D.
var _mouse_entered: bool = false
@@ -85,14 +86,13 @@ var _generator_id: StringName = &""
## Prevents duplicate state registration in GameState.
var _is_registered: bool = false
## Resolves and registers this generator state before gameplay updates.
func _ready() -> void:
assert(currency != null, "Currency cannot be null")
assert(data != null, "Data cannot be null")
_generator_id = _resolve_generator_id()
_ensure_registered()
#_ensure_registered()
cycle_progress_seconds = 0.0
GameState.currency_changed.connect(_on_currency_changed)
@@ -559,10 +559,13 @@ func _default_available_state() -> bool:
## Area2D callback: pointer entered generator interaction region.
func _on_area_2d_mouse_entered() -> void:
_mouse_entered = true
info_generator_container.visible = true
## Area2D callback: pointer exited generator interaction region.
func _on_area_2d_mouse_exited() -> void:
_mouse_entered = false
info_generator_container.visible = false
func _on_generated_state_changed(generator_id: StringName, _state: Dictionary) -> void:
if generator_id == _generator_id: