feat: add validated quicksave persistence
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user