Refactor state management; update unlock logic and enhance signal bindings in scene

This commit is contained in:
Kirill
2026-09-01 23:53:05 +03:00
parent 2f4b6a98d8
commit 0162084e53
3 changed files with 58 additions and 47 deletions
+6 -6
View File
@@ -97,7 +97,7 @@ func _unlock_items():
#print(_item_id ' | ', _entity.unlock)
var _flag_to_unlock = true
for _elem in owniverse.entities[_item_id].unlock:
if owniverse.stats.total_amount[_elem] < owniverse.entities[_item_id].unlock[_elem]:
if owniverse.state.stats.total_amount[_elem] < owniverse.entities[_item_id].unlock[_elem]:
_flag_to_unlock = false
break
@@ -246,7 +246,7 @@ func _set_active_page_actions() -> void:
#var amount = owniverse.get_available_to_produce(entity)
var amount = owniverse.calculate_max_producible(entity)
print(item_id, " : ", amount)
#print(item_id, " : ", amount)
page_actions[pa].set_actions(item_id, amount)
@@ -264,8 +264,8 @@ func _page_action_pressed(page_id: int, action_amount: float) -> void:
func _ready() -> void:
var _output = owniverse.init_enitities()
locked_items = _output.locked_items
var inited_result = owniverse.init_enitities()
locked_items = inited_result.locked_items
owniverse.load_data()
_init_owniverse_items()
@@ -278,7 +278,7 @@ func _ready() -> void:
func _process(delta: float) -> void:
owniverse = owniverse.evolute(delta)
owniverse.evolute(delta)
set_datetime(owniverse.state.year)
#owniverse.cycle(delta)
@@ -315,7 +315,7 @@ func _change_speed(delta: int) -> void:
func _on_topmenu_button_pressed(ButtonName) -> void:
print(ButtonName)
print("Debug: ", owniverse.state)
#var s: float = 1E15
#var z = 1.0
#for i in range(30):