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 restricted: bool = false
@export var restrict_movement: Callable @export var restrict_movement: Callable
@export var lock_rotation: bool = false @export var lock_rotation: bool = false
@export var disabled: bool = false
var hit_node := Node3D.new() var hit_node := Node3D.new()
var initiator = null var initiator = null
func _on_grab_down(event: EventPointer): func _on_grab_down(event: EventPointer):
if disabled:
return
if restricted&&event.target != get_parent(): if restricted&&event.target != get_parent():
return return

View File

@ -4,17 +4,20 @@ const DotScene = preload ("res://content/system/dot/dot.tscn")
const Entity = preload ("res://content/entities/entity.gd") const Entity = preload ("res://content/entities/entity.gd")
@onready var dots = $"../Small/Dots" @onready var dots = $"../Small/Dots"
@onready var main = $"/root/Main"
var active_type = null var active_type = null
var editing = R.state([]) var editing = R.state([])
var group_entity = null var group_entity = null
var house_small = null
func _ready(): func _ready():
await House.body.ready await House.body.ready
# Update Group Entity # Update Group Entity
R.effect(func(_arg): R.effect(func(_arg):
if editing.value.size() == 0: if house_small.value == false||editing.value.size() == 0:
if group_entity != null: if group_entity != null:
group_entity.queue_free() group_entity.queue_free()
group_entity=null group_entity=null
@ -23,7 +26,9 @@ func _ready():
group_entity=EntityFactory.create_entity(id, active_type) group_entity=EntityFactory.create_entity(id, active_type)
for entity_node in group_entity.get_children(): for entity_node in group_entity.get_children():
if entity_node is Movable: 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) add_child(group_entity)
else: else:
HomeApi.groups.update_entities(group_entity.entity_id, editing.value.map(func(entity): return entity.entity_id)) 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", [])
wall_material.set_shader_parameter("data_size", 0) wall_material.set_shader_parameter("data_size", 0)
entity_select.house_small = small
if Store.house.is_loaded() == false: if Store.house.is_loaded() == false:
await Store.house.on_loaded await Store.house.on_loaded

View File

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