From 678bb9becec49df677ff647799706df00f588ba3 Mon Sep 17 00:00:00 2001 From: nokoe Date: Thu, 4 Jul 2024 12:35:13 +0200 Subject: enable/disable voxelgi when game is running --- client/map/map.gd | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'client') diff --git a/client/map/map.gd b/client/map/map.gd index f711c603..4c7136c7 100644 --- a/client/map/map.gd +++ b/client/map/map.gd @@ -3,6 +3,7 @@ extends Node3D var tile_by_pos: Dictionary = {} var autobake = false +var currently_baked = false func get_tile_name(pos: Vector2i): var e = tile_by_pos.get(str(pos)) @@ -34,10 +35,19 @@ 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("voxel_gi") and not currently_baked: + gi_bake() + else: + currently_baked = false + voxelgi.data = null + ) func gi_bake(): if not Global.get_setting("voxel_gi"): return print("Map: Rebaking VoxelGI") + currently_baked = true gi_bake_blocking() func gi_bake_blocking(): -- cgit v1.2.3-70-g09d2