feat: add validated quicksave persistence

This commit is contained in:
2026-07-05 18:10:33 +02:00
parent 2fcf641152
commit 08b7bee0e5
10 changed files with 264 additions and 0 deletions
+17
View File
@@ -99,6 +99,23 @@ func _run() -> void:
"Active position callback should synchronize simulation state"
)
var saved_state: String = manager.serialize_state()
var visual_before_restore: Node3D = view.active_npc_visuals[npc.id]
npc.hunger = 99.0
_check(
manager.restore_state_from_json(saved_state),
"Visual lifecycle scenario should restore valid state"
)
var visual_after_restore: Node3D = view.active_npc_visuals[npc.id]
_check(
visual_after_restore != visual_before_restore,
"State restoration should rebuild active NPC presentation"
)
_check(
visual_after_restore.global_position.is_equal_approx(npc.position),
"Rebuilt presentation should use the restored authoritative position"
)
if failures.is_empty():
print("[TEST] NPC visual lifecycle passed")
quit(0)