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,7 +26,8 @@ func _ready():
set_state(stateInfo["state"] == "on")
if stateInfo.has("attributes") && stateInfo["attributes"].has("effect_list") && stateInfo["attributes"]["effect_list"].size() > 0:
mode_label.text = stateInfo["attributes"]["effect"]
if stateInfo["attributes"].has("effect") && stateInfo["attributes"]["effect"] != null:
mode_label.text = stateInfo["attributes"]["effect"]
mode_next.on_button_down.connect(func():
var index = stateInfo["attributes"]["effect_list"].find(stateInfo["attributes"]["effect"])

View File

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

View File

@ -27,6 +27,9 @@ func _ready():
corner2.get_node("Movable").on_move.connect(func(position, rotation):
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):
@ -40,7 +43,7 @@ func update_initial_positions():
edge.align_to_corners(corner1.global_position, corner2.global_position)
marker.global_transform = House.body.transform
func get_new_transform(old_transform: Transform3D):
func get_new_transform():
marker.scale = Vector3(1, 1, 1)
return marker.global_transform
@ -48,6 +51,9 @@ func update_align_reference():
corner1.global_position = Store.house.align_position1
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)
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://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="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"]
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"]
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")
[node name="Movable" type="Node" parent="Corner1/Corner2"]

View File

@ -97,10 +97,16 @@ func delete_room(room_name):
if editing_room == room:
editing_room = null
room.get_parent().remove_child(room)
room.queue_free()
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):
return editing_room != null && editing_room.name == room_name
@ -210,23 +216,35 @@ func update_mini_view():
func edit_reference():
fixing_reference = false
align_reference.visible = true
align_reference.disabled = false
func fix_reference():
fixing_reference = true
align_reference.disabled = false
align_reference.visible = true
align_reference.update_initial_positions()
func save_reference():
if fixing_reference:
for room in get_rooms(0):
room.editable = true
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.update_store()
for room in get_rooms(0):
room.editable = false
save_all_entities()
align_reference.disabled = true
align_reference.visible = false
align_reference.update_initial_positions()
align_reference.update_store()
Store.house.save_local()
func save_all_entities():

View File

@ -19,13 +19,13 @@ func _on_enter():
var corners = room_store.corners
if corners.size() > 0:
add_floor_corner(Vector3(corners[0].x, 0, corners[0].y))
add_height_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(room.to_local(Vector3(corners[0].x, 0, corners[0].y)))
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()):
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_floor.get_node("CollisionShape3D").disabled = false
@ -164,7 +164,7 @@ func add_height_corner(position: Vector3):
return
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():
var store_room = Store.house.get_room(room.name)
if store_room == null:
return
var corners = []
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.height = room.room_ceiling.position.y
if corners.size() < 3:
House.body.delete_room(room.name)
Store.house.save_local()

View File

@ -1,16 +1,10 @@
extends Node3D
const Proxy = preload("res://lib/utils/proxy.gd")
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 notify_place = $AnimationContainer/NotifyPlace
var selected_nav = null
var show_menu := false:
set(value):
show_menu = value

View File

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

View File

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

View File

@ -248,8 +248,8 @@ architectures/armeabi-v7a=false
architectures/arm64-v8a=true
architectures/x86=false
architectures/x86_64=false
version/code=8
version/name="v0.2.1"
version/code=10
version/name="v0.3.1"
package/unique_name="de.nitwel.$genname"
package/name="Immersive Home"
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_SLASH: apply_to += "/"
KEY_BACKSLASH: apply_to += "\\"
KEY_COLON: apply_to += ";"
KEY_COLON: apply_to += ":"
KEY_COMMA: apply_to += ","
KEY_PERIOD: apply_to += "."
KEY_MINUS: apply_to += "-"

View File

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