Create persistence manager and connectors for chests and gates

This commit is contained in:
2026-03-19 14:26:57 -05:00
parent 31567f53fb
commit 9fcd24f8b5
14 changed files with 163 additions and 9 deletions

View File

@@ -0,0 +1,21 @@
extends Node
@export var chests: Array[NodePath]
# Private Methods
func _ready() -> void:
for relative_node_path in chests:
var chest: BaseChest = get_node(relative_node_path)
var node_path := chest.get_path()
chest.ChestOpened.connect(func(): _on_chest_opened(chest))
if PersistenceManager.HasData(node_path):
var chest_opened: bool = PersistenceManager.GetData(node_path)
if chest_opened:
chest.call_deferred("SetOpenedFromLoad")
func _on_chest_opened(chest: BaseChest) -> void:
var node_path := chest.get_path()
PersistenceManager.UpdateData(node_path, true)
PersistenceManager.SaveToDisk()