diff options
Diffstat (limited to 'client/system/settings.gd')
-rw-r--r-- | client/system/settings.gd | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/client/system/settings.gd b/client/system/settings.gd index a3aece89..cd990216 100644 --- a/client/system/settings.gd +++ b/client/system/settings.gd @@ -123,16 +123,16 @@ static func save(): f.store_string(JSON.stringify(changed)) static func trigger_hook(key: String, value): - if change_hooks_display.get(key) != null: change_hooks_display.get(key).callv([value] if value != null else []) - if change_hooks_apply.get(key) != null: change_hooks_apply.get(key).callv([value] if value != null else []) + for slot in change_hooks.get(key, {}): + change_hooks[key][slot].callv([value] if value != null else []) if key.find(".") != -1: trigger_hook(key.rsplit(".", false, 1)[0], null) -static func hook_changed(key: String, display: bool, callable: Callable): - if display: change_hooks_display[key] = callable - else: change_hooks_apply[key] = callable +static func hook_changed(key: String, slot: String, callable: Callable): + if not change_hooks.has(key): change_hooks[key] = {} + change_hooks[key][slot] = callable -static func hook_changed_init(key: String, display: bool, callable: Callable): - hook_changed(key, display, callable) +static func hook_changed_init(key: String, slot: String, callable: Callable): + hook_changed(key, slot, callable) callable.call(read(key)) static func get_category_dict(prefix: String): @@ -146,19 +146,18 @@ static func get_category_dict(prefix: String): static func launch_setup(): Global.focused_menu.submenu("res://gui/menus/setup/setup.tscn") -static var change_hooks_display = {} -static var change_hooks_apply = { - "input": h_input, - "gameplay.hints_started": h_hints_started, - "graphics.aa": h_aa, - "graphics.taa": h_taa, - "graphics.fullscreen": h_fullscreen, - "ui.scale_mode": h_scale_mode, - "ui.scale_factor": h_scale_factor, - "ui.language": h_language, - "audio.master_volume": h_volume_master, - "audio.music_volume": h_volume_music, - "audio.sfx_volume": h_volume_sfx, +static var change_hooks = { + "input": { "static": h_input }, + "gameplay.hints_started": { "static": h_hints_started }, + "graphics.aa": { "static": h_aa }, + "graphics.taa": { "static": h_taa }, + "graphics.fullscreen": { "static": h_fullscreen }, + "ui.scale_mode": { "static": h_scale_mode }, + "ui.scale_factor": { "static": h_scale_factor }, + "ui.language": { "static": h_language }, + "audio.master_volume": { "static": h_volume_master }, + "audio.music_volume": { "static": h_volume_music }, + "audio.sfx_volume": { "static": h_volume_sfx }, } static func h_aa(_mode): |