extends Node

@export var simulation_manager: Node

var store := SaveSlotStore.new()


func _unhandled_key_input(event: InputEvent) -> void:
	if not event.pressed or event.echo:
		return
	if event.keycode == KEY_F5:
		if store.save(simulation_manager):
			print("[SaveSlot] Quicksave written")
		else:
			push_error("[SaveSlot] " + store.last_error)
		get_viewport().set_input_as_handled()
	elif event.keycode == KEY_F9:
		if store.load_into(simulation_manager):
			print("[SaveSlot] Quicksave restored")
		else:
			push_error("[SaveSlot] " + store.last_error)
		get_viewport().set_input_as_handled()
