fix: Pause Menu now halts the app state and restores it, and ensures savegame

This commit is contained in:
tiger tiger tiger 2026-01-22 18:41:44 +01:00
parent d58225f21b
commit b57aa76e23
2 changed files with 4 additions and 1 deletions

View File

@ -111,7 +111,7 @@ var last_mode := DisplayServer.WINDOW_MODE_WINDOWED
func _unhandled_input(event: InputEvent) -> void:
#if event.is_action_type(): print_debug("Unhandled Input", event)
if event.is_action_pressed("ui_pause"):
if event.is_action_pressed("ui_pause") and state == AppState.PLAY:
state = AppState.PAUSE
get_viewport().set_input_as_handled()

View File

@ -21,6 +21,8 @@ func _on_help_pressed():
var last_mouse_mode: Input.MouseMode
func appear():
State.save_game.save_to_file(get_tree().root.get_texture())
get_tree().paused = true
show()
last_mouse_mode = Input.mouse_mode
@ -29,6 +31,7 @@ func appear():
func disappear():
Main.state = Main.AppState.PLAY
hide()
Input.mouse_mode = last_mouse_mode
get_tree().paused = false