diff options
author | tpart <tpart120@proton.me> | 2024-06-26 12:51:39 +0200 |
---|---|---|
committer | tpart <tpart120@proton.me> | 2024-06-26 12:51:39 +0200 |
commit | 0e8c607ae4fa9e09b56bd0ab4c112dec668941ed (patch) | |
tree | 1c7a6c44b40cbbdb771498d6ad4b8ab24f05cd19 /client/global.gd | |
parent | 5cfdd1ce41240b4b4ffff225cf8b70470f30f33d (diff) | |
download | hurrycurry-0e8c607ae4fa9e09b56bd0ab4c112dec668941ed.tar hurrycurry-0e8c607ae4fa9e09b56bd0ab4c112dec668941ed.tar.bz2 hurrycurry-0e8c607ae4fa9e09b56bd0ab4c112dec668941ed.tar.zst |
Make hairstyle visible in multiplayer; Refactor settings to use godot's built-in system
Diffstat (limited to 'client/global.gd')
-rw-r--r-- | client/global.gd | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/client/global.gd b/client/global.gd index 6d4cf4fc..70601eae 100644 --- a/client/global.gd +++ b/client/global.gd @@ -14,20 +14,22 @@ func _ready(): load_profile() func save_profile(): - print("Save profile") var f = FileAccess.open("user://profile", FileAccess.WRITE) - f.store_line(JSON.stringify(settings)) + f.store_var(settings.duplicate(true)) + + print("Saved settings: ", settings) func load_profile(): # TOCTOU here. Godot docs says its fine. if not FileAccess.file_exists("user://profile"): print("Skip profile load") return - print("Load profile") var f = FileAccess.open("user://profile", FileAccess.READ) - settings = JSON.parse_string(f.get_line()) + settings = f.get_var() # Add missing keys for k in DEFAULT_SETTINGS.keys(): if !settings.has(k): settings[k] = DEFAULT_SETTINGS[k] + + print("Loaded settings: ", settings) |