@ -16,8 +16,8 @@ signal graphics_vsync_changed(vsync_enabled: bool)
signal graphics_fov_changed ( fov : int )
signal graphics_fov_changed ( fov : int )
#endregion
#endregion
signal load_settings
signal save_settings
signal load_game_ settings
signal save_game_ settings
## See documentation to where this path is: https://docs.godotengine.org/en/stable/tutorials/io/data_paths.html#accessing-persistent-user-data-user[br][br]
## See documentation to where this path is: https://docs.godotengine.org/en/stable/tutorials/io/data_paths.html#accessing-persistent-user-data-user[br][br]
@ -44,26 +44,26 @@ func _init() -> void:
graphics_vsync_changed . connect ( _on_graphics_vsync_changed )
graphics_vsync_changed . connect ( _on_graphics_vsync_changed )
apply_graphics_settings . connect ( _on_apply_graphics_settings )
apply_graphics_settings . connect ( _on_apply_graphics_settings )
load_settings . connect ( _on_ load_settings)
save_settings . connect ( _on_ save_settings)
load_game_ settings . connect ( load_settings )
save_game_ settings . connect ( save_settings )
#region Game Option Settings
#region Game Option Settings
func _on_game_options_block_highlight_changed ( highlight_enabled : bool ) - > void :
func _on_game_options_block_highlight_changed ( highlight_enabled : bool ) - > void :
settings . game_options . enable_block_highlight = highlight_enabled
settings . game_options . enable_block_highlight = highlight_enabled
_on_ save_settings( )
save_settings ( )
func _on_game_options_held_block_ui_changed ( held_block_enabled : bool ) - > void :
func _on_game_options_held_block_ui_changed ( held_block_enabled : bool ) - > void :
settings . game_options . enable_held_block = held_block_enabled
settings . game_options . enable_held_block = held_block_enabled
_on_ save_settings( )
save_settings ( )
func _on_game_options_quickslots_ui_changed ( quickslots_enabled : bool ) - > void :
func _on_game_options_quickslots_ui_changed ( quickslots_enabled : bool ) - > void :
settings . game_options . enable_quickslots_ui = quickslots_enabled
settings . game_options . enable_quickslots_ui = quickslots_enabled
_on_ save_settings( )
save_settings ( )
func _on_game_options_waila_changed ( waila_enabled : bool ) - > void :
func _on_game_options_waila_changed ( waila_enabled : bool ) - > void :
settings . game_options . enable_waila = waila_enabled
settings . game_options . enable_waila = waila_enabled
_on_ save_settings( )
save_settings ( )
#endregion
#endregion
#region Graphics Settings
#region Graphics Settings
@ -80,7 +80,7 @@ func _on_apply_graphics_settings() -> void:
else :
else :
DisplayServer . window_set_vsync_mode ( DisplayServer . VSYNC_DISABLED )
DisplayServer . window_set_vsync_mode ( DisplayServer . VSYNC_DISABLED )
_on_ save_settings( )
save_settings ( )
func _on_graphics_fov_changed ( fov : int ) - > void :
func _on_graphics_fov_changed ( fov : int ) - > void :
settings . graphics . fov = fov
settings . graphics . fov = fov
@ -98,7 +98,7 @@ func _on_graphics_vsync_changed(vsync_enabled: bool) -> void:
#region Saving and Loading Settings
#region Saving and Loading Settings
func _on_ load_settings( apply_after_load : bool = true ) - > void :
func load_settings ( apply_after_load : bool = true ) - > void :
if ! FileAccess . file_exists ( settings_file_path ) :
if ! FileAccess . file_exists ( settings_file_path ) :
printerr ( " Failed to load game settings. File does not exist: " , settings_file_path )
printerr ( " Failed to load game settings. File does not exist: " , settings_file_path )
return
return
@ -111,7 +111,7 @@ func _on_load_settings(apply_after_load: bool = true) -> void:
if apply_after_load :
if apply_after_load :
apply_graphics_settings . emit ( )
apply_graphics_settings . emit ( )
func _on_ save_settings( ) - > void :
func save_settings ( ) - > void :
if ! DirAccess . dir_exists_absolute ( save_data_path ) :
if ! DirAccess . dir_exists_absolute ( save_data_path ) :
DirAccess . make_dir_absolute ( save_data_path )
DirAccess . make_dir_absolute ( save_data_path )