From bbf982c2f6c15f707ee46007ee40385b8dc0c48c Mon Sep 17 00:00:00 2001 From: JonShard Date: Tue, 28 Jul 2026 09:22:03 +0200 Subject: [PATCH] Add thrown plates absorb food on station --- Containers/container.gd | 12 +++++++++--- Containers/container.tscn | 2 +- Containers/plate.tscn | 5 ++--- Scenes/JonScene.tscn | 3 +++ Stations/Hob.tscn | 2 +- kanban_tasks_data.kanban | 10 +++++----- 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Containers/container.gd b/Containers/container.gd index 8464f07..52dd633 100644 --- a/Containers/container.gd +++ b/Containers/container.gd @@ -36,10 +36,15 @@ func _on_body_entered(body: Node3D) -> void: if not body.is_in_group(target_group): return print("Container _on_body_entered body: ", body) - var picked_by = xr_pickable.get_picked_up_by() - if picked_by and picked_by.is_in_group("station"): - # If compatible and enough space, add item + + # If one of us is in a station + var picked_by = xr_pickable.get_picked_up_by() + var body_pickable = body as XRToolsPickable + var body_picked_by = body_pickable.get_picked_up_by() if body_pickable else null + if (picked_by and picked_by.is_in_group("station")) or (body_picked_by and body_picked_by.is_in_group("station")): + + # If enough space, add item var food_item = body.get_node("FoodItem") print("Container in station found %s of type %s: %s" % [target_group, FoodItem.Type.keys()[food_item.type], body.name]) var meal_count := contained_items.filter(func(f): return f.type == FoodItem.Type.MEAL).size() @@ -52,6 +57,7 @@ func _on_body_entered(body: Node3D) -> void: _add_item(body) + # Contents are synced as data (ids on the plate's PlateController), not # reparented nodes: reparenting a MultiplayerSpawner-tracked item out of # WorldContent would despawn it on every client the instant it happened. diff --git a/Containers/container.tscn b/Containers/container.tscn index f2fab10..0db0167 100644 --- a/Containers/container.tscn +++ b/Containers/container.tscn @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://6lyhyial1fh5" path="res://Containers/container.gd" id="1_r4cle"] [sub_resource type="SphereShape3D" id="SphereShape3D_vlqg6"] -radius = 0.2 +radius = 0.3 [node name="Container" type="Node3D" unique_id=377793422 node_paths=PackedStringArray("meal_positions")] script = ExtResource("1_r4cle") diff --git a/Containers/plate.tscn b/Containers/plate.tscn index 15013f6..cd06c7f 100644 --- a/Containers/plate.tscn +++ b/Containers/plate.tscn @@ -8,7 +8,7 @@ [ext_resource type="Script" uid="uid://dvobm6vcfnqe8" path="res://addons/godot-xr-tools/hands/poses/hand_pose_settings.gd" id="4_dhtvl"] [ext_resource type="PackedScene" uid="uid://ctw7nbntd5pcj" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_right.tscn" id="5_vlcpl"] [ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="6_el51w"] -[ext_resource type="Script" path="res://Net/net_pickable.gd" id="20_netpk"] +[ext_resource type="Script" uid="uid://bwd0pe2udb5xo" path="res://Net/net_pickable.gd" id="20_netpk"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_kek77"] height = 0.0635376 @@ -153,7 +153,6 @@ polygon = PackedVector2Array(-0.053057775, 0.2586278, 0.09469998, 0.40791017, 0. depth = 0.02 material = SubResource("StandardMaterial3D_vlqg6") -[node name="NetPickable" type="MultiplayerSynchronizer" parent="."] -root_path = NodePath("..") +[node name="NetPickable" type="MultiplayerSynchronizer" parent="." unique_id=1770751620] replication_config = SubResource("SceneReplicationConfig_np_plate") script = ExtResource("20_netpk") diff --git a/Scenes/JonScene.tscn b/Scenes/JonScene.tscn index 2ea6f7b..bc130cb 100644 --- a/Scenes/JonScene.tscn +++ b/Scenes/JonScene.tscn @@ -104,6 +104,9 @@ transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.5 [node name="Counter3" parent="." unique_id=1498817646 instance=ExtResource("15_di04w")] transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.5477214, 0.5115016, 0.49258912) +[node name="Counter5" parent="Counter3" unique_id=200341072 instance=ExtResource("15_di04w")] +transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 1.8051152, 0, 3.5603657) + [node name="BurgerBunsDispenser" parent="." unique_id=1720683779 instance=ExtResource("9_sq0s2")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5242664, 0.008738995, 1.1073059) diff --git a/Stations/Hob.tscn b/Stations/Hob.tscn index e0fae15..774caf1 100644 --- a/Stations/Hob.tscn +++ b/Stations/Hob.tscn @@ -26,7 +26,7 @@ script = ExtResource("1_7jc4g") [node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1283846023] shape = SubResource("BoxShape3D_kdxnr") -[node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=538157739] +[node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=538157739 groups=["station"]] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5270121, 0) collision_layer = 65536 collision_mask = 65540 diff --git a/kanban_tasks_data.kanban b/kanban_tasks_data.kanban index a3b3aed..b3d3ed7 100644 --- a/kanban_tasks_data.kanban +++ b/kanban_tasks_data.kanban @@ -17,10 +17,7 @@ "784d5cd3-333a-40a9-b35f-3d0c73f00761", "21bc19f1-ee3c-4bbb-ab9a-07ec6123a823", "d93a31cd-d475-4c5a-87fc-983174b2594f", - "9d7ecbc4-db2a-4d09-9f40-ceed3cf98c00", - "0dd511cd-592c-4334-afd8-c511bd36b7d0", - "7883d015-f065-4b18-a2ab-e2a0daa9dc81", - "caf459e5-bb88-47dd-bf15-254a3d70c30f" + "9d7ecbc4-db2a-4d09-9f40-ceed3cf98c00" ] }, { @@ -34,15 +31,18 @@ "uuid": "fab8a81b-7ca9-4026-96bb-ed66ea58ef2e", "title": "Doing", "tasks": [ - "f8073eb2-8786-47b7-b63f-fa70c3f7115a" + "f8073eb2-8786-47b7-b63f-fa70c3f7115a", + "caf459e5-bb88-47dd-bf15-254a3d70c30f" ] }, { "uuid": "0d743057-955a-473a-8123-a3f805505d5d", "title": "Done", "tasks": [ + "0dd511cd-592c-4334-afd8-c511bd36b7d0", "6942c45a-53a4-484f-9885-4f249cb4572b", "a4dd35ae-dc8e-42a3-9044-bf1cb1af281a", + "7883d015-f065-4b18-a2ab-e2a0daa9dc81", "1c3b9543-cb67-431d-bf71-c8753e816776", "d9cebd68-792e-4d01-a916-7df5f128b4a8", "eee1990e-f957-4499-84b6-e68003fcb78e",