4 Commits

Author SHA1 Message Date
JonShard dde627d05b Add Shop toggles poke 2026-08-04 13:29:11 +02:00
JonShard 661210eac8 Add Shop menu on each hand 2026-08-04 12:38:21 +02:00
JonShard 2e8c12cb8a Add Table go into IDLE in build mode 2026-08-04 12:37:33 +02:00
JonShard 58f7da7481 Add Shop UI 2026-08-03 13:19:30 +02:00
26 changed files with 934 additions and 21 deletions
+159
View File
@@ -6,18 +6,121 @@
[ext_resource type="PackedScene" uid="uid://b4ysuy43poobf" path="res://addons/godot-xr-tools/functions/function_pickup.tscn" id="3_rd8py"]
[ext_resource type="PackedScene" uid="uid://diyu06cw06syv" path="res://addons/godot-xr-tools/player/player_body.tscn" id="4_6xr3x"]
[ext_resource type="PackedScene" uid="uid://b6bk2pj8vbj28" path="res://addons/godot-xr-tools/functions/movement_turn.tscn" id="4_rd8py"]
[ext_resource type="PackedScene" uid="uid://cmxe1av5nsxyq" path="res://UI/shop_menu_3d.tscn" id="5_7rrtu"]
[ext_resource type="PackedScene" uid="uid://cqhw276realc" path="res://addons/godot-xr-tools/functions/function_pointer.tscn" id="6_ptr"]
[ext_resource type="PackedScene" uid="uid://bjcxf427un2wp" path="res://addons/godot-xr-tools/player/poke/poke.tscn" id="7_1fmci"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1fmci"]
animation = &"Grip"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_73fu8"]
animation = &"Grip"
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_ouruy"]
filter_enabled = true
filters = ["Armature/Skeleton3D:Little_Distal_L", "Armature/Skeleton3D:Little_Intermediate_L", "Armature/Skeleton3D:Little_Metacarpal_L", "Armature/Skeleton3D:Little_Proximal_L", "Armature/Skeleton3D:Middle_Distal_L", "Armature/Skeleton3D:Middle_Intermediate_L", "Armature/Skeleton3D:Middle_Metacarpal_L", "Armature/Skeleton3D:Middle_Proximal_L", "Armature/Skeleton3D:Ring_Distal_L", "Armature/Skeleton3D:Ring_Intermediate_L", "Armature/Skeleton3D:Ring_Metacarpal_L", "Armature/Skeleton3D:Ring_Proximal_L", "Armature/Skeleton3D:Thumb_Distal_L", "Armature/Skeleton3D:Thumb_Metacarpal_L", "Armature/Skeleton3D:Thumb_Proximal_L", "Armature/Skeleton:Little_Distal_L", "Armature/Skeleton:Little_Intermediate_L", "Armature/Skeleton:Little_Proximal_L", "Armature/Skeleton:Middle_Distal_L", "Armature/Skeleton:Middle_Intermediate_L", "Armature/Skeleton:Middle_Proximal_L", "Armature/Skeleton:Ring_Distal_L", "Armature/Skeleton:Ring_Intermediate_L", "Armature/Skeleton:Ring_Proximal_L", "Armature/Skeleton:Thumb_Distal_L", "Armature/Skeleton:Thumb_Proximal_L"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_i0gvw"]
animation = &"Grip 5"
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_5mmou"]
filter_enabled = true
filters = ["Armature/Skeleton3D:Index_Distal_L", "Armature/Skeleton3D:Index_Intermediate_L", "Armature/Skeleton3D:Index_Metacarpal_L", "Armature/Skeleton3D:Index_Proximal_L", "Armature/Skeleton:Index_Distal_L", "Armature/Skeleton:Index_Intermediate_L", "Armature/Skeleton:Index_Proximal_L"]
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_yfij0"]
graph_offset = Vector2(-536, 11)
nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_1fmci")
nodes/ClosedHand1/position = Vector2(-600, 300)
nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_73fu8")
nodes/ClosedHand2/position = Vector2(-360, 300)
nodes/Grip/node = SubResource("AnimationNodeBlend2_ouruy")
nodes/Grip/position = Vector2(0, 20)
nodes/OpenHand/node = SubResource("AnimationNodeAnimation_i0gvw")
nodes/OpenHand/position = Vector2(-600, 100)
nodes/Trigger/node = SubResource("AnimationNodeBlend2_5mmou")
nodes/Trigger/position = Vector2(-360, 20)
node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_1fmci"]
transparency = 1
albedo_color = Color(1, 1, 1, 0.5882353)
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_itrmp"]
animation = &"Grip"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_nrfrd"]
animation = &"Grip"
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_73fu8"]
filter_enabled = true
filters = ["Armature/Skeleton3D:Little_Distal_R", "Armature/Skeleton3D:Little_Intermediate_R", "Armature/Skeleton3D:Little_Metacarpal_R", "Armature/Skeleton3D:Little_Proximal_R", "Armature/Skeleton3D:Middle_Distal_R", "Armature/Skeleton3D:Middle_Intermediate_R", "Armature/Skeleton3D:Middle_Metacarpal_R", "Armature/Skeleton3D:Middle_Proximal_R", "Armature/Skeleton3D:Ring_Distal_R", "Armature/Skeleton3D:Ring_Intermediate_R", "Armature/Skeleton3D:Ring_Metacarpal_R", "Armature/Skeleton3D:Ring_Proximal_R", "Armature/Skeleton3D:Thumb_Distal_R", "Armature/Skeleton3D:Thumb_Metacarpal_R", "Armature/Skeleton3D:Thumb_Proximal_R", "Armature/Skeleton:Little_Distal_R", "Armature/Skeleton:Little_Intermediate_R", "Armature/Skeleton:Little_Proximal_R", "Armature/Skeleton:Middle_Distal_R", "Armature/Skeleton:Middle_Intermediate_R", "Armature/Skeleton:Middle_Proximal_R", "Armature/Skeleton:Ring_Distal_R", "Armature/Skeleton:Ring_Intermediate_R", "Armature/Skeleton:Ring_Proximal_R", "Armature/Skeleton:Thumb_Distal_R", "Armature/Skeleton:Thumb_Proximal_R"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ouruy"]
animation = &"Grip 5"
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_i0gvw"]
filter_enabled = true
filters = ["Armature/Skeleton3D:Index_Distal_R", "Armature/Skeleton3D:Index_Intermediate_R", "Armature/Skeleton3D:Index_Metacarpal_R", "Armature/Skeleton3D:Index_Proximal_R", "Armature/Skeleton:Index_Distal_R", "Armature/Skeleton:Index_Intermediate_R", "Armature/Skeleton:Index_Proximal_R"]
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_5mmou"]
nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_itrmp")
nodes/ClosedHand1/position = Vector2(-600, 300)
nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_nrfrd")
nodes/ClosedHand2/position = Vector2(-360, 300)
nodes/Grip/node = SubResource("AnimationNodeBlend2_73fu8")
nodes/Grip/position = Vector2(0, 40)
nodes/OpenHand/node = SubResource("AnimationNodeAnimation_ouruy")
nodes/OpenHand/position = Vector2(-600, 100)
nodes/Trigger/node = SubResource("AnimationNodeBlend2_i0gvw")
nodes/Trigger/position = Vector2(-360, 40)
node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1"]
[node name="XROrigin3D" type="XROrigin3D" unique_id=2055526621]
[node name="XRCamera3D" type="XRCamera3D" parent="." unique_id=983614103]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.49626195, 0)
[node name="XRControllerLeftHand" type="XRController3D" parent="." unique_id=1171100950]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.6, 0, 0)
tracker = &"left_hand"
[node name="LeftHand" parent="XRControllerLeftHand" unique_id=1805508372 instance=ExtResource("1_jr1t4")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.009340696, -0.0074635968, 0.024033919)
[node name="Hand_low_L" parent="XRControllerLeftHand/LeftHand" index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.01, 0, 0.05)
[node name="Skeleton3D" parent="XRControllerLeftHand/LeftHand/Hand_low_L/Armature" index="0" unique_id=242151480]
bones/1/rotation = Quaternion(0.323537, -2.5658142e-05, -0.027220426, 0.9458239)
bones/2/rotation = Quaternion(-0.09044407, -0.04151748, -0.16629349, 0.98104167)
bones/3/rotation = Quaternion(-0.04661986, 0.02097099, 0.010327632, 0.9986392)
bones/5/rotation = Quaternion(-0.0012845465, -0.011608094, -0.016825877, 0.99979025)
bones/6/rotation = Quaternion(0.10292491, -0.009932083, -0.007944166, 0.9946078)
bones/7/rotation = Quaternion(-0.012859, -0.023610815, -0.32325828, 0.9459289)
bones/8/rotation = Quaternion(0.012057539, -0.009291937, -0.24747224, 0.96877545)
bones/10/rotation = Quaternion(-0.035753887, -0.0004000325, 0.0063676415, 0.9993403)
bones/11/rotation = Quaternion(-0.0026496367, -0.0011447113, -0.12599176, 0.9920271)
bones/12/rotation = Quaternion(0.039422527, 0.0019339261, -0.22807404, 0.97284347)
bones/13/rotation = Quaternion(-0.012339468, -0.008812943, -0.28066906, 0.9596848)
bones/15/rotation = Quaternion(-0.070265576, 0.010190836, -0.024330735, 0.9971795)
bones/16/rotation = Quaternion(-0.032063447, -0.002236244, -0.06863657, 0.99712384)
bones/17/rotation = Quaternion(0.025345208, 0.008124622, -0.2490055, 0.9681363)
bones/18/rotation = Quaternion(0.0025223217, 0.007880732, -0.2432038, 0.9699399)
bones/20/rotation = Quaternion(-0.09173688, 0.020302717, -0.010182976, 0.9955242)
bones/21/rotation = Quaternion(-0.06251818, -0.00022572002, -0.115392834, 0.99135065)
bones/22/rotation = Quaternion(0.058578636, 0.021648303, -0.26990518, 0.9608596)
bones/23/rotation = Quaternion(0.006871769, -0.0035727466, -0.21195254, 0.97724926)
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="XRControllerLeftHand/LeftHand/Hand_low_L/Armature/Skeleton3D" index="1" unique_id=774348011]
transform = Transform3D(0.5408296, 0.8408128, -0.023173608, -0.08262672, 0.08052427, 0.99332196, 0.83706397, -0.5353032, 0.11302349, 0.039901964, 0.040282845, -0.15009598)
bone_name = "Index_Tip_L"
bone_idx = 9
[node name="Poke" parent="XRControllerLeftHand/LeftHand/Hand_low_L/Armature/Skeleton3D/BoneAttachment3D" unique_id=259928841 instance=ExtResource("7_1fmci")]
[node name="AnimationTree" parent="XRControllerLeftHand/LeftHand" index="1"]
tree_root = SubResource("AnimationNodeBlendTree_yfij0")
[node name="MovementDirect" parent="XRControllerLeftHand" unique_id=1865515938 instance=ExtResource("2_q1xvu")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.009340696, -0.0074635968, 0.024033919)
strafe = true
@@ -27,14 +130,57 @@ strafe = true
[node name="FunctionPointer" parent="XRControllerLeftHand" unique_id=315304316 instance=ExtResource("6_ptr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, 0.05, -0.1)
show_laser = 2
laser_length = 1
laser_material = SubResource("StandardMaterial3D_1fmci")
laser_hit_material = SubResource("StandardMaterial3D_1fmci")
show_target = true
target_radius = 0.009
target_material = SubResource("StandardMaterial3D_1fmci")
[node name="ShopMenu3D" parent="XRControllerLeftHand" unique_id=331240263 instance=ExtResource("5_7rrtu")]
transform = Transform3D(0.17921828, 0.016751308, -0.00045015282, -0.0125175975, 0.13704088, 0.116030626, 0.011140855, -0.11549542, 0.13761066, 0.27515364, 0.031010807, -0.013297826)
[node name="XRControllerRightHand" type="XRController3D" parent="." unique_id=202756852]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6, 0, 0)
tracker = &"right_hand"
[node name="RightHand" parent="XRControllerRightHand" unique_id=1112462503 instance=ExtResource("2_gshht")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0074635968, 0.024033919)
[node name="Hand_low_R" parent="XRControllerRightHand/RightHand" index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, 0, 0.05)
[node name="Skeleton3D" parent="XRControllerRightHand/RightHand/Hand_low_R/Armature" index="0" unique_id=976194013]
bones/1/rotation = Quaternion(0.323537, 2.5658142e-05, 0.027220426, 0.9458239)
bones/2/rotation = Quaternion(-0.09044407, 0.04151748, 0.16629349, 0.98104167)
bones/3/rotation = Quaternion(-0.04661986, -0.020970985, -0.010327632, 0.9986392)
bones/5/rotation = Quaternion(-0.0012845465, 0.011608096, 0.01682588, 0.99979025)
bones/6/rotation = Quaternion(0.10292492, 0.009932085, 0.007944188, 0.9946078)
bones/7/rotation = Quaternion(-0.012859004, 0.023610815, 0.32325834, 0.94592875)
bones/8/rotation = Quaternion(0.012057537, 0.0092919255, 0.24747224, 0.96877545)
bones/10/rotation = Quaternion(-0.035753887, 0.00040003238, -0.0063676336, 0.9993403)
bones/11/rotation = Quaternion(-0.0026496367, 0.0011447114, 0.1259918, 0.9920271)
bones/12/rotation = Quaternion(0.03942253, -0.0019339275, 0.2280741, 0.97284347)
bones/13/rotation = Quaternion(-0.012339467, 0.008812944, 0.28066906, 0.9596848)
bones/15/rotation = Quaternion(-0.07026557, -0.010190836, 0.024330745, 0.99717957)
bones/16/rotation = Quaternion(-0.032063447, 0.002236245, 0.06863657, 0.99712384)
bones/17/rotation = Quaternion(0.025345206, -0.00812462, 0.24900547, 0.9681363)
bones/18/rotation = Quaternion(0.0025223275, -0.007880732, 0.24320383, 0.9699399)
bones/20/rotation = Quaternion(-0.09173688, -0.020302719, 0.010182976, 0.9955242)
bones/21/rotation = Quaternion(-0.06251817, 0.00022572096, 0.115392834, 0.99135065)
bones/22/rotation = Quaternion(0.058578644, -0.021648303, 0.26990518, 0.9608596)
bones/23/rotation = Quaternion(0.0068717655, 0.0035727452, 0.21195254, 0.97724926)
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="XRControllerRightHand/RightHand/Hand_low_R/Armature/Skeleton3D" index="1" unique_id=497290142]
transform = Transform3D(0.5408295, -0.8408129, 0.023173586, 0.08262676, 0.08052423, 0.99332196, -0.83706397, -0.53530306, 0.11302352, -0.03990197, 0.040282845, -0.15009597)
bone_name = "Index_Tip_R"
bone_idx = 9
[node name="Poke" parent="XRControllerRightHand/RightHand/Hand_low_R/Armature/Skeleton3D/BoneAttachment3D" unique_id=303927399 instance=ExtResource("7_1fmci")]
[node name="AnimationTree" parent="XRControllerRightHand/RightHand" index="1"]
tree_root = SubResource("AnimationNodeBlendTree_5mmou")
[node name="MovementTurn" parent="XRControllerRightHand" unique_id=154529119 instance=ExtResource("4_rd8py")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0074635968, 0.024033919)
turn_mode = 2
@@ -45,8 +191,21 @@ smooth_turn_speed = 3.5
[node name="FunctionPointer" parent="XRControllerRightHand" unique_id=2017919314 instance=ExtResource("6_ptr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.02, 0.05, -0.1)
show_laser = 2
laser_length = 1
laser_material = SubResource("StandardMaterial3D_1fmci")
laser_hit_material = SubResource("StandardMaterial3D_1fmci")
show_target = true
target_radius = 0.009
target_material = SubResource("StandardMaterial3D_1fmci")
[node name="ShopMenu3D" parent="XRControllerRightHand" unique_id=246744456 instance=ExtResource("5_7rrtu")]
transform = Transform3D(0.17912053, -0.017761359, -0.0006130421, 0.014117808, 0.138435, 0.11417722, -0.010794867, -0.11366743, 0.13915166, -0.11845571, 0.038174443, -0.038154215)
[node name="PlayerBody" parent="." unique_id=1444632058 instance=ExtResource("4_6xr3x")]
collision_mask = 1017
player_calibrate_height = false
[editable path="XRControllerLeftHand/LeftHand"]
[editable path="XRControllerLeftHand/LeftHand/Hand_low_L"]
[editable path="XRControllerRightHand/RightHand"]
[editable path="XRControllerRightHand/RightHand/Hand_low_R"]
+1 -1
View File
@@ -7,7 +7,7 @@ func _ready() -> void:
func _on_game_state_changed(new_state: GameManager.GameState) -> void:
print("BuildModeController: game_state_changed to %s" % new_state)
print("BuildModeController: game_state_changed to %s" % GameManager.GameState.keys()[new_state])
if new_state == GameManager.GameState.BUILDING:
despawn_unheld_pickables()
+6 -3
View File
@@ -5,7 +5,10 @@ func _ready() -> void:
$"..".visible = false
# Listen for the game over signal from GameManager
Signals.game_over.connect(_on_game_over)
Signals.game_state_changed.connect(_on_game_state_changed)
func _on_game_over() -> void:
$"..".visible = true
func _on_game_state_changed(new_state: GameManager.GameState) -> void:
if new_state == GameManager.GameState.GAME_OVER:
$"..".visible = true
else:
$"..".visible = false
+1 -1
View File
@@ -73,7 +73,7 @@ script = ExtResource("1_57ppd")
environment = SubResource("Environment_bvwq1")
[node name="XROrigin3D" parent="." unique_id=2055526621 groups=["local_xr_origin"] instance=ExtResource("2_o1b3t")]
transform = Transform3D(-1, 0, 8.742278e-08, 0, 1, 0, -8.742278e-08, 0, -1, -1.8943893, 0.9667189, -4.301105)
transform = Transform3D(1.3113416e-07, 0, 1, 0, 1, 0, -1, 0, 1.3113416e-07, -2.4543328, 1.247834, 4.698895)
[node name="WorldContent" type="Node3D" parent="." unique_id=262398468]
+16 -2
View File
@@ -11,6 +11,9 @@
[ext_resource type="Script" uid="uid://bsdpd18i1i17s" path="res://prefabs/build_mode_controller.gd" id="9_atgwk"]
[ext_resource type="PackedScene" uid="uid://dvrk268s7gkxh" path="res://stations/sink.tscn" id="10_dhas4"]
[ext_resource type="PackedScene" uid="uid://caf0xanmxbshy" path="res://stations/table.tscn" id="11_gaw43"]
[ext_resource type="PackedScene" uid="uid://clujaf3u776a3" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" id="12_n58f2"]
[ext_resource type="PackedScene" uid="uid://xtcei2uvd5li" path="res://UI/game_over_panel.tscn" id="13_hooyg"]
[ext_resource type="Script" uid="uid://cwijoksyou1ey" path="res://scenes/GameOvercontroler.gd" id="14_cqmpj"]
[sub_resource type="Environment" id="Environment_bvwq1"]
background_mode = 2
@@ -41,7 +44,7 @@ script = ExtResource("1_atgwk")
environment = SubResource("Environment_bvwq1")
[node name="XROrigin3D" parent="." unique_id=2055526621 instance=ExtResource("3_bryd6")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.9667189, 1.2)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.9667189, 2.4)
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=1376644384]
transform = Transform3D(-0.8660254, -0.43301278, 0.24999999, 0.3022632, -0.05510214, 0.9516306, -0.39829266, 0.8997021, 0.17860365, 0, 0, 0)
@@ -107,7 +110,18 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6, 0, 0)
script = ExtResource("9_atgwk")
[node name="Sink" parent="." unique_id=1559059799 instance=ExtResource("10_dhas4")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6, 0.5, 0.6)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.2, 0.5, 0)
[node name="Table" parent="." unique_id=1863572470 instance=ExtResource("11_gaw43")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.4, 0.5, 1.8)
[node name="GameOverPanel" parent="." unique_id=522901881 instance=ExtResource("12_n58f2")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -4.428178, 2.8122003, 3)
scene = ExtResource("13_hooyg")
viewport_size = Vector2(900, 600)
transparent = 0
filter = false
scene_properties_keys = PackedStringArray("game_over_panel.gd")
[node name="controler" type="Node" parent="GameOverPanel" unique_id=1442195864]
script = ExtResource("14_cqmpj")
+33 -11
View File
@@ -24,6 +24,7 @@ const lbl_eating: String = "Eating..."
### Finite State Machine ####
enum TableState {
IDLE, # Don't update table. incorrect GameState
EMPTY, # Just finished eating or havent eaten yet
THINKING,
ORDERING, # Wating for player to take their order
@@ -36,8 +37,8 @@ enum TableState {
## state transitions only ever run where NetworkManager.owns_world() is true
## (the whole station's _process is gated off elsewhere for non-owners, see
## NetworkManager._gate_station). The setters below just refresh the display,
## so both the server (via _setState) and clients (via incoming sync) show
## the same text. Use _setState(), never assign _state directly.
## so both the server (via _set_state) and clients (via incoming sync) show
## the same text. Use _set_state(), never assign _state directly.
var _state: TableState = TableState.EMPTY
var _state_time: float = 0.0
var _state_duration: float = 0.0 # set in _set_state_time
@@ -72,7 +73,7 @@ func satisfyAllOrders() -> void:
_unsatisfied_orders.clear()
_original_orders.clear()
clearAllFood()
_setState(TableState.EMPTY)
_set_state(TableState.EMPTY)
func clearAllFood() -> void:
@@ -124,7 +125,7 @@ func _ready() -> void:
snap_zone_node.has_picked_up.connect(_on_object_picked_up)
snap_zone_node.has_dropped.connect(_on_object_dropped)
set_process(true)
_setState(TableState.EMPTY)
_set_state(TableState.EMPTY)
func _on_object_picked_up(_item) -> void:
@@ -165,7 +166,7 @@ func _place_order_if_player():
return
if _players_count > 0:
place_order()
_setState(TableState.WAITING_PRIMARY)
_set_state(TableState.WAITING_PRIMARY)
# func _get_plate_controller_from_item(_item: Node) -> PlateController:
@@ -224,11 +225,11 @@ func _absorb_item_if_correct(_item: Node) -> void:
func _update_state_from_orders():
print("Table _update_state_from_orders: unsatisfied_orders: ", _unsatisfied_orders)
if _unsatisfied_orders.size() > 0 and _state != TableState.EATING:
_setState(TableState.WAITING_FRIEND)
_set_state(TableState.WAITING_FRIEND)
# Table has everything it wants. Start eating
elif _unsatisfied_orders.is_empty() and _state != TableState.EATING:
_setState(TableState.EATING)
_set_state(TableState.EATING)
func _collect_money_from_food():
@@ -255,10 +256,15 @@ func _set_snap_zones_enabled(value: bool) -> void:
## Server-only state transition: sets the new state's timer and assigns
## _state (whose setter refreshes the display on every peer).
func _setState(newState: TableState) -> void:
func _set_state(newState: TableState) -> void:
print("Table State START: ", TableState.keys()[newState])
match newState:
TableState.IDLE:
_state_time = 0.0
_state_duration = 0.0
_state = newState
customers.visible = false
TableState.EMPTY:
_state_time = randf_range(3, 7)
_state_duration = _state_time
@@ -299,15 +305,15 @@ func _state_end(oldState: TableState):
match oldState:
TableState.EMPTY:
customers.visible = true
_setState(TableState.THINKING)
_set_state(TableState.THINKING)
TableState.THINKING:
_setState(TableState.ORDERING)
_set_state(TableState.ORDERING)
TableState.EATING:
clearAllFood()
_set_snap_zones_enabled(true)
_setState(TableState.EMPTY)
_set_state(TableState.EMPTY)
TableState.ORDERING, TableState.WAITING_PRIMARY, TableState.WAITING_FRIEND:
label_3d.text = lbl_gameover
@@ -326,6 +332,10 @@ func _refresh_display() -> void:
push_error("Table missing progress bar or label")
return
match _state:
TableState.IDLE:
progress_bar.set_bar_visible(false)
label_3d.text = ""
label_3d_time.text = ""
TableState.EMPTY:
progress_bar.set_bar_visible(false)
label_3d.text = ""
@@ -356,6 +366,18 @@ func _process(delta: float) -> void:
_refresh_display()
_place_order_if_player()
# If build mode, set, exit loop, be idle
if GameManager.game_state == GameManager.GameState.BUILDING and not _state == TableState.IDLE:
_set_state(TableState.IDLE)
return
# Game running, reenter loop
elif GameManager.game_state == GameManager.GameState.RUNNING and _state == TableState.IDLE:
_set_state(TableState.EMPTY)
return
# Still idle, do nothing
elif _state == TableState.IDLE:
return
# Wait for state to finish
if _state_time > 0.0:
_state_time = max(0.0, _state_time - delta)
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

+40
View File
@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c0nd4nh4vja73"
path="res://.godot/imported/counter.png-34b9e7d123a9cc4ef081254e27f4cf64.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://textures/shop/counter.png"
dest_files=["res://.godot/imported/counter.png-34b9e7d123a9cc4ef081254e27f4cf64.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

+40
View File
@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ejby14dl1svr"
path="res://.godot/imported/hob.png-d5f291318e31b8c1fd380973ba2b3e5f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://textures/shop/hob.png"
dest_files=["res://.godot/imported/hob.png-d5f291318e31b8c1fd380973ba2b3e5f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

+40
View File
@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ecdu0qqhib4"
path="res://.godot/imported/sink.png-b4ba3b467f19b9cacd807739403f133b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://textures/shop/sink.png"
dest_files=["res://.godot/imported/sink.png-b4ba3b467f19b9cacd807739403f133b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
+2 -1
View File
@@ -74,4 +74,5 @@ unique_name_in_owner = true
custom_minimum_size = Vector2(0, 64)
layout_mode = 2
theme_override_font_sizes/font_size = 26
text = "Restasrt?"
text = "Restart
"
+294
View File
@@ -0,0 +1,294 @@
[gd_scene format=3 uid="uid://dihdlvlebtp5j"]
[ext_resource type="Script" uid="uid://xrfp03b32j1t" path="res://UI/shop_ui.gd" id="1_2k6ie"]
[ext_resource type="PackedScene" uid="uid://u7rpukx5ebqo" path="res://UI/shop_station_panel.tscn" id="1_pogqh"]
[ext_resource type="PackedScene" uid="uid://efaec6ymgabo" path="res://stations/Counter.tscn" id="2_35otv"]
[ext_resource type="Texture2D" uid="uid://c0nd4nh4vja73" path="res://textures/shop/counter.png" id="3_74fni"]
[ext_resource type="PackedScene" uid="uid://j7caslh27nor" path="res://stations/Hob.tscn" id="4_l3qkl"]
[ext_resource type="Texture2D" uid="uid://ejby14dl1svr" path="res://textures/shop/hob.png" id="5_2k6ie"]
[ext_resource type="PackedScene" uid="uid://dvrk268s7gkxh" path="res://stations/sink.tscn" id="6_rktus"]
[ext_resource type="Texture2D" uid="uid://ecdu0qqhib4" path="res://textures/shop/sink.png" id="7_4titf"]
[sub_resource type="LabelSettings" id="LabelSettings_vlqg6"]
font_size = 35
outline_size = 10
outline_color = Color(0.1, 0.1, 0.1, 1)
[node name="Shop" type="Panel" unique_id=783244304]
offset_right = 540.0
offset_bottom = 546.0
script = ExtResource("1_2k6ie")
[node name="Title" type="Label" parent="." unique_id=502212741]
layout_mode = 1
anchors_preset = -1
offset_left = 20.0
offset_top = 20.0
text = "Shop"
label_settings = SubResource("LabelSettings_vlqg6")
[node name="Money" type="Label" parent="." unique_id=273879940]
layout_mode = 1
anchors_preset = -1
anchor_left = 1.0
anchor_right = 1.0
offset_top = 20.0
offset_right = -20.0
grow_horizontal = 0
pivot_offset_ratio = Vector2(1, 0)
text = "9999 $"
label_settings = SubResource("LabelSettings_vlqg6")
horizontal_alignment = 2
[node name="TabContainer" type="TabContainer" parent="." unique_id=783976311]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 20.0
offset_top = 80.0
offset_right = -20.0
offset_bottom = -20.0
current_tab = 1
[node name="Stations" type="GridContainer" parent="TabContainer" unique_id=189446761]
visible = false
layout_mode = 2
columns = 6
metadata/_tab_index = 0
[node name="StationButton" parent="TabContainer/Stations" unique_id=2079583080 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("2_35otv")
icon_texture = ExtResource("3_74fni")
station_name = "Counter"
cost = 30
[node name="Panel2" parent="TabContainer/Stations" unique_id=467593590 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("4_l3qkl")
icon_texture = ExtResource("5_2k6ie")
station_name = "Hob"
cost = 50
[node name="Panel3" parent="TabContainer/Stations" unique_id=1096388793 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("6_rktus")
icon_texture = ExtResource("7_4titf")
station_name = "Sink"
cost = 40
[node name="StationButton2" parent="TabContainer/Stations" unique_id=1037758002 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("2_35otv")
icon_texture = ExtResource("3_74fni")
station_name = "Counter"
cost = 30
[node name="Panel4" parent="TabContainer/Stations" unique_id=1667497770 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("4_l3qkl")
icon_texture = ExtResource("5_2k6ie")
station_name = "Hob"
cost = 50
[node name="Panel5" parent="TabContainer/Stations" unique_id=1982065975 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("6_rktus")
icon_texture = ExtResource("7_4titf")
station_name = "Sink"
cost = 40
[node name="StationButton3" parent="TabContainer/Stations" unique_id=1301410231 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("2_35otv")
icon_texture = ExtResource("3_74fni")
station_name = "Counter"
cost = 30
[node name="Panel6" parent="TabContainer/Stations" unique_id=1995120839 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("4_l3qkl")
icon_texture = ExtResource("5_2k6ie")
station_name = "Hob"
cost = 50
[node name="Panel7" parent="TabContainer/Stations" unique_id=761089034 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("6_rktus")
icon_texture = ExtResource("7_4titf")
station_name = "Sink"
cost = 40
[node name="StationButton4" parent="TabContainer/Stations" unique_id=1417297413 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("2_35otv")
icon_texture = ExtResource("3_74fni")
station_name = "Counter"
cost = 30
[node name="Panel8" parent="TabContainer/Stations" unique_id=1691237963 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("4_l3qkl")
icon_texture = ExtResource("5_2k6ie")
station_name = "Hob"
cost = 50
[node name="Panel9" parent="TabContainer/Stations" unique_id=1365829405 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("6_rktus")
icon_texture = ExtResource("7_4titf")
station_name = "Sink"
cost = 40
[node name="StationButton5" parent="TabContainer/Stations" unique_id=2041495798 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("2_35otv")
icon_texture = ExtResource("3_74fni")
station_name = "Counter"
cost = 30
[node name="Panel10" parent="TabContainer/Stations" unique_id=1193707247 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("4_l3qkl")
icon_texture = ExtResource("5_2k6ie")
station_name = "Hob"
cost = 50
[node name="Panel11" parent="TabContainer/Stations" unique_id=1812217593 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("6_rktus")
icon_texture = ExtResource("7_4titf")
station_name = "Sink"
cost = 40
[node name="StationButton6" parent="TabContainer/Stations" unique_id=495155208 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("2_35otv")
icon_texture = ExtResource("3_74fni")
station_name = "Counter"
cost = 30
[node name="Panel12" parent="TabContainer/Stations" unique_id=773081956 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("4_l3qkl")
icon_texture = ExtResource("5_2k6ie")
station_name = "Hob"
cost = 50
[node name="Panel13" parent="TabContainer/Stations" unique_id=1722465236 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("6_rktus")
icon_texture = ExtResource("7_4titf")
station_name = "Sink"
cost = 40
[node name="StationButton7" parent="TabContainer/Stations" unique_id=920721283 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("2_35otv")
icon_texture = ExtResource("3_74fni")
station_name = "Counter"
cost = 30
[node name="Panel14" parent="TabContainer/Stations" unique_id=280005981 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("4_l3qkl")
icon_texture = ExtResource("5_2k6ie")
station_name = "Hob"
cost = 50
[node name="Panel15" parent="TabContainer/Stations" unique_id=1032476128 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("6_rktus")
icon_texture = ExtResource("7_4titf")
station_name = "Sink"
cost = 40
[node name="StationButton8" parent="TabContainer/Stations" unique_id=1596739090 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("2_35otv")
icon_texture = ExtResource("3_74fni")
station_name = "Counter"
cost = 30
[node name="Panel16" parent="TabContainer/Stations" unique_id=1045125889 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("4_l3qkl")
icon_texture = ExtResource("5_2k6ie")
station_name = "Hob"
cost = 50
[node name="Panel17" parent="TabContainer/Stations" unique_id=85646771 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("6_rktus")
icon_texture = ExtResource("7_4titf")
station_name = "Sink"
cost = 40
[node name="StationButton9" parent="TabContainer/Stations" unique_id=883484649 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("2_35otv")
icon_texture = ExtResource("3_74fni")
station_name = "Counter"
cost = 30
[node name="Panel18" parent="TabContainer/Stations" unique_id=259381012 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("4_l3qkl")
icon_texture = ExtResource("5_2k6ie")
station_name = "Hob"
cost = 50
[node name="Panel19" parent="TabContainer/Stations" unique_id=1701937266 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("6_rktus")
icon_texture = ExtResource("7_4titf")
station_name = "Sink"
cost = 40
[node name="StationButton10" parent="TabContainer/Stations" unique_id=381125476 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("2_35otv")
icon_texture = ExtResource("3_74fni")
station_name = "Counter"
cost = 30
[node name="Panel20" parent="TabContainer/Stations" unique_id=1573978940 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("4_l3qkl")
icon_texture = ExtResource("5_2k6ie")
station_name = "Hob"
cost = 50
[node name="Panel21" parent="TabContainer/Stations" unique_id=555544070 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("6_rktus")
icon_texture = ExtResource("7_4titf")
station_name = "Sink"
cost = 40
[node name="Food" type="GridContainer" parent="TabContainer" unique_id=422899445]
layout_mode = 2
columns = 6
metadata/_tab_index = 1
[node name="StationButton" parent="TabContainer/Food" unique_id=586692243 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("2_35otv")
icon_texture = ExtResource("3_74fni")
station_name = "Counter"
cost = 30
[node name="Panel2" parent="TabContainer/Food" unique_id=918076583 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("4_l3qkl")
icon_texture = ExtResource("5_2k6ie")
station_name = "Hob"
cost = 50
[node name="Panel3" parent="TabContainer/Food" unique_id=387664331 instance=ExtResource("1_pogqh")]
layout_mode = 2
station_scene = ExtResource("6_rktus")
icon_texture = ExtResource("7_4titf")
station_name = "Sink"
cost = 40
+14
View File
@@ -0,0 +1,14 @@
[gd_scene format=3 uid="uid://cmxe1av5nsxyq"]
[ext_resource type="PackedScene" uid="uid://dihdlvlebtp5j" path="res://UI/shop.tscn" id="1_e5js8"]
[ext_resource type="PackedScene" uid="uid://clujaf3u776a3" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" id="1_qtkxm"]
[node name="ShopMenu3D" type="Node3D" unique_id=331240263]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 0, 0, 0)
[node name="Viewport2Din3D" parent="." unique_id=651579338 instance=ExtResource("1_qtkxm")]
collision_layer = 5242880
scene = ExtResource("1_e5js8")
viewport_size = Vector2(807.655, 559.085)
transparent = 1
scene_properties_keys = PackedStringArray("shop_ui.gd")
+25
View File
@@ -0,0 +1,25 @@
extends Panel
@export var station_scene: PackedScene
@export var icon_texture: Texture2D
@export var station_name: String = "Station"
@export var cost: int = 100
@export var name_label: Label
@export var cost_label: Label
@export var button: Button
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
name_label.text = station_name
cost_label.text = str(cost) + "$"
button.icon = icon_texture
func _on_button_pressed() -> void:
print("ShopStationButton buy ", station_name)
func _process(_delta: float) -> void:
button.disabled = GameManager.money < cost
+1
View File
@@ -0,0 +1 @@
uid://bkal73wu2ajoi
+87
View File
@@ -0,0 +1,87 @@
[gd_scene format=3 uid="uid://u7rpukx5ebqo"]
[ext_resource type="Script" uid="uid://bkal73wu2ajoi" path="res://UI/shop_station_button.gd" id="1_5sumr"]
[ext_resource type="Texture2D" uid="uid://dw71nomipotqu" path="res://icon.svg" id="2_e1k4i"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_k4f0j"]
content_margin_left = 0.0
content_margin_top = 0.0
content_margin_right = 0.0
content_margin_bottom = 0.0
bg_color = Color(0.44921166, 0.47363085, 0.49934196, 0.6)
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
corner_detail = 5
[sub_resource type="LabelSettings" id="LabelSettings_24d3s"]
font_size = 18
[node name="Panel" type="Panel" unique_id=2079583080 node_paths=PackedStringArray("name_label", "cost_label", "button")]
custom_minimum_size = Vector2(80, 80)
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_styles/panel = SubResource("StyleBoxFlat_k4f0j")
script = ExtResource("1_5sumr")
name_label = NodePath("PanelName/Name")
cost_label = NodePath("PanelCost/Cost")
button = NodePath("Button")
[node name="Button" type="Button" parent="." unique_id=1482490300]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
icon = ExtResource("2_e1k4i")
icon_alignment = 1
expand_icon = true
[node name="PanelName" type="Panel" parent="." unique_id=580016879]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
anchor_bottom = 0.391
[node name="Name" type="Label" parent="PanelName" unique_id=455863013]
layout_mode = 1
anchors_preset = -1
offset_left = 4.0
offset_top = 6.0
offset_right = 122.0
offset_bottom = 32.0
grow_horizontal = 2
grow_vertical = 2
text = "Station"
label_settings = SubResource("LabelSettings_24d3s")
[node name="PanelCost" type="Panel" parent="." unique_id=1959621473]
custom_maximum_size = Vector2(60, -1)
layout_mode = 1
anchors_preset = -1
anchor_left = 0.411
anchor_top = 0.65
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 0
grow_vertical = 0
[node name="Cost" type="Label" parent="PanelCost" unique_id=924064438]
layout_mode = 1
anchors_preset = -1
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -34.0
offset_top = -29.0
offset_right = -6.0
offset_bottom = -6.0
grow_horizontal = 0
grow_vertical = 0
text = "999$"
horizontal_alignment = 2
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
+92
View File
@@ -0,0 +1,92 @@
class_name ShopUI
extends Panel
@onready var money_label: Label = $Money
var controller: XRController3D = null
var other_controller: XRController3D = null
const INPUT_TOGGLE_COOLDOWN := 0.15
var enabled: bool = false: set = _set_enabled
var _last_toggle_time := 0.0
var viewport: XRToolsViewport2DIn3D
func _ready() -> void:
detect_hand_from_xr_ancestor()
if controller:
controller.button_pressed.connect(_on_controller_button_pressed)
if other_controller:
other_controller.button_pressed.connect(_on_other_controller_button_pressed)
viewport = get_parent().get_parent() as XRToolsViewport2DIn3D
if not viewport:
push_error("Shop UI could not find XRToolsViewport2DIn3D grand parent")
enabled = false
func _process(_delta: float) -> void:
money_label.text = str(GameManager.money) + "$"
func toggle_shop():
if GameManager.game_state == GameManager.GameState.BUILDING:
print("Shop UI toggle shop")
enabled = !enabled
func _set_enabled(value: bool) -> void:
enabled = value
visible = value
if viewport:
viewport.enabled = value
_set_poke_enabled_for_controller(other_controller, value)
func _set_poke_enabled_for_controller(controller_node: XRController3D, value: bool) -> void:
if not controller_node:
return
var poke_node = Helper.find_first_child_of_type(controller_node, XRToolsPoke)
if poke_node:
print("Shop UI _set_poke_enabled_for_controller: ", poke_node.get_path(), " poke enabled: ", value)
poke_node.enabled = value
poke_node.visible = value
else:
print("Shop UI _set_poke_enabled_for_controller: ", controller_node.name, " poke not found")
# For some reason, this is called every frame the button is down. So we need our own timer.
func _on_controller_button_pressed(button_name: String) -> void:
print("Shop _on_controller_button_pressed, button: ", button_name)
var now := Time.get_ticks_msec() / 1000.0
if now - _last_toggle_time < INPUT_TOGGLE_COOLDOWN:
return
_last_toggle_time = now
if button_name == "ax_button":
toggle_shop()
func _on_other_controller_button_pressed(button_name: String) -> void:
# If user opens menu on other hand. Close this one.
if enabled and button_name == "ax_button":
enabled = false
func detect_hand_from_xr_ancestor() -> void:
controller = XRHelpers.get_xr_controller(self)
if not controller:
push_error("Shop UI could not find XRController3D ancestor")
return
var left_controller := XRHelpers.get_left_controller(self)
var right_controller := XRHelpers.get_right_controller(self)
if controller == left_controller:
other_controller = right_controller
elif controller == right_controller:
other_controller = left_controller
print("Shop UI detected hand: ", controller.get_tracker_hand())
+1
View File
@@ -0,0 +1 @@
uid://xrfp03b32j1t
+61
View File
@@ -0,0 +1,61 @@
## Stations
counter
hob
sink
table
extra knife
extre rolling pin
mop
bin
## Food dispensers
burger
buns
potato
tomato
onion
flour
pasta plates
meat
cheese
## Automation
belt
inserter
splitter
mixer
blender
dishwasher
flinger / catapult
## Storage
shelf
freezer
frozen prep station equivilant
## Control
Phone
Napkins (no mess consumable)
sharp cutlery (eat faster consumable)
Self order terminal
inserter
filer
output min empty space slider
belts share inventory
tables share
Shared INventory
Raycasts[]
Area3D
list
+1 -1
View File
@@ -1,7 +1,7 @@
class_name GameManager
extends Node
static var money: int
static var money: int = 35
static var meals_in_play: Array[String]
static var sides_in_play: Array[String]
+6
View File
@@ -9,6 +9,8 @@ func _unhandled_input(event: InputEvent) -> void:
set_buidling_mode()
if event.is_action_pressed("set_running_mode"):
set_running_mode()
if event.is_action_pressed("set_game_over"):
set_game_over()
# Finds any node of class/type Table and calls satisfyAllOrders()
@@ -29,3 +31,7 @@ func set_buidling_mode():
func set_running_mode():
print("Global key event: Setting running mode")
GameManager.game_state = GameManager.GameState.RUNNING
func set_game_over():
print("Global key event: Setting game over")
GameManager.game_state = GameManager.GameState.GAME_OVER
+9
View File
@@ -8,3 +8,12 @@ static func find_food_item(node: Node) -> FoodItem:
if child is FoodItem:
return child
return null
static func find_first_child_of_type(node: Node, type: Variant) -> Node:
for child in node.get_children():
if is_instance_of(child, type):
return child
var nested := find_first_child_of_type(child, type)
if nested:
return nested
return null
+5
View File
@@ -72,6 +72,11 @@ set_running_mode={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":44,"key_label":0,"unicode":44,"location":0,"echo":false,"script":null)
]
}
set_game_over={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":47,"key_label":0,"unicode":45,"location":0,"echo":false,"script":null)
]
}
[layer_names]
-1
View File
@@ -1 +0,0 @@
uid://be8o8m6xpp3kc