decouple integration from main
This commit is contained in:
parent
f0aae4a7ab
commit
5834fee507
|
@ -11,8 +11,6 @@ var sky_passthrough = preload ("res://assets/materials/sky_passthrough.material"
|
||||||
@onready var menu = $Menu
|
@onready var menu = $Menu
|
||||||
@onready var keyboard = $Keyboard
|
@onready var keyboard = $Keyboard
|
||||||
|
|
||||||
var last_room = null
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
# In case we're running on the headset, use the passthrough sky
|
# In case we're running on the headset, use the passthrough sky
|
||||||
if OS.get_name() == "Android":
|
if OS.get_name() == "Android":
|
||||||
|
@ -84,17 +82,6 @@ func _emit_action(name: String, value, right_controller: bool=true):
|
||||||
TYPE_FLOAT, TYPE_VECTOR2:
|
TYPE_FLOAT, TYPE_VECTOR2:
|
||||||
EventSystem.emit("action_value", event)
|
EventSystem.emit("action_value", event)
|
||||||
|
|
||||||
func _physics_process(delta):
|
|
||||||
var room = House.body.find_room_at(camera.global_position)
|
|
||||||
|
|
||||||
if room != last_room:
|
|
||||||
if room:
|
|
||||||
HomeApi.api.update_room(room.name)
|
|
||||||
last_room = room
|
|
||||||
else:
|
|
||||||
HomeApi.api.update_room("outside")
|
|
||||||
last_room = null
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if OS.get_name() != "Android":
|
if OS.get_name() != "Android":
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=15 format=3 uid="uid://eecv28y6jxk4"]
|
[gd_scene load_steps=16 format=3 uid="uid://eecv28y6jxk4"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://clc5dre31iskm" path="res://addons/godot-xr-tools/xr/start_xr.tscn" id="1_i4c04"]
|
[ext_resource type="PackedScene" uid="uid://clc5dre31iskm" path="res://addons/godot-xr-tools/xr/start_xr.tscn" id="1_i4c04"]
|
||||||
[ext_resource type="Script" path="res://content/main.gd" id="1_uvrd4"]
|
[ext_resource type="Script" path="res://content/main.gd" id="1_uvrd4"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b30w6tywfj4fp" path="res://content/system/controller_left/controller_left.tscn" id="2_2lraw"]
|
[ext_resource type="PackedScene" uid="uid://b30w6tywfj4fp" path="res://content/system/controller_left/controller_left.tscn" id="2_2lraw"]
|
||||||
[ext_resource type="PackedScene" uid="uid://d3f8glx1xgm5w" path="res://content/system/raycast/raycast.tscn" id="3_67lii"]
|
[ext_resource type="PackedScene" uid="uid://d3f8glx1xgm5w" path="res://content/system/raycast/raycast.tscn" id="3_67lii"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://b2kjh1fpjptdr" path="res://content/system/camera/camera.tscn" id="3_rj4ac"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bsx12q23v8apy" path="res://content/system/hands/hands.tscn" id="4_v8xu6"]
|
[ext_resource type="PackedScene" uid="uid://bsx12q23v8apy" path="res://content/system/hands/hands.tscn" id="4_v8xu6"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ctltchlf2j2r4" path="res://addons/xr-simulator/XRSimulator.tscn" id="5_3qc8g"]
|
[ext_resource type="PackedScene" uid="uid://ctltchlf2j2r4" path="res://addons/xr-simulator/XRSimulator.tscn" id="5_3qc8g"]
|
||||||
[ext_resource type="Material" uid="uid://bf5ina366dwm6" path="res://assets/materials/sky.material" id="5_wgwf8"]
|
[ext_resource type="Material" uid="uid://bf5ina366dwm6" path="res://assets/materials/sky.material" id="5_wgwf8"]
|
||||||
|
@ -46,10 +47,7 @@ shadow_enabled = true
|
||||||
|
|
||||||
[node name="XROrigin3D" type="XROrigin3D" parent="."]
|
[node name="XROrigin3D" type="XROrigin3D" parent="."]
|
||||||
|
|
||||||
[node name="XRCamera3D" type="XRCamera3D" parent="XROrigin3D"]
|
[node name="XRCamera3D" parent="XROrigin3D" instance=ExtResource("3_rj4ac")]
|
||||||
transform = Transform3D(0.999999, 0.00106283, -0.000420545, -0.00106267, 0.999999, 0.000379457, 0.000420948, -0.000378989, 1, 0.0356617, 0.71033, 0.00564247)
|
|
||||||
cull_mask = 524287
|
|
||||||
current = true
|
|
||||||
|
|
||||||
[node name="XRControllerLeft" parent="XROrigin3D" instance=ExtResource("2_2lraw")]
|
[node name="XRControllerLeft" parent="XROrigin3D" instance=ExtResource("2_2lraw")]
|
||||||
transform = Transform3D(0.999999, -1.39633e-11, 0, 9.48075e-12, 1, 0, 0, 0, 1, -0.355145, 0.550439, -0.477945)
|
transform = Transform3D(0.999999, -1.39633e-11, 0, 9.48075e-12, 1, 0, 0, 0, 1, -0.355145, 0.550439, -0.477945)
|
||||||
|
|
18
content/system/camera/camera.gd
Normal file
18
content/system/camera/camera.gd
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
extends XRCamera3D
|
||||||
|
|
||||||
|
var last_room = null
|
||||||
|
|
||||||
|
func _physics_process(_delta):
|
||||||
|
if HomeApi.api.has_integration():
|
||||||
|
update_room()
|
||||||
|
|
||||||
|
func update_room():
|
||||||
|
var room = House.body.find_room_at(global_position)
|
||||||
|
|
||||||
|
if room != last_room:
|
||||||
|
if room:
|
||||||
|
HomeApi.api.update_room(room.name)
|
||||||
|
last_room = room
|
||||||
|
else:
|
||||||
|
HomeApi.api.update_room("outside")
|
||||||
|
last_room = null
|
6
content/system/camera/camera.tscn
Normal file
6
content/system/camera/camera.tscn
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene format=3 uid="uid://b2kjh1fpjptdr"]
|
||||||
|
|
||||||
|
[node name="XRCamera3D" type="XRCamera3D"]
|
||||||
|
transform = Transform3D(0.999999, 0.00106283, -0.000420545, -0.00106267, 0.999999, 0.000379457, 0.000420948, -0.000378989, 1, 0.0356617, 0.71033, 0.00564247)
|
||||||
|
cull_mask = 524287
|
||||||
|
current = true
|
|
@ -255,6 +255,9 @@ func set_state(entity: String, state: String, attributes: Dictionary={}):
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
func has_integration():
|
||||||
|
return integration_handler.integration_exists
|
||||||
|
|
||||||
func update_room(room: String):
|
func update_room(room: String):
|
||||||
var response = await send_request_packet({
|
var response = await send_request_packet({
|
||||||
"type": "immersive_home/update",
|
"type": "immersive_home/update",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user