From 0fee21ccdb05a505b5bdb3920b64b62d311d6eb3 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Tue, 28 May 2024 19:03:40 +0200 Subject: [PATCH] add lights to mini view --- app/content/system/dot/dot.gd | 11 +++++++++++ app/content/system/dot/dot.tscn | 5 +++++ app/content/system/miniature/miniature.gd | 3 +++ 3 files changed, 19 insertions(+) diff --git a/app/content/system/dot/dot.gd b/app/content/system/dot/dot.gd index 50ffd7c..7513f49 100644 --- a/app/content/system/dot/dot.gd +++ b/app/content/system/dot/dot.gd @@ -1,6 +1,7 @@ extends StaticBody3D const Entity = preload ("res://content/entities/entity.gd") +const Light = preload ("res://content/entities/light/light.gd") const TOUCH_LONG = 400.0 @@ -9,6 +10,7 @@ const TOUCH_LONG = 400.0 @onready var collision = $CollisionShape3D @onready var area = $Area3D/CollisionShape3D2 @onready var snap_sound = $SnapSound +@onready var light = $OmniLight3D @onready var label = $Label3D var active = R.state(false) var disabled = null @@ -17,6 +19,15 @@ var moved_ran = false var touch_ran = false func _ready(): + if entity is Light: + R.effect(func(_arg): + light.light_energy=1 if entity.active.value else 0 + light.light_color=entity.color.value + ) + else: + remove_child(light) + light.queue_free() + R.effect(func(_arg): label.text=entity.icon.value label.modulate=entity.icon_color.value diff --git a/app/content/system/dot/dot.tscn b/app/content/system/dot/dot.tscn index efbc792..a1cf0d9 100644 --- a/app/content/system/dot/dot.tscn +++ b/app/content/system/dot/dot.tscn @@ -37,3 +37,8 @@ shape = SubResource("SphereShape3D_y1ne8") [node name="SnapSound" type="AudioStreamPlayer" parent="."] stream = ExtResource("3_04fcm") volume_db = -20.0 + +[node name="OmniLight3D" type="OmniLight3D" parent="."] +layers = 2 +light_color = Color(0.537607, 0.0297858, 0.226152, 1) +omni_range = 0.5 diff --git a/app/content/system/miniature/miniature.gd b/app/content/system/miniature/miniature.gd index 6aa8dfb..bb05a7a 100644 --- a/app/content/system/miniature/miniature.gd +++ b/app/content/system/miniature/miniature.gd @@ -78,6 +78,9 @@ func _ready(): walls_mesh.material_override=wall_material floor_mesh.material_override=wall_material + + walls_mesh.set_layer_mask_value(2, true) + floor_mesh.set_layer_mask_value(2, true) ) # Update Size