fix rotation and entity in mini view

This commit is contained in:
Nitwel 2024-04-26 13:58:20 +02:00
parent 5ba67029c7
commit b25cc8c08d
4 changed files with 14 additions and 2 deletions

View File

@ -8,10 +8,14 @@ signal on_moved()
@export var restricted: bool = false
@export var restrict_movement: Callable
@export var lock_rotation: bool = false
@export var disabled: bool = false
var hit_node := Node3D.new()
var initiator = null
func _on_grab_down(event: EventPointer):
if disabled:
return
if restricted&&event.target != get_parent():
return

View File

@ -4,17 +4,20 @@ const DotScene = preload ("res://content/system/dot/dot.tscn")
const Entity = preload ("res://content/entities/entity.gd")
@onready var dots = $"../Small/Dots"
@onready var main = $"/root/Main"
var active_type = null
var editing = R.state([])
var group_entity = null
var house_small = null
func _ready():
await House.body.ready
# Update Group Entity
R.effect(func(_arg):
if editing.value.size() == 0:
if house_small.value == false||editing.value.size() == 0:
if group_entity != null:
group_entity.queue_free()
group_entity=null
@ -23,7 +26,9 @@ func _ready():
group_entity=EntityFactory.create_entity(id, active_type)
for entity_node in group_entity.get_children():
if entity_node is Movable:
group_entity.remove_child(entity_node)
entity_node.disabled=true
group_entity.transform=Transform3D().looking_at(to_local((main.camera.global_position)), Vector3.UP, true)
add_child(group_entity)
else:
HomeApi.groups.update_entities(group_entity.entity_id, editing.value.map(func(entity): return entity.entity_id))

View File

@ -38,6 +38,8 @@ func _ready():
wall_material.set_shader_parameter("data", [])
wall_material.set_shader_parameter("data_size", 0)
entity_select.house_small = small
if Store.house.is_loaded() == false:
await Store.house.on_loaded

View File

@ -18,6 +18,7 @@ disabled = true
[node name="Movable" type="Node" parent="Body"]
script = ExtResource("2_x7oed")
restricted = true
disabled = null
[node name="Small" type="Node3D" parent="Body"]