From 0e8c607ae4fa9e09b56bd0ab4c112dec668941ed Mon Sep 17 00:00:00 2001 From: tpart Date: Wed, 26 Jun 2024 12:51:39 +0200 Subject: Make hairstyle visible in multiplayer; Refactor settings to use godot's built-in system --- client/global.gd | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'client/global.gd') 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) -- cgit v1.2.3-70-g09d2