beta-1.4/persistence-implementation (#3)

Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
2026-03-19 13:27:37 -06:00
parent bfe4f7d6a9
commit 5fb4a96159
26 changed files with 277 additions and 15 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()