add lights to mini view

This commit is contained in:
Nitwel 2024-05-28 19:03:40 +02:00
parent f9a4d8ad6b
commit 0fee21ccdb
3 changed files with 19 additions and 0 deletions

View File

@ -1,6 +1,7 @@
extends StaticBody3D extends StaticBody3D
const Entity = preload ("res://content/entities/entity.gd") const Entity = preload ("res://content/entities/entity.gd")
const Light = preload ("res://content/entities/light/light.gd")
const TOUCH_LONG = 400.0 const TOUCH_LONG = 400.0
@ -9,6 +10,7 @@ const TOUCH_LONG = 400.0
@onready var collision = $CollisionShape3D @onready var collision = $CollisionShape3D
@onready var area = $Area3D/CollisionShape3D2 @onready var area = $Area3D/CollisionShape3D2
@onready var snap_sound = $SnapSound @onready var snap_sound = $SnapSound
@onready var light = $OmniLight3D
@onready var label = $Label3D @onready var label = $Label3D
var active = R.state(false) var active = R.state(false)
var disabled = null var disabled = null
@ -17,6 +19,15 @@ var moved_ran = false
var touch_ran = false var touch_ran = false
func _ready(): 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): R.effect(func(_arg):
label.text=entity.icon.value label.text=entity.icon.value
label.modulate=entity.icon_color.value label.modulate=entity.icon_color.value

View File

@ -37,3 +37,8 @@ shape = SubResource("SphereShape3D_y1ne8")
[node name="SnapSound" type="AudioStreamPlayer" parent="."] [node name="SnapSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource("3_04fcm") stream = ExtResource("3_04fcm")
volume_db = -20.0 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

View File

@ -78,6 +78,9 @@ func _ready():
walls_mesh.material_override=wall_material walls_mesh.material_override=wall_material
floor_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 # Update Size