From 6827bcb83bb42d2ce30a881e569a4926cdc1635f Mon Sep 17 00:00:00 2001 From: Nitwel Date: Mon, 13 Nov 2023 23:25:59 +0100 Subject: [PATCH] fix move events not firing --- content/entities/light/light.tscn | 32 +++++++++++++++---------------- content/raycast.gd | 9 ++++----- lib/home_adapters/hass_ws/hass.gd | 4 ++++ 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/content/entities/light/light.tscn b/content/entities/light/light.tscn index e5b27b2..e3d21a6 100644 --- a/content/entities/light/light.tscn +++ b/content/entities/light/light.tscn @@ -23,22 +23,6 @@ animations = [{ "speed": 5.0 }] -[sub_resource type="Animation" id="Animation_7o31s"] -resource_name = "light" -length = 0.3 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("CSGCombiner3D:material_override:albedo_color") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.3), -"transitions": PackedFloat32Array(1, 1), -"update": 0, -"values": [Color(1, 0.85098, 0, 1), Color(0.231373, 0.231373, 0.231373, 1)] -} - [sub_resource type="Animation" id="Animation_afofi"] length = 0.001 tracks/0/type = "value" @@ -66,6 +50,22 @@ tracks/1/keys = { "values": [Vector3(0, 0.0492394, -0.0903599)] } +[sub_resource type="Animation" id="Animation_7o31s"] +resource_name = "light" +length = 0.3 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("CSGCombiner3D:material_override:albedo_color") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.3), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 0.85098, 0, 1), Color(0.231373, 0.231373, 0.231373, 1)] +} + [sub_resource type="AnimationLibrary" id="AnimationLibrary_8a76q"] _data = { "RESET": SubResource("Animation_afofi"), diff --git a/content/raycast.gd b/content/raycast.gd index 1e8aabb..7ffae18 100644 --- a/content/raycast.gd +++ b/content/raycast.gd @@ -23,20 +23,19 @@ func _handle_move(): return var distance = ray.get_collision_point().distance_to(_click_point) - var collider = ray.get_collider() - if distance > 0.02: + if _moved || distance > 0.02: if _is_pressed: - _call_fn(collider, "_on_press_move") + _call_fn(_last_collided, "_on_press_move") _moved = true if _is_grabbed: - _call_fn(collider, "_on_grab_move") + _call_fn(_last_collided, "_on_grab_move") _moved = true func _handle_enter_leave(): var collider = ray.get_collider() - if collider == _last_collided: + if collider == _last_collided || _is_grabbed || _is_pressed: return _call_fn(collider, "_on_ray_enter") diff --git a/lib/home_adapters/hass_ws/hass.gd b/lib/home_adapters/hass_ws/hass.gd index 3d30bef..bf912f7 100644 --- a/lib/home_adapters/hass_ws/hass.gd +++ b/lib/home_adapters/hass_ws/hass.gd @@ -7,6 +7,10 @@ var request_timeout := 10.0 var url := "ws://192.168.33.33:8123/api/websocket" var token := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIzZjQ0ZGM2N2Y3YzY0MDc1OGZlMWI2ZjJlNmIxZjRkNSIsImlhdCI6MTY5ODAxMDcyOCwiZXhwIjoyMDEzMzcwNzI4fQ.K6ydLUC-4Q7BNIRCU1nWlI2s6sg9UCiOu-Lpedw2zJc" + +# var url := "wss://8ybjhqcinfcdyvzu.myfritz.net:8123/api/websocket" +# var token := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjNjU0ZDE3NDc2ZGM0NzU1OGY5NjIzMmM5ZjdjYzE2YSIsImlhdCI6MTY5OTgyMzcxOCwiZXhwIjoyMDE1MTgzNzE4fQ.XHlfnXUd16HaV9XjYrxzuNg23nFFeoEsIsaMVXwRkd8" + var LOG_MESSAGES := false var authenticated := false