From d91b2fb5fc1a25410446cb6d040ebfd28bb21e23 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Tue, 12 Mar 2024 12:34:44 +0100 Subject: [PATCH] fix reoccurring errors and clean code --- content/functions/occludable.gd | 4 +--- content/main.gd | 2 -- content/ui/components/button/button.gd | 3 +++ lib/home_apis/hass_ws/hass.gd | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/content/functions/occludable.gd b/content/functions/occludable.gd index e0bf7a2..432b004 100644 --- a/content/functions/occludable.gd +++ b/content/functions/occludable.gd @@ -12,11 +12,9 @@ func _ready(): EventSystem.on_slow_tick.connect(_slow_tick) func _slow_tick(_delta): - if player_camera.is_inside_tree() == false: - printerr("Player camera is not inside the tree") + if player_camera.is_inside_tree() == false||ray.is_inside_tree() == false: return ray.target_position = get_parent().to_local(player_camera.global_position) get_parent().visible = ray.is_colliding() == false - diff --git a/content/main.gd b/content/main.gd index 6cc7fcf..d42c1a7 100644 --- a/content/main.gd +++ b/content/main.gd @@ -89,11 +89,9 @@ func _physics_process(delta): if room != last_room: if room: - print("Room changed to: ", room.name) HomeApi.api.update_room(room.name) last_room = room else: - print("Room changed to: ", "outside") HomeApi.api.update_room("outside") last_room = null diff --git a/content/ui/components/button/button.gd b/content/ui/components/button/button.gd index bcc14ea..31b9372 100644 --- a/content/ui/components/button/button.gd +++ b/content/ui/components/button/button.gd @@ -99,6 +99,9 @@ func _ready(): func update_animation(): var length = animation_player.get_animation("down").length + if animation_player.current_animation == "": + return + if active&&animation_player.current_animation_position != length: animation_player.play("down") elif !active&&animation_player.current_animation_position != 0: diff --git a/lib/home_apis/hass_ws/hass.gd b/lib/home_apis/hass_ws/hass.gd index ca1402c..fd6a16d 100644 --- a/lib/home_apis/hass_ws/hass.gd +++ b/lib/home_apis/hass_ws/hass.gd @@ -263,4 +263,4 @@ func update_room(room: String): }) if response.status == Promise.Status.RESOLVED: - print("Room updated") \ No newline at end of file + pass \ No newline at end of file