@ -14,6 +14,9 @@ signal graphics_vsync_changed(vsync_enabled: bool)
signal graphics_fov_changed ( fov : int )
#endregion
signal load_settings
signal save_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]
## Default Paths:[br]
@ -37,15 +40,18 @@ func _init() -> void:
graphics_vsync_changed . connect ( _on_graphics_vsync_changed )
apply_graphics_settings . connect ( _on_apply_graphics_settings )
load_settings . connect ( _on_load_settings )
save_settings . connect ( _on_save_settings )
#region Game Option Settings
func _on_game_options_block_highlight_changed ( highlight_enabled : bool ) - > void :
settings . game_options . enable_block_highlight = highlight_enabled
save_settings ( )
_on_ save_settings( )
func _on_game_options_waila_changed ( waila_enabled : bool ) - > void :
settings . game_options . enable_waila = waila_enabled
save_settings ( )
_on_ save_settings( )
#endregion
#region Graphics Settings
@ -62,7 +68,7 @@ func _on_apply_graphics_settings() -> void:
else :
DisplayServer . window_set_vsync_mode ( DisplayServer . VSYNC_DISABLED )
save_settings ( )
_on_ save_settings( )
func _on_graphics_fov_changed ( fov : int ) - > void :
settings . graphics . fov = fov
@ -78,7 +84,7 @@ func _on_graphics_vsync_changed(vsync_enabled: bool) -> void:
#endregion
#region Saving and Loading Settings
func load_settings ( apply_after_load : bool = true ) - > void :
func _on_ load_settings( apply_after_load : bool = true ) - > void :
if ! FileAccess . file_exists ( settings_file_path ) :
printerr ( " Failed to load game settings. File does not exist: " , settings_file_path )
return
@ -91,7 +97,7 @@ func load_settings(apply_after_load: bool = true) -> void:
if apply_after_load :
apply_graphics_settings . emit ( )
func save_settings ( ) - > void :
func _on_ save_settings( ) - > void :
if ! DirAccess . dir_exists_absolute ( save_data_path ) :
DirAccess . make_dir_absolute ( save_data_path )