Browse Source

Standardizing autosave name

pull/19/head
Ryan Reed 1 month ago
parent
commit
858dc90b29
2 changed files with 6 additions and 6 deletions
  1. +5
    -5
      addons/save_load_system/autoloads/save_game_manager.gd
  2. +1
    -1
      addons/save_load_system/resources/save_game_settings_resource.gd

+ 5
- 5
addons/save_load_system/autoloads/save_game_manager.gd View File

@ -9,9 +9,9 @@ extends Node
signal apply_complete
signal apply_save ## Apply the loaded data to the tree. Note: This should happen AFTER load_save()
signal autosave_start ## Autosave has started
signal autosave_complete ## Autosave has completed
signal create_auto_save
signal autosave_start ## Autosave has started
signal create_autosave
signal create_save(save_name: String)
signal delete_save(filename: String)
signal delete_error(error_message: String)
@ -58,7 +58,7 @@ func _unhandled_input(event: InputEvent) -> void:
quick_load.emit()
func list_saves(include_quick_saves: bool = true, include_auto_saves: bool = true) -> Array[SaveFileDetailsResource]:
func list_saves(include_quick_saves: bool = true, include_autosaves: bool = true) -> Array[SaveFileDetailsResource]:
var save_files: Array[SaveFileDetailsResource] = []
if not _load_save_settings():
return save_files
@ -71,7 +71,7 @@ func list_saves(include_quick_saves: bool = true, include_auto_saves: bool = tru
# TODO: Rework so the settings determine the file_name using prepends
if filename.begins_with(_save_game_settings.quicksave_file_name_prepend) and not include_quick_saves:
continue
elif filename.begins_with(_save_game_settings.autosave_file_name_prepend) and not include_auto_saves:
elif filename.begins_with(_save_game_settings.autosave_file_name_prepend) and not include_autosaves:
continue
elif !filename.begins_with(_save_game_settings.save_file_name_prepend) and !filename.begins_with(_save_game_settings.quicksave_file_name_prepend) and !filename.begins_with(_save_game_settings.autosave_file_name_prepend):
continue
@ -188,7 +188,7 @@ func _move_autosaves() -> void:
if !filename.ends_with(".tres"): continue
autosaves.append(filename)
if autosaves.size() == _save_game_settings.max_auto_saves: # Delete oldest save
if autosaves.size() == _save_game_settings.max_autosaves: # Delete oldest save
DirAccess.remove_absolute(_save_game_settings.save_game_data_path + autosaves.pop_back())
var filepath: String = _save_game_settings.save_game_data_path + _save_game_settings.autosave_file_name_prepend


+ 1
- 1
addons/save_load_system/resources/save_game_settings_resource.gd View File

@ -8,7 +8,7 @@ extends Resource
## * macOS: ~/Library/Application Support/Godot/app_userdata/[project_name][br]
## * Linux: ~/.local/share/godot/app_userdata/[project_name][br]
@export var save_game_data_path: String = "user://game_data/"
@export var max_auto_saves: int = 5
@export var max_autosaves: int = 5
@export var autosave_duration: int = 60 ## How often, in seconds, should an autosave run[br]SaveGameManager will NOT autostart the autosave timer. This must be done by the world/scene.


Loading…
Cancel
Save