@ -18,6 +18,8 @@ signal load_error(error_message: String)
signal load_save ( filename : String ) ## Loads the save into memory. Does NOT apply the load as this allows for other actions (such as resetting the levle/world).[br]Don't forget to run `apply_save` after loading
signal save_complete
signal save_error ( error_message : String )
signal start_autosave
signal stop_autosave
signal quick_save
signal quick_load
@ -37,13 +39,15 @@ func _ready() -> void:
load_save . connect ( _on_load_game_save )
quick_load . connect ( _on_quick_load )
quick_save . connect ( _on_quick_save )
start_autosave . connect ( _on_start_autosave )
stop_autosave . connect ( _on_stop_autosave )
toggle_save_icon_generation . connect ( _on_toggle_save_icon_generation )
func _unhandled_input ( event : InputEvent ) - > void :
if event . is_action_pressed ( " quick_save " ) :
_on_ quick_save( )
quick_save . emit ( )
if event . is_action_pressed ( " quick_load " ) :
_on_ quick_load( )
quick_load . emit ( )
func list_saves ( include_quick_saves : bool = true , include_auto_saves : bool = true ) - > Array [ SaveFileDetailsResource ] :
@ -231,3 +235,22 @@ func _on_save_game_as_resource(save_name: String) -> void:
func _on_toggle_save_icon_generation ( toggled : bool ) - > void :
_enable_save_icon_generation = toggled
func _on_start_autosave ( ) - > void :
if _save_game_settings == null : _load_save_settings ( )
var autosave_timer : Timer = get_node_or_null ( " AutosaveTimer " )
if autosave_timer == null :
autosave_timer = Timer . new ( )
autosave_timer . name = " AutosaveTimer "
autosave_timer . one_shot = false
autosave_timer . timeout . connect ( _on_autosave_timer_timeout )
add_child ( autosave_timer )
autosave_timer . start ( _save_game_settings . autosave_duration )
func _on_stop_autosave ( ) - > void :
var autosave_timer : Timer = get_node_or_null ( " AutosaveTimer " )
if autosave_timer == null : return
autosave_timer . stop ( )