diff options
| author | metamuffin <metamuffin@disroot.org> | 2024-06-26 15:43:57 +0200 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2024-06-26 15:43:57 +0200 |
| commit | c4b0f8d698b574c711b1e205371adfd3e3339487 (patch) | |
| tree | 78ccefcc40f02a2579ade4cb5968cd2c2661d7af /client/global.gd | |
| parent | fd2d5455339a61d8b38bcb47fa40e094ef61856c (diff) | |
| parent | 1bc6e59a4dbef9d2770fc5264acd9fda2195872d (diff) | |
| download | hurrycurry-c4b0f8d698b574c711b1e205371adfd3e3339487.tar hurrycurry-c4b0f8d698b574c711b1e205371adfd3e3339487.tar.bz2 hurrycurry-c4b0f8d698b574c711b1e205371adfd3e3339487.tar.zst | |
Merge branch 'master' of https://codeberg.org/metamuffin/undercooked
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) |