From 06baf4555dc1c7a64bed7d059fbe34c99e9638fb Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 6 Sep 2024 23:43:42 +0200 Subject: refactor settings again (part 1) --- client/map/map.gd | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'client/map/map.gd') diff --git a/client/map/map.gd b/client/map/map.gd index 208665bf..fc3bd1bb 100644 --- a/client/map/map.gd +++ b/client/map/map.gd @@ -52,17 +52,18 @@ func clear_tile(pos: Vector2i): func _ready(): voxelgi_timer.connect("timeout", gi_bake) - Global.settings_changed.connect(func(): - # is not baked yet but setting is true - if Global.get_setting("gi") == 2 and not currently_baked: - gi_bake() - else: - currently_baked = false - voxelgi.data = null - ) + Settings.hook_changed("graphics.gi", apply_gi_setting) + +func apply_gi_setting(state): + if state == "voxelgi" and not currently_baked: + gi_bake() + else: + currently_baked = false + voxelgi.data = null + func gi_bake(): - if not Global.get_setting("gi") == 2: return + if not Global.get_setting("graphics.gi") == 2: return print("Map: Rebaking VoxelGI") currently_baked = true gi_bake_blocking() -- cgit v1.2.3-70-g09d2