feat: add typed pantry storage site

This commit is contained in:
2026-07-07 12:57:47 +02:00
parent 33b9c1bdfb
commit e5bd93d705
16 changed files with 304 additions and 69 deletions
+19
View File
@@ -48,6 +48,7 @@ func _ready() -> void:
village.update_priorities()
generate_npcs()
call_deferred("register_loaded_resource_nodes")
call_deferred("register_loaded_storage_nodes")
if debug_logs:
print("--- Simulation started ---")
@@ -430,6 +431,24 @@ func get_pantry() -> StorageStateRecord:
return storage_states.get(SimulationIds.STORAGE_VILLAGE_PANTRY) as StorageStateRecord
func register_loaded_storage_nodes() -> void:
for node in StorageNode.get_all():
register_storage_node(node)
func register_storage_node(node: StorageNode) -> bool:
if node == null or node.storage_id.is_empty():
return false
var storage_state := storage_states.get(node.storage_id) as StorageStateRecord
if storage_state == null:
push_error(
"SimulationManager: StorageNode '%s' has no authoritative StorageStateRecord"
% node.storage_id
)
return false
return node.bind_state(storage_state)
func _sync_village_food() -> void:
var pantry := get_pantry()
if pantry != null: