diff options
Diffstat (limited to 'client/global.gd')
| -rw-r--r-- | client/global.gd | 32 | 
1 files changed, 24 insertions, 8 deletions
| diff --git a/client/global.gd b/client/global.gd index a09f8696..095deec8 100644 --- a/client/global.gd +++ b/client/global.gd @@ -1,3 +1,20 @@ +# Undercooked - a game about cooking +# Copyright 2024 metamuffin +# Copyright 2024 tpart +# Copyright 2024 nokoe +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program.  If not, see <https://www.gnu.org/licenses/>. +#  extends Node  const DEFAULT_SETTINGS := { @@ -17,7 +34,7 @@ func _ready():  func save_profile():  	var f = FileAccess.open("user://profile", FileAccess.WRITE)  	f.store_var(settings.duplicate(true)) -	 +  	print("Saved settings: ", settings)  func load_profile(): @@ -26,11 +43,10 @@ func load_profile():  		print("Skip profile load")  		return  	var f = FileAccess.open("user://profile", FileAccess.READ) -	settings = f.get_var() -	 -	# Add missing keys -	for k in DEFAULT_SETTINGS.keys(): -		if !settings.has(k): -			settings[k] = DEFAULT_SETTINGS[k] -	 +	var saved_settings = f.get_var() +	if saved_settings != null and saved_settings is Dictionary: +		for i in DEFAULT_SETTINGS.keys(): +			if saved_settings.has(i): +				settings[i] = saved_settings[i] +  	print("Loaded settings: ", settings) | 
