Merge pull request #99 from Nitwel/tweaks3

Fix various bugs in release v0.3.0
This commit is contained in:
Nitwel 2024-01-29 15:38:10 +01:00 committed by GitHub
commit c011901853
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 58 additions and 32 deletions

View File

@ -26,6 +26,7 @@ func _ready():
set_state(stateInfo["state"] == "on") set_state(stateInfo["state"] == "on")
if stateInfo.has("attributes") && stateInfo["attributes"].has("effect_list") && stateInfo["attributes"]["effect_list"].size() > 0: if stateInfo.has("attributes") && stateInfo["attributes"].has("effect_list") && stateInfo["attributes"]["effect_list"].size() > 0:
if stateInfo["attributes"].has("effect") && stateInfo["attributes"]["effect"] != null:
mode_label.text = stateInfo["attributes"]["effect"] mode_label.text = stateInfo["attributes"]["effect"]
mode_next.on_button_down.connect(func(): mode_next.on_button_down.connect(func():

View File

@ -70,8 +70,6 @@ height = 0.005
[node name="Light" type="StaticBody3D" groups=["entity"]] [node name="Light" type="StaticBody3D" groups=["entity"]]
collision_mask = 0 collision_mask = 0
script = ExtResource("1_ykxy3") script = ExtResource("1_ykxy3")
color_off = null
color_on = null
[node name="CollisionShape3D" type="CollisionShape3D" parent="."] [node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_ukj14") shape = SubResource("SphereShape3D_ukj14")

View File

@ -27,6 +27,9 @@ func _ready():
corner2.get_node("Movable").on_move.connect(func(position, rotation): corner2.get_node("Movable").on_move.connect(func(position, rotation):
edge.align_to_corners(corner1.global_position, corner2.global_position) edge.align_to_corners(corner1.global_position, corner2.global_position)
corner2.look_at(corner1.global_position, Vector3.UP)
corner2.rotate(Vector3.UP, deg_to_rad(-90))
) )
corner2.get_node("Movable").restrict_movement = func(new_position): corner2.get_node("Movable").restrict_movement = func(new_position):
@ -40,7 +43,7 @@ func update_initial_positions():
edge.align_to_corners(corner1.global_position, corner2.global_position) edge.align_to_corners(corner1.global_position, corner2.global_position)
marker.global_transform = House.body.transform marker.global_transform = House.body.transform
func get_new_transform(old_transform: Transform3D): func get_new_transform():
marker.scale = Vector3(1, 1, 1) marker.scale = Vector3(1, 1, 1)
return marker.global_transform return marker.global_transform
@ -48,6 +51,9 @@ func update_align_reference():
corner1.global_position = Store.house.align_position1 corner1.global_position = Store.house.align_position1
corner2.global_position = Store.house.align_position2 corner2.global_position = Store.house.align_position2
corner2.look_at(corner1.global_position, Vector3.UP)
corner2.rotate(Vector3.UP, deg_to_rad(-90))
edge.align_to_corners(corner1.global_position, corner2.global_position) edge.align_to_corners(corner1.global_position, corner2.global_position)
func update_store(): func update_store():

View File

@ -4,7 +4,8 @@
[ext_resource type="PackedScene" uid="uid://brf6mm2gxj7y2" path="res://content/system/house/room/wall_corner.tscn" id="2_ppkie"] [ext_resource type="PackedScene" uid="uid://brf6mm2gxj7y2" path="res://content/system/house/room/wall_corner.tscn" id="2_ppkie"]
[ext_resource type="PackedScene" uid="uid://dlj5chj7ndgua" path="res://content/system/house/room/wall_edge.tscn" id="3_6o3xn"] [ext_resource type="PackedScene" uid="uid://dlj5chj7ndgua" path="res://content/system/house/room/wall_edge.tscn" id="3_6o3xn"]
[ext_resource type="Script" path="res://content/functions/movable.gd" id="3_7ktdq"] [ext_resource type="Script" path="res://content/functions/movable.gd" id="3_7ktdq"]
[ext_resource type="Material" uid="uid://dxyuncqxagt28" path="res://content/system/house/room/walls_mini.tres" id="4_jkpj4"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_64dod"]
[sub_resource type="CylinderMesh" id="CylinderMesh_k2m3v"] [sub_resource type="CylinderMesh" id="CylinderMesh_k2m3v"]
top_radius = 0.001 top_radius = 0.001
@ -26,7 +27,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0)
[node name="MeshInstance3D" parent="Corner1/Corner2" index="1"] [node name="MeshInstance3D" parent="Corner1/Corner2" index="1"]
transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0) transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0)
material_override = ExtResource("4_jkpj4") material_override = SubResource("StandardMaterial3D_64dod")
mesh = SubResource("CylinderMesh_k2m3v") mesh = SubResource("CylinderMesh_k2m3v")
[node name="Movable" type="Node" parent="Corner1/Corner2"] [node name="Movable" type="Node" parent="Corner1/Corner2"]

View File

@ -97,10 +97,16 @@ func delete_room(room_name):
if editing_room == room: if editing_room == room:
editing_room = null editing_room = null
room.get_parent().remove_child(room)
room.queue_free() room.queue_free()
await room.tree_exited await room.tree_exited
var store_room = Store.house.get_room(room_name)
if store_room != null:
Store.house.rooms.erase(store_room)
Store.house.save_local()
func is_editiong(room_name): func is_editiong(room_name):
return editing_room != null && editing_room.name == room_name return editing_room != null && editing_room.name == room_name
@ -210,23 +216,35 @@ func update_mini_view():
func edit_reference(): func edit_reference():
fixing_reference = false fixing_reference = false
align_reference.visible = true
align_reference.disabled = false align_reference.disabled = false
func fix_reference(): func fix_reference():
fixing_reference = true fixing_reference = true
align_reference.disabled = false align_reference.disabled = false
align_reference.visible = true
align_reference.update_initial_positions() align_reference.update_initial_positions()
func save_reference(): func save_reference():
if fixing_reference: if fixing_reference:
for room in get_rooms(0):
room.editable = true
var align_transform = align_reference.global_transform var align_transform = align_reference.global_transform
transform = align_reference.get_new_transform(transform) transform = align_reference.get_new_transform()
align_reference.global_transform = align_transform align_reference.global_transform = align_transform
align_reference.update_store()
for room in get_rooms(0):
room.editable = false
save_all_entities()
align_reference.disabled = true align_reference.disabled = true
align_reference.visible = false
align_reference.update_initial_positions() align_reference.update_initial_positions()
align_reference.update_store()
Store.house.save_local() Store.house.save_local()
func save_all_entities(): func save_all_entities():

View File

@ -19,13 +19,13 @@ func _on_enter():
var corners = room_store.corners var corners = room_store.corners
if corners.size() > 0: if corners.size() > 0:
add_floor_corner(Vector3(corners[0].x, 0, corners[0].y)) add_floor_corner(room.to_local(Vector3(corners[0].x, 0, corners[0].y)))
add_height_corner(Vector3(corners[0].x, 0, corners[0].y)) add_height_corner(room.to_local(Vector3(corners[0].x, 0, corners[0].y)))
room.room_ceiling.position.y = room_store.height room.room_ceiling.position.y = room_store.height
height_edge.align_to_corners(floor_corner.global_position, height_corner.global_position) height_edge.align_to_corners(floor_corner.position, floor_corner.position + Vector3.UP * room.room_ceiling.position.y)
for i in range(1, corners.size()): for i in range(1, corners.size()):
add_corner(Vector3(corners[i].x, 0, corners[i].y)) add_corner(room.to_local(Vector3(corners[i].x, 0, corners[i].y)))
room.room_ceiling.get_node("CollisionShape3D").disabled = (floor_corner == null && height_corner == null) room.room_ceiling.get_node("CollisionShape3D").disabled = (floor_corner == null && height_corner == null)
room.room_floor.get_node("CollisionShape3D").disabled = false room.room_floor.get_node("CollisionShape3D").disabled = false
@ -164,7 +164,7 @@ func add_height_corner(position: Vector3):
return return
room.room_ceiling.position.y = new_position.y room.room_ceiling.position.y = new_position.y
height_edge.align_to_corners(floor_corner.global_position, height_corner.global_position) height_edge.align_to_corners(floor_corner.position, floor_corner.position + Vector3.UP * room.room_ceiling.position.y)
) )
@ -266,15 +266,15 @@ func add_edge(from_pos: Vector3, to_pos: Vector3, index: int = -1):
func update_store(): func update_store():
var store_room = Store.house.get_room(room.name) var store_room = Store.house.get_room(room.name)
if store_room == null:
return
var corners = [] var corners = []
for corner in room.wall_corners.get_children(): for corner in room.wall_corners.get_children():
corners.append(Vector2(corner.position.x, corner.position.z)) corners.append(Vector2(corner.global_position.x, corner.global_position.z))
store_room.corners = corners store_room.corners = corners
store_room.height = room.room_ceiling.position.y store_room.height = room.room_ceiling.position.y
if corners.size() < 3:
House.body.delete_room(room.name)
Store.house.save_local() Store.house.save_local()

View File

@ -1,16 +1,10 @@
extends Node3D extends Node3D
const Proxy = preload("res://lib/utils/proxy.gd")
const Notification = preload("res://content/ui/components/notification/notification.tscn") const Notification = preload("res://content/ui/components/notification/notification.tscn")
@onready var menu_root = $AnimationContainer
@onready var content = $AnimationContainer/Content
@onready var nav = $AnimationContainer/Navigation
@onready var animation_player = $AnimationPlayer @onready var animation_player = $AnimationPlayer
@onready var notify_place = $AnimationContainer/NotifyPlace @onready var notify_place = $AnimationContainer/NotifyPlace
var selected_nav = null
var show_menu := false: var show_menu := false:
set(value): set(value):
show_menu = value show_menu = value

View File

@ -41,6 +41,9 @@ var edit_room = false:
room_button.label = "edit" room_button.label = "edit"
func _ready(): func _ready():
if Store.house.is_loaded():
_generate_room_map()
else:
Store.house.on_loaded.connect(func(): Store.house.on_loaded.connect(func():
_generate_room_map() _generate_room_map()
) )

View File

@ -33,6 +33,10 @@ func _ready():
credits_instance.global_position = + label.to_global(label.position + Vector3(0.1, 0, -0.15)) credits_instance.global_position = + label.to_global(label.position + Vector3(0.1, 0, -0.15))
) )
if Store.settings.is_loaded():
input_url.text = Store.settings.url
input_token.text = Store.settings.token
else:
Store.settings.on_loaded.connect(func(): Store.settings.on_loaded.connect(func():
input_url.text = Store.settings.url input_url.text = Store.settings.url
input_token.text = Store.settings.token input_token.text = Store.settings.token

View File

@ -248,8 +248,8 @@ architectures/armeabi-v7a=false
architectures/arm64-v8a=true architectures/arm64-v8a=true
architectures/x86=false architectures/x86=false
architectures/x86_64=false architectures/x86_64=false
version/code=8 version/code=10
version/name="v0.2.1" version/name="v0.3.1"
package/unique_name="de.nitwel.$genname" package/unique_name="de.nitwel.$genname"
package/name="Immersive Home" package/name="Immersive Home"
package/signed=true package/signed=true

View File

@ -12,7 +12,7 @@ static func key_to_string(key: Key, caps: bool = false, apply_to: String = "") -
KEY_ASCIITILDE: apply_to += "~" KEY_ASCIITILDE: apply_to += "~"
KEY_SLASH: apply_to += "/" KEY_SLASH: apply_to += "/"
KEY_BACKSLASH: apply_to += "\\" KEY_BACKSLASH: apply_to += "\\"
KEY_COLON: apply_to += ";" KEY_COLON: apply_to += ":"
KEY_COMMA: apply_to += "," KEY_COMMA: apply_to += ","
KEY_PERIOD: apply_to += "." KEY_PERIOD: apply_to += "."
KEY_MINUS: apply_to += "-" KEY_MINUS: apply_to += "-"

View File

@ -21,7 +21,8 @@ func _init():
_save_path = "user://house.json" _save_path = "user://house.json"
func clear(): func clear():
pass rooms = []
entities = []
func get_room(name): func get_room(name):
for room in rooms: for room in rooms: