50 Commits

Author SHA1 Message Date
algodoogle ee835ea295 Split the multiplayer test harness into modules
mp_test_driver.gd was 1458 lines doing six unrelated jobs. It is now
orchestration only — the scripted sequence, the RPC plumbing between peers, and
the manual keyboard controls — with the work in modules that each have one:

  MpWorldView  finding things in the world and describing what they are doing
  MpSteps      the simulated player actions (reach, grab, carry, drop)
  MpAsserts    the per-step checks
  MpSnapshot   the cross-peer sync audit
  MpReport     the ledger, the log, the overlay, the screenshots

The scenario list and the audit logic carry over unchanged. That audit compares
what is actually RENDERED on both peers, not just the replicated values behind
it, which is the only thing that catches a plate whose contents arrived but
whose visuals were never rebuilt — so it was worth moving verbatim.

Assertions that tested the old model now test the new one: "who is holding
this" is the authority of the object's NetXform, not of the object itself.

Suite: 146/146 passing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 23:22:58 +01:00
algodoogle 61d92052ac Rebuild multiplayer on the stock spawner and synchronizer
Adding an object to the game no longer requires any networking code. The
MultiplayerSpawner runs in its default mode — no spawn_function, no payload
dictionary — and NetReplication builds each object's SceneReplicationConfig
from a convention, so scenes carry no hand-authored replication at all.

Every replicated node gets two generated synchronizers: NetSync for script
state, always server-owned, and NetXform for position, handed to whoever is
holding the object. That split is what makes grab prediction work — a
synchronizer never applies inbound state on the peer that owns it, so a
player's own hand drives an object with no round trip while is_dirty and
friends keep flowing one way from the server.

Interaction is now two RPCs for the whole game (NetGrab), and client gating is
one rule applied to every object (NetWorld). Deleted: net_pickable.gd, the
replicated net_held_by field and its held-state juggling, the
grant/reject/force-release negotiation, the static-item despawn RPC, and the
per-scene replication configs. Authority is the single source of truth for who
simulates an object.

Two things the convention had to learn, both found by the test suite:

  * Addon scripts are excluded. godot-xr-tools' snap zones and pickables expose
    a public `enabled`, which is exactly the flag each peer must set for itself
    — so replicating it meant the server sent `enabled = true` back over every
    client's gate, and stations went on grabbing objects out of the local
    player's hands.
  * Arrays of nodes are excluded. Array[Node3D] and Array[FoodItem] would
    otherwise try to serialise live node references.

table.gd's replicated state loses its underscore prefix, which now marks a
variable as private and unreplicated; two in-place array mutations there were
skipping their setters, and the progress bar could divide by zero on a client.

Suite: 146/146 passing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 22:04:22 +01:00
algodoogle 0ebd0a4a85 Design + spike for high-level replication rebuild
Rebuild the multiplayer layer on stock MultiplayerSpawner/Synchronizer so
adding an object to the game needs no networking code.

MultiplayerSpawner only replicates node creation and deletion, so "sync
everything regardless of what it is" has to come from a SceneReplicationConfig
built by convention in code. NetReplication does that, giving every node two
generated synchronizers: NetSync for script state (always server-owned) and
NetXform for position (handed to whoever is holding the object).

test/spike/ establishes the four engine behaviours the design rests on. Two
are worth flagging: per-peer visibility CANNOT be used to stop the server
fighting a client's held object, because MultiplayerSpawner despawns and
respawns the node on every visibility flip; and set_visibility_for is only an
override on top of public_visibility, so calling it alone does nothing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 21:42:30 +01:00
JonShard 59c62b73e6 Test multi cube 2026-07-28 21:16:35 +02:00
algodoogle a2bad29f2a mp fix2 2026-07-28 19:48:40 +01:00
algodoogle 0ddada4568 Merge branch 'master' of https://git.offcoursegames.com/JonShard/VRyHungry1 2026-07-28 19:41:34 +01:00
algodoogle 96ea2dd1ea mp fix 2026-07-28 19:41:31 +01:00
JonShard 8b6f444d55 Fix XRTools library bug that didn't nil check in pickup 2026-07-28 19:16:35 +02:00
JonShard 29326f4b78 Apply money sound effect to table 2026-07-28 19:15:52 +02:00
JonShard e5aa13cef7 Add money sound effect 2026-07-28 19:06:28 +02:00
algodoogle 7479cbd656 multy thing 2026-07-28 18:01:27 +01:00
algodoogle f760c8c9f7 Merge branch 'master' of https://git.offcoursegames.com/JonShard/VRyHungry1 2026-07-28 15:21:12 +01:00
algodoogle 8e14fb0f29 fix hob efect 2026-07-28 15:20:46 +01:00
JonShard 6346d563e0 Fix bug in table 2026-07-28 15:33:13 +02:00
algodoogle fd7f9f3a22 Merge branch 'master' of https://git.offcoursegames.com/JonShard/VRyHungry1 2026-07-28 14:32:55 +01:00
algodoogle e002c2fb4a tabel time 2026-07-28 14:32:52 +01:00
JonShard 0872271c8c Fix player collides with items on floor 2026-07-28 14:47:24 +02:00
JonShard b9c9a3b73a Add more snap_zone sounds 2026-07-28 13:11:53 +02:00
JonShard 7d694de307 Add DespawningItem 2026-07-28 10:39:34 +02:00
JonShard 3f951fef64 Add Items slide off dispensers 2026-07-28 10:39:15 +02:00
JonShard 11b4d3c138 Merge branch 'master' of https://git.offcoursegames.com/JonShard/VRyHungry1 2026-07-28 09:24:28 +02:00
JonShard bbf982c2f6 Add thrown plates absorb food on station 2026-07-28 09:22:03 +02:00
algodoogle 69175e7b5e ju 2026-07-27 22:32:07 +01:00
algodoogle 1a893ba9aa Visual indicator 2026-07-27 18:56:28 +01:00
algodoogle 29083a4250 some thig 2026-07-27 16:24:54 +01:00
algodoogle 57f1cd167a Merge branch 'master' of https://git.offcoursegames.com/JonShard/VRyHungry1 2026-07-27 16:14:52 +01:00
algodoogle f3abe69eb4 small things 2026-07-27 16:14:13 +01:00
JonShard b1a2098a08 Merge branch 'master' of https://git.offcoursegames.com/JonShard/VRyHungry1 2026-07-27 17:07:21 +02:00
JonShard 71580ad183 Fix Snap_zones not range grabbing 2026-07-27 17:07:18 +02:00
JonShard d0c13effa2 Import sounds 2026-07-27 17:03:51 +02:00
algodoogle 688eca13fa Merge branch 'master' of https://git.offcoursegames.com/JonShard/VRyHungry1 2026-07-27 13:47:54 +01:00
algodoogle c758771a75 gameover 2026-07-27 13:47:50 +01:00
JonShard d2f5e1fd4f jon scene: preview grid scales 2026-07-27 14:41:10 +02:00
JonShard 5dae9c5779 Add Plate dispenser 2026-07-27 14:40:38 +02:00
JonShard 488feff7dc Add raw burger and cube dispenser 2026-07-27 14:20:44 +02:00
JonShard b7775e9de6 Add progress bar to Table 2026-07-27 13:32:04 +02:00
JonShard 01587e3b9c Add progress bar to Sink 2026-07-27 12:53:33 +02:00
JonShard f4b2e687b5 Add Progress bar to Hob 2026-07-27 10:16:44 +02:00
JonShard 34a649f507 Kanban 2026-07-26 16:14:29 +02:00
JonShard e04c5519d0 Move stations to floor 2026-07-26 16:00:30 +02:00
algodoogle 7ac87984bc Merge branch 'multi2' of https://git.offcoursegames.com/JonShard/VRyHungry1 into multi2 2026-07-26 14:33:20 +01:00
algodoogle 776aaa3020 bug fix 2026-07-26 14:33:15 +01:00
JonShard 5ca64b8dff Fix error about custom_solver_bias not supported 2026-07-26 15:05:05 +02:00
algodoogle ae3e7ec674 jiff 2026-07-26 13:49:46 +01:00
algodoogle 23ec41c1d6 Fix five multiplayer sync bugs, add automated two-instance test
Adds test/multiPlayerTest.tscn plus a driver that runs the kitchen flow
across two game instances: grab/drop, dirt station, sink washing, hob
cooking, counter combining and plating. Runs headless (run_mp_test.ps1),
in two visible windows (run_mp_test_windowed.ps1), or by hand with
keyboard controls (play_mp_test.ps1). 108 checks, exits non-zero on
failure.

After every step both peers snapshot every item's position and rendered
state and the server diffs them. Targeted assertions only look at the
thing a step touched, which misses desyncs elsewhere - that audit is
what caught the last bug below.

Bugs found and fixed:

- net_pickable: apply_held_state() only wrote `enabled` in its
  non-authority branch, so once a client grabbed an item every other
  peer set enabled=false and regaining authority never restored it. The
  server could then never pick that item up again, and a station would
  "snap" it (emitting has_picked_up, so a plate still got marked dirty)
  while pick_up() bailed out on the disabled item - leaving the zone
  holding an item with no grab driver.

- network_manager: station gating only happened in the spawn path, so
  stations baked into a scene file kept running their snap zones on
  clients and grabbed items straight out of the local hand. Added
  gate_existing_stations().

- network_manager: despawn_item() only freed the server's copy. Items
  baked into a scene aren't tracked by the MultiplayerSpawner, so
  consuming one left a ghost on every client, which then blocked the
  station it sat in and got grabbed instead of its replacement.

- network_manager: the snap-into-station decision read the server's own
  copy of the item position, but the reliable release RPC routinely
  overtakes the synchronizer's unordered position updates - so it acted
  on a stale position and teleported items back into the station they
  had just been carried away from. The releasing peer now sends its
  final transform and the server adopts it first.

- container: contained_ids.append()/erase() mutate the array in place,
  which never fires the setter that rebuilds the plate's visuals. The
  peer that put food on a plate was the only peer that never redrew it;
  remote peers looked right because the synchronizer assigns there.

Also null-guards XRServer.get_tracker() in the vendored xr-tools hand
grab point, which threw on every successful grab without an XR runtime,
and adds multiplayer_world.populate_from_layout so debug scenes can bake
their own content instead of spawning the whole kitchen.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 02:00:50 +01:00
algodoogle 33ef81306d asd 2026-07-25 21:58:14 +01:00
JonShard 50efeeb353 Merge branch 'multi2' of https://git.offcoursegames.com/JonShard/VRyHungry1 into multi2 2026-07-25 22:11:03 +02:00
JonShard 71d01e5be1 Add game export preset 2026-07-25 22:09:46 +02:00
algodoogle 87641dd55c Enable file logging to logs/, gitignore its output
Pairs with the debug-log-heavy investigation workflow: Godot writes its
own engine log to logs/godot.log alongside the existing NetworkManager
temp-file log, and the directory is excluded from version control since
it's runtime output, not source.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-25 21:07:29 +01:00
algodoogle d65b2ca863 Add diagnostic logging for item grab/authority state transitions
The snap-zone crash fixed just before this was invisible in the logs
until traced through addon source by hand — the log showed grabs,
drops, and authority handoffs, but nothing about which peer/hand/zone
actually held an item at each step, or when a guard clause silently
changed behavior.

Adds a _holder_desc() helper (reports "loose", "hand(<path>)",
"zone(<station>)", or "other(...)") and logs every net_held_by
transition, every reclaim that has to restore freeze_mode/collision_mask
from a stuck state, every time the grab-race guard protects an actively-
held item from a stale sync, every force-drop triggered by a losing
authority race, and every pickup/drop event including the ones that
don't get forwarded (picked up by something other than a hand, or
dropped while not authority — exactly the silent case behind the
snap-zone crash). NetworkManager's snap/release-from-zone calls get the
same treatment: which station an item is pulled from, and whether a
snap attempt succeeded, was skipped by the race guard, or found nothing
in range.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-25 21:07:21 +01:00
137 changed files with 6228 additions and 1150 deletions
+4 -1
View File
@@ -1,4 +1,7 @@
# Godot 4+ specific ignores
.godot/
.build/
/android/
.log
/logs
*.log
+59 -13
View File
@@ -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.
@@ -73,7 +79,16 @@ func _add_item(item: Node3D) -> void:
var plate_controller := xr_pickable.get_node_or_null("PlateController") as PlateController
if plate_controller:
plate_controller.contained_ids.append(food_node.id)
# Reassign rather than append in place. contained_ids has a setter that
# rebuilds the plate's visuals, and mutating the array never triggers it —
# so the peer that actually added the food was the one peer that never
# redrew the plate. Remote peers looked right (the synchronizer assigns
# the value there, which does fire the setter), and the stale peer only
# caught up if someone else took the plate and sent the value back.
# duplicate() keeps the Array[String] typing that the property requires.
var updated := plate_controller.contained_ids.duplicate()
updated.append(food_node.id)
plate_controller.contained_ids = updated
NetworkManager.despawn_item(item)
@@ -82,7 +97,10 @@ func erase_item(item: FoodItem) -> void:
contained_items.erase(item)
var plate_controller := xr_pickable.get_node_or_null("PlateController") as PlateController
if plate_controller:
plate_controller.contained_ids.erase(item.id)
# Same reason as _add_item: assign so the visuals actually refresh.
var remaining := plate_controller.contained_ids.duplicate()
remaining.erase(item.id)
plate_controller.contained_ids = remaining
func clear() -> void:
@@ -129,21 +147,35 @@ func refresh_visuals(ids: Array[String]) -> void:
_make_cosmetic(visual)
container_root.add_child(visual)
# Must happen after add_child: entering the world is what puts the body
# into the physics space, so it can only be taken out again afterwards.
_remove_from_physics(visual)
visual.position = positions[idx].position
visual.rotation = positions[idx].rotation
# Strip interactivity/networking from a display-only copy: it's not spawned
# through NetworkManager, so it must never try to sync (its NetPickable child,
# if any, would have no corresponding replicated identity on other peers) or
# be grabbable/collidable.
# Strip interactivity from a display-only copy. It is instantiated straight from
# its scene rather than spawned through NetWorld, so it is not part of the
# replicated world at all — it exists only to be looked at, and must not be
# grabbable or collidable.
#
# It gets no synchronizers either: NetReplication.attach only ever runs for
# direct children of the content root, and this is parented under a plate.
func _make_cosmetic(visual: Node3D) -> void:
var net_pickable := visual.get_node_or_null("NetPickable")
if net_pickable:
net_pickable.queue_free()
var despawn_timer := visual.get_node_or_null("DespawningItem")
if despawn_timer:
# Detached and freed outright rather than queue_free()d: this runs before
# `visual` is added to the tree, and a merely-queued node still enters the
# tree with its parent and runs a frame of _process before the queued
# deletion lands at the end of the frame.
visual.remove_child(despawn_timer)
despawn_timer.free()
if visual is RigidBody3D:
visual.freeze = true
visual.freeze_mode = RigidBody3D.FREEZE_MODE_KINEMATIC
# STATIC, not KINEMATIC: a kinematic body is still driven by the physics
# engine (see _remove_from_physics), and "static decoration" is what this
# actually is.
visual.freeze_mode = RigidBody3D.FREEZE_MODE_STATIC
visual.collision_layer = 0
visual.collision_mask = 0
if visual is XRToolsPickable:
@@ -152,6 +184,20 @@ func _make_cosmetic(visual: Node3D) -> void:
visual.set_physics_process(false)
# Take a display-only copy out of the physics simulation completely.
#
# Freezing is not enough. Under Jolt (this project's physics engine) a frozen
# KINEMATIC RigidBody3D is still simulated: it is driven toward its target
# transform by velocity rather than being teleported. Parented to a plate that
# gets picked up and carried, it therefore lags behind, keeps its velocity, and
# overshoots — so the food visibly slid off the plate and ended up metres away,
# differently on each peer since each simulates its own copy. A body with no
# space is never touched by the engine, so it simply follows its parent.
func _remove_from_physics(visual: Node3D) -> void:
if visual is RigidBody3D:
PhysicsServer3D.body_set_space((visual as RigidBody3D).get_rid(), RID())
#plate (Pickalbe)
#XRGrapPoints
#container (script) (meal positions[1], side positions[4])
+1 -1
View File
@@ -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")
-22
View File
@@ -8,7 +8,6 @@
[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"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_kek77"]
height = 0.0635376
@@ -27,23 +26,6 @@ metadata/_custom_type_script = "uid://dvobm6vcfnqe8"
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_vlqg6"]
albedo_color = Color(0.36656043, 0.16690676, 0.12531222, 1)
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_np_plate"]
properties/0/path = NodePath(".:position")
properties/0/spawn = false
properties/0/replication_mode = 1
properties/1/path = NodePath(".:quaternion")
properties/1/spawn = false
properties/1/replication_mode = 1
properties/2/path = NodePath("NetPickable:net_held_by")
properties/2/spawn = true
properties/2/replication_mode = 1
properties/3/path = NodePath("PlateController:contained_ids")
properties/3/spawn = true
properties/3/replication_mode = 1
properties/4/path = NodePath("PlateController:is_dirty")
properties/4/spawn = true
properties/4/replication_mode = 1
[node name="Plate" type="RigidBody3D" unique_id=190487773]
collision_layer = 4
collision_mask = 196615
@@ -153,7 +135,3 @@ 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("..")
replication_config = SubResource("SceneReplicationConfig_np_plate")
script = ExtResource("20_netpk")
+7
View File
@@ -30,6 +30,13 @@ func _process(_delta: float) -> void:
func _set_contained_ids(value: Array[String]) -> void:
# Only rebuild when the contents actually changed. refresh_visuals() frees and
# re-instantiates a scene per item, so a redundant call is thousands of
# throwaway nodes over a session. NetReplication uses ON_CHANGE for state, so
# the synchronizer should not be assigning this unless it really changed — but
# a local write can still repeat a value, and this stays cheap either way.
if contained_ids == value:
return
contained_ids = value
# Deferred: this can be written by the replicated spawn payload before
# this node's own @onready vars (container) have resolved.
+21
View File
@@ -5,6 +5,17 @@ static var money: int
static var meals_in_play: Array[String]
static var sides_in_play: Array[String]
enum GameState {
RUNNING,
GAME_OVER
}
static var game_state: GameState = GameState.RUNNING
static func _restart():
print("restart Game")
game_state = GameState.RUNNING
static func get_random_meal() -> String:
if meals_in_play.size() == 0:
@@ -22,3 +33,13 @@ static func get_random_side() -> String:
var rand_index = randi() % sides_in_play.size()
print("GameManager: get_random_side() returning ", sides_in_play[rand_index])
return sides_in_play[rand_index]
static func game_over():
print("Game Over")
game_state = GameState.GAME_OVER
Signals.game_over.emit()
+2 -16
View File
@@ -8,7 +8,7 @@
[ext_resource type="Animation" uid="uid://bediglpx0rj7i" path="res://addons/godot-xr-tools/hands/animations/left/Grip 5.res" id="6_ftab3"]
[ext_resource type="PackedScene" uid="uid://3lr2dhy62rhk" path="res://Prefabs/combinable_item.tscn" id="7_wb51u"]
[ext_resource type="PackedScene" uid="uid://bfj80jh13t6e5" path="res://Prefabs/food_item.tscn" id="8_t9y3x"]
[ext_resource type="Script" path="res://Net/net_pickable.gd" id="20_netpk"]
[ext_resource type="PackedScene" uid="uid://b5ukku8i0hilb" path="res://Prefabs/despawning_item.tscn" id="10_46e7r"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_vlqg6"]
height = 0.10708985
@@ -27,17 +27,6 @@ metadata/_custom_type_script = "uid://dvobm6vcfnqe8"
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_hoqox"]
albedo_color = Color(0.6784191, 0.54546416, 0.016760282, 1)
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_np_buns"]
properties/0/path = NodePath(".:position")
properties/0/spawn = false
properties/0/replication_mode = 1
properties/1/path = NodePath(".:quaternion")
properties/1/spawn = false
properties/1/replication_mode = 1
properties/2/path = NodePath("NetPickable:net_held_by")
properties/2/spawn = true
properties/2/replication_mode = 1
[node name="BurgerBuns" unique_id=1088240294 instance=ExtResource("1_g1t48")]
[node name="CollisionShape3D" parent="." index="0"]
@@ -85,7 +74,4 @@ type = 2
[node name="CombinableItem" parent="." index="5" unique_id=996936271 instance=ExtResource("7_wb51u")]
[node name="NetPickable" type="MultiplayerSynchronizer" parent="."]
root_path = NodePath("..")
replication_config = SubResource("SceneReplicationConfig_np_buns")
script = ExtResource("20_netpk")
[node name="DespawningItem" parent="." index="7" unique_id=303090111 instance=ExtResource("10_46e7r")]
+2 -17
View File
@@ -8,10 +8,9 @@
[ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="6_cp3eg"]
[ext_resource type="PackedScene" uid="uid://bfj80jh13t6e5" path="res://Prefabs/food_item.tscn" id="7_mde49"]
[ext_resource type="PackedScene" uid="uid://3lr2dhy62rhk" path="res://Prefabs/combinable_item.tscn" id="8_wmrff"]
[ext_resource type="Script" path="res://Net/net_pickable.gd" id="20_netpk"]
[ext_resource type="PackedScene" uid="uid://b5ukku8i0hilb" path="res://Prefabs/despawning_item.tscn" id="10_6ypk4"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_gkni8"]
custom_solver_bias = 0.1
height = 0.1
radius = 0.1
@@ -34,17 +33,6 @@ script = ExtResource("4_mgacb")
closed_pose = ExtResource("6_cp3eg")
metadata/_custom_type_script = "uid://dvobm6vcfnqe8"
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_np_charcoal"]
properties/0/path = NodePath(".:position")
properties/0/spawn = false
properties/0/replication_mode = 1
properties/1/path = NodePath(".:quaternion")
properties/1/spawn = false
properties/1/replication_mode = 1
properties/2/path = NodePath("NetPickable:net_held_by")
properties/2/spawn = true
properties/2/replication_mode = 1
[node name="PickableObject" unique_id=1675596942 instance=ExtResource("1_r73y2")]
[node name="CollisionShape3D" parent="." index="0"]
@@ -67,7 +55,4 @@ type = 2
[node name="CombinableItem" parent="." index="5" unique_id=996936271 instance=ExtResource("8_wmrff")]
[node name="NetPickable" type="MultiplayerSynchronizer" parent="."]
root_path = NodePath("..")
replication_config = SubResource("SceneReplicationConfig_np_charcoal")
script = ExtResource("20_netpk")
[node name="DespawningItem" parent="." index="7" unique_id=303090111 instance=ExtResource("10_6ypk4")]
+2 -16
View File
@@ -7,8 +7,8 @@
[ext_resource type="PackedScene" uid="uid://ctw7nbntd5pcj" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_right.tscn" id="5_a0a5b"]
[ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="6_bdp75"]
[ext_resource type="PackedScene" uid="uid://3lr2dhy62rhk" path="res://Prefabs/combinable_item.tscn" id="7_bdp75"]
[ext_resource type="PackedScene" uid="uid://b5ukku8i0hilb" path="res://Prefabs/despawning_item.tscn" id="10_uygc5"]
[ext_resource type="PackedScene" uid="uid://bfj80jh13t6e5" path="res://Prefabs/food_item.tscn" id="11_vjw41"]
[ext_resource type="Script" path="res://Net/net_pickable.gd" id="20_netpk"]
[sub_resource type="BoxShape3D" id="BoxShape3D_m1xbq"]
size = Vector3(0.1, 0.1, 0.1)
@@ -30,17 +30,6 @@ script = ExtResource("4_hc3f7")
closed_pose = ExtResource("6_bdp75")
metadata/_custom_type_script = "uid://dvobm6vcfnqe8"
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_np_cube"]
properties/0/path = NodePath(".:position")
properties/0/spawn = false
properties/0/replication_mode = 1
properties/1/path = NodePath(".:quaternion")
properties/1/spawn = false
properties/1/replication_mode = 1
properties/2/path = NodePath("NetPickable:net_held_by")
properties/2/spawn = true
properties/2/replication_mode = 1
[node name="PickableObject" unique_id=1675596942 groups=["platalbe_item"] instance=ExtResource("1_dbtw8")]
[node name="CollisionShape3D" parent="." index="0"]
@@ -63,7 +52,4 @@ type = 1
[node name="CombinableItem" parent="." index="5" unique_id=996936271 instance=ExtResource("7_bdp75")]
[node name="NetPickable" type="MultiplayerSynchronizer" parent="."]
root_path = NodePath("..")
replication_config = SubResource("SceneReplicationConfig_np_cube")
script = ExtResource("20_netpk")
[node name="DespawningItem" parent="." index="7" unique_id=303090111 instance=ExtResource("10_uygc5")]
+2 -16
View File
@@ -7,8 +7,8 @@
[ext_resource type="Script" uid="uid://dvobm6vcfnqe8" path="res://addons/godot-xr-tools/hands/poses/hand_pose_settings.gd" id="5_w8sii"]
[ext_resource type="PackedScene" uid="uid://ctw7nbntd5pcj" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_right.tscn" id="6_mvnl5"]
[ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="7_wqxjj"]
[ext_resource type="PackedScene" uid="uid://b5ukku8i0hilb" path="res://Prefabs/despawning_item.tscn" id="10_l4hsd"]
[ext_resource type="PackedScene" uid="uid://bfj80jh13t6e5" path="res://Prefabs/food_item.tscn" id="10_yxtxs"]
[ext_resource type="Script" path="res://Net/net_pickable.gd" id="20_netpk"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_fco8w"]
height = 0.0338974
@@ -27,17 +27,6 @@ script = ExtResource("5_w8sii")
closed_pose = ExtResource("7_wqxjj")
metadata/_custom_type_script = "uid://dvobm6vcfnqe8"
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_np_burger"]
properties/0/path = NodePath(".:position")
properties/0/spawn = false
properties/0/replication_mode = 1
properties/1/path = NodePath(".:quaternion")
properties/1/spawn = false
properties/1/replication_mode = 1
properties/2/path = NodePath("NetPickable:net_held_by")
properties/2/spawn = true
properties/2/replication_mode = 1
[node name="raw_burger" unique_id=1675596942 instance=ExtResource("1_fco8w")]
[node name="CollisionShape3D" parent="." index="0"]
@@ -62,7 +51,4 @@ hand_pose = SubResource("Resource_qyiot")
id = "raw_burger"
type = 2
[node name="NetPickable" type="MultiplayerSynchronizer" parent="."]
root_path = NodePath("..")
replication_config = SubResource("SceneReplicationConfig_np_burger")
script = ExtResource("20_netpk")
[node name="DespawningItem" parent="." index="6" unique_id=303090111 instance=ExtResource("10_l4hsd")]
+2 -16
View File
@@ -6,9 +6,9 @@
[ext_resource type="Script" uid="uid://dvobm6vcfnqe8" path="res://addons/godot-xr-tools/hands/poses/hand_pose_settings.gd" id="5_ychvb"]
[ext_resource type="PackedScene" uid="uid://ctw7nbntd5pcj" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_right.tscn" id="6_etdv2"]
[ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="7_rl64h"]
[ext_resource type="PackedScene" uid="uid://b5ukku8i0hilb" path="res://Prefabs/despawning_item.tscn" id="10_6p8pj"]
[ext_resource type="PackedScene" uid="uid://3lr2dhy62rhk" path="res://Prefabs/combinable_item.tscn" id="10_ut7mg"]
[ext_resource type="PackedScene" uid="uid://bfj80jh13t6e5" path="res://Prefabs/food_item.tscn" id="10_zz42p"]
[ext_resource type="Script" path="res://Net/net_pickable.gd" id="20_netpk"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_fco8w"]
height = 0.04777527
@@ -27,17 +27,6 @@ script = ExtResource("5_ychvb")
closed_pose = ExtResource("7_rl64h")
metadata/_custom_type_script = "uid://dvobm6vcfnqe8"
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_np_cookedburger"]
properties/0/path = NodePath(".:position")
properties/0/spawn = false
properties/0/replication_mode = 1
properties/1/path = NodePath(".:quaternion")
properties/1/spawn = false
properties/1/replication_mode = 1
properties/2/path = NodePath("NetPickable:net_held_by")
properties/2/spawn = true
properties/2/replication_mode = 1
[node name="CookedBurger" unique_id=1675596942 instance=ExtResource("1_ut7mg")]
[node name="CollisionShape3D" parent="." index="0"]
@@ -64,7 +53,4 @@ type = 2
[node name="CombinableItem" parent="." index="5" unique_id=996936271 instance=ExtResource("10_ut7mg")]
[node name="NetPickable" type="MultiplayerSynchronizer" parent="."]
root_path = NodePath("..")
replication_config = SubResource("SceneReplicationConfig_np_cookedburger")
script = ExtResource("20_netpk")
[node name="DespawningItem" parent="." index="7" unique_id=303090111 instance=ExtResource("10_6p8pj")]
+2 -16
View File
@@ -7,7 +7,7 @@
[ext_resource type="PackedScene" uid="uid://ctw7nbntd5pcj" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_right.tscn" id="5_dunns"]
[ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="6_fh0f6"]
[ext_resource type="PackedScene" uid="uid://bfj80jh13t6e5" path="res://Prefabs/food_item.tscn" id="7_yy3y8"]
[ext_resource type="Script" path="res://Net/net_pickable.gd" id="20_netpk"]
[ext_resource type="PackedScene" uid="uid://b5ukku8i0hilb" path="res://Prefabs/despawning_item.tscn" id="9_ej8jm"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_fco8w"]
height = 0.10392761
@@ -29,17 +29,6 @@ albedo_color = Color(0.6784191, 0.54546416, 0.016760282, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6l01i"]
albedo_color = Color(0.29, 0.101500005, 0, 1)
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_np_hamburger"]
properties/0/path = NodePath(".:position")
properties/0/spawn = false
properties/0/replication_mode = 1
properties/1/path = NodePath(".:quaternion")
properties/1/spawn = false
properties/1/replication_mode = 1
properties/2/path = NodePath("NetPickable:net_held_by")
properties/2/spawn = true
properties/2/replication_mode = 1
[node name="Hamburger" unique_id=1675596942 groups=["platalbe_item"] instance=ExtResource("1_3gf3l")]
gravity_scale = 0.04
@@ -94,7 +83,4 @@ id = "hamburger"
type = 0
sell_value = 4
[node name="NetPickable" type="MultiplayerSynchronizer" parent="."]
root_path = NodePath("..")
replication_config = SubResource("SceneReplicationConfig_np_hamburger")
script = ExtResource("20_netpk")
[node name="DespawningItem" parent="." index="7" unique_id=303090111 instance=ExtResource("9_ej8jm")]
+136
View File
@@ -0,0 +1,136 @@
extends Node
## The whole interaction layer: two RPCs, for every object in the game.
##
## Registered as the "NetGrab" autoload so its RPCs resolve to the same node path
## on every peer.
##
## A hand picks something up locally the instant the player grabs it — no round
## trip, no waiting — and tells the server. The server answers by moving the
## object's NetXform to that peer, which is what actually makes the prediction
## work: a MultiplayerSynchronizer never applies inbound state on the peer that
## owns it, so from that moment the holder's own hand drives the object and the
## server's copy follows instead of fighting it. Releasing hands NetXform back,
## and the server decides where the object really ends up.
##
## Note what is NOT here. There is no per-object networking component, no
## replicated "who is holding this" field to keep in step with the authority, and
## no grant/reject/force-release negotiation. Authority is the single source of
## truth for who simulates an object, and NetWorld.apply_physics_role reads it.
## Starts watching a pickable. Called by NetWorld for every replicated object, so
## no scene has to include a networking node to take part.
func watch(item: XRToolsPickable) -> void:
if item.picked_up.is_connected(_on_picked_up):
return
item.picked_up.connect(_on_picked_up)
item.dropped.connect(_on_dropped)
func _on_picked_up(item: Node3D) -> void:
if not NetworkManager.is_online():
return
# A station snap zone grabbing something is the server placing it, not a
# player taking it, so it must not move authority anywhere.
if not (item.get_picked_up_by() is XRToolsFunctionPickup):
return
NetworkManager.log_line("%s grabbed by hand, claiming it" % item.name)
if NetworkManager.is_server():
_claim(item.get_path(), 1)
else:
# rpc_id() to ourselves is rejected by Godot, which is why the server
# branch calls straight through instead.
_request_grab.rpc_id(1, item.get_path())
func _on_dropped(item: Node3D) -> void:
if not NetworkManager.is_online():
return
# Only the peer that was actually driving the object reports a release. A drop
# caused by losing authority (see NetWorld.apply_physics_role) must not be
# echoed back as if the player had let go.
var xform := item.get_node_or_null(NetReplication.XFORM_NAME)
if not xform or not xform.is_multiplayer_authority():
return
# Our own final transform travels with the release. We were driving the object
# right up to this moment and our position updates ride the synchronizer's
# separate, unordered channel, which this reliable message routinely
# overtakes — so the server's copy can still be back where the object was
# before we carried it away. Deciding the snap from that stale position
# teleports the object straight back into the station it was just taken from.
if NetworkManager.is_server():
_settle(item.get_path(), item.global_transform, item.linear_velocity, item.angular_velocity)
else:
_request_release.rpc_id(
1, item.get_path(), item.global_transform,
item.linear_velocity, item.angular_velocity
)
# --- server side -----------------------------------------------------------
@rpc("any_peer", "reliable")
func _request_grab(item_path: NodePath) -> void:
if not NetworkManager.is_server():
return
_claim(item_path, multiplayer.get_remote_sender_id())
@rpc("any_peer", "reliable")
func _request_release(item_path: NodePath, xform: Transform3D, lin: Vector3, ang: Vector3) -> void:
if not NetworkManager.is_server():
return
_settle(item_path, xform, lin, ang)
func _claim(item_path: NodePath, peer: int) -> void:
var item := get_node_or_null(item_path)
if not item:
return
NetworkManager.log_line("grant %s to peer %d" % [item.name, peer])
# Order matters: hand the object over first, so the station's zone has already
# stopped owning it by the time it is told to let go.
_set_xform_authority.rpc(item_path, peer)
NetStations.release_from_zones(self, item)
func _settle(item_path: NodePath, xform: Transform3D, lin: Vector3, ang: Vector3) -> void:
var item := get_node_or_null(item_path)
if not item:
return
NetworkManager.log_line("release %s" % item.name)
if item is Node3D:
item.global_transform = xform
_set_xform_authority.rpc(item_path, 1)
if item is RigidBody3D:
item.linear_velocity = lin
item.angular_velocity = ang
NetStations.try_snap.call_deferred(self, item)
## set_multiplayer_authority is a local call, so every peer has to run it for
## them to agree on who is driving the object.
@rpc("authority", "call_local", "reliable")
func _set_xform_authority(item_path: NodePath, peer: int) -> void:
var item := get_node_or_null(item_path)
if not item:
return
var xform := item.get_node_or_null(NetReplication.XFORM_NAME)
if not xform:
return
xform.set_multiplayer_authority(peer)
NetworkManager.apply_physics_role(item)
## Hands everything a departing peer was holding back to the server. Without
## this, anything still in their hand when they dropped out would be frozen
## forever on every remaining peer, waiting on an authority that has gone.
func reclaim_from(peer: int) -> void:
if not NetworkManager.is_server():
return
for item in NetworkManager.replicated_objects():
var xform := item.get_node_or_null(NetReplication.XFORM_NAME)
if xform and xform.get_multiplayer_authority() == peer:
NetworkManager.log_line("reclaiming %s from departed peer %d" % [item.name, peer])
_settle(item.get_path(), item.global_transform, Vector3.ZERO, Vector3.ZERO)
+1
View File
@@ -0,0 +1 @@
uid://bv82nioivbmnx
-100
View File
@@ -1,100 +0,0 @@
extends MultiplayerSynchronizer
## Networked sync component for a pickable item. Added as a child literally
## named "NetPickable" (network_manager.gd's authority RPCs already expect
## this) of every net-synced pickable, replicating its transform and held
## state. Only the current multiplayer authority (the server while loose, or
## whichever peer is holding it) actually simulates physics for the item;
## every other peer freezes their local copy and just follows the synced
## transform.
## 0 = loose/server-simulated; otherwise the peer id currently holding it.
## Replicated at spawn and on change so a late joiner sees the current holder.
var net_held_by: int = 0: set = _set_net_held_by
var _pickable: XRToolsPickable
# This item's own baked freeze_mode (e.g. plate.tscn bakes KINEMATIC, not the
# RigidBody3D default of STATIC) — captured once so it can be restored when
# this peer regains ownership, instead of getting stuck on whatever
# apply_held_state() last forced it to while non-authority.
var _original_freeze_mode: int
func _ready() -> void:
_pickable = get_parent() as XRToolsPickable
if not _pickable:
push_error("NetPickable must be a child of an XRToolsPickable")
return
_original_freeze_mode = _pickable.freeze_mode
_pickable.picked_up.connect(_on_picked_up)
_pickable.dropped.connect(_on_dropped)
# Deferred: the pickable root captures its own original_collision_mask/
# original_collision_layer via @onready, which runs AFTER this child's
# _ready() but BEFORE the root's _ready() body. Calling apply_held_state
# synchronously here would freeze/mask the item before that capture runs,
# permanently corrupting the "restore on drop" values.
apply_held_state.call_deferred()
func _set_net_held_by(value: int) -> void:
net_held_by = value
apply_held_state()
## Puts the item in the right physics state for whether this peer currently
## owns it. Called locally after net_held_by changes, and directly by
## NetworkManager._set_item_authority right after an authority handoff.
func apply_held_state() -> void:
if not _pickable:
return
if not NetworkManager.is_online() or is_multiplayer_authority():
# We own this item's simulation (offline, loose+server, or currently
# holding it). If it's not actively in our own hand right now, make
# sure it isn't still left frozen/collision-less from a previous
# non-authority period (e.g. right after regaining authority when a
# client released it) — while actually held, XRToolsPickable's own
# pick_up()/let_go() already manage these fields, so leave those be.
if not _pickable.is_picked_up():
_pickable.freeze_mode = _original_freeze_mode
_pickable.collision_mask = _pickable.original_collision_mask
return
# A net_held_by/position sync update can race ahead of the
# authority-handoff RPC that's about to confirm a grab we just made
# optimistically (they travel on different channels with no ordering
# guarantee). Don't let a stale sync value yank an item out of our own
# hand mid-grab — only an explicit force_release_item rejection, or
# actually losing authority for real, should end a grab we initiated.
if _pickable.is_picked_up() and _pickable.get_picked_up_by() is XRToolsFunctionPickup:
return
# Someone else owns it: stop simulating locally, just follow the sync.
if _pickable.is_picked_up():
_pickable.drop()
_pickable.freeze = true
_pickable.freeze_mode = RigidBody3D.FREEZE_MODE_KINEMATIC
_pickable.collision_mask = 0
_pickable.enabled = (net_held_by == 0)
## Local hand grab (not a station snap zone, which is server-only): request
## authority immediately so the throw/drop can be reconciled, but let the grab
## happen instantly here rather than waiting on the round trip.
func _on_picked_up(_p) -> void:
var by := _pickable.get_picked_up_by()
if not (by is XRToolsFunctionPickup):
return
if NetworkManager.is_online():
NetworkManager.log_line("Grabbed %s by hand, requesting authority" % _pickable.name)
NetworkManager.request_item_authority_from(_pickable.get_path())
func _on_dropped(_p) -> void:
# Only forward if we're actually still the authority — a drop caused by
# apply_held_state() losing authority (see above) must not re-report.
if not is_multiplayer_authority():
return
if NetworkManager.is_online():
NetworkManager.log_line("Dropped %s, reporting release to server" % _pickable.name)
NetworkManager.release_item_authority_from(
_pickable.get_path(), _pickable.linear_velocity, _pickable.angular_velocity
)
-1
View File
@@ -1 +0,0 @@
uid://bwd0pe2udb5xo
+188
View File
@@ -0,0 +1,188 @@
extends Node
class_name NetReplication
## Builds MultiplayerSynchronizers for any node by convention, so no scene needs
## a hand-authored replication config.
##
## Every replicated node gets TWO synchronizers, both generated here:
##
## NetSync script state (is_dirty, contained_ids, time_cooked, ...).
## Always owned by the server. Gameplay outcomes are the server's to
## decide, so this never changes hands.
## NetXform position + quaternion. Owned by the server while the object is
## loose, and handed to a peer for as long as that peer holds it.
##
## Splitting them is what makes client-side grab prediction work. A
## MultiplayerSynchronizer never applies inbound state on the peer that owns it,
## so giving the holder NetXform means their own hand drives the object with no
## round trip and no fight with the server's copy — while is_dirty and friends
## keep flowing one way, server to client, exactly as before.
##
## The obvious alternative, per-peer visibility (set_visibility_for), does NOT
## work: MultiplayerSpawner also uses synchronizer visibility to decide whether
## a node should exist on a peer, so hiding an object from its holder despawns
## it in their hand. Verified in test/spike/.
##
## The convention for what gets replicated:
## * a Node3D replicates `position` and `quaternion` (never `scale` — nothing
## in this game animates scale as gameplay state)
## * every script variable, on the node and on any scripted descendant, whose
## name does not start with "_" and whose declared type is serialisable
##
## Underscore-prefixed vars are the opt-out, and they already mark exactly the
## state that must not be replicated: @onready node references, cached lookups,
## per-frame bookkeeping.
## SceneReplicationConfig's replication modes. The enum is not exposed under a
## friendly name in GDScript, so they are spelled out here.
const MODE_ALWAYS := 1
const MODE_ON_CHANGE := 2
const SYNC_NAME := "NetSync"
const XFORM_NAME := "NetXform"
## Types that survive a network round trip. Object/Callable/Signal/RID cannot be
## serialised, and are exactly what @onready and cached references hold.
const SYNCABLE_TYPES := [
TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_STRING_NAME,
TYPE_VECTOR2, TYPE_VECTOR3, TYPE_QUATERNION, TYPE_TRANSFORM3D,
TYPE_COLOR, TYPE_PACKED_STRING_ARRAY, TYPE_ARRAY,
]
## Adds both synchronizers to `node`, unless they are already there. Idempotent.
##
## Must run on EVERY peer, not just the authority: the client's copy is built by
## MultiplayerSpawner straight from the .tscn, so it only has synchronizers if
## something puts them there. NetWorld calls this from the content root's
## child_entered_tree on both sides — early enough that they enter the tree
## inside the spawner's own add_child(), which is what lets them pick up the
## spawn payload (verified in test/spike/: a late joiner receives position and
## script state from a synchronizer that exists only at runtime).
static func attach(node: Node) -> void:
if node is Node3D and not node.has_node(XFORM_NAME):
_add_sync(node, XFORM_NAME, _transform_config())
if not node.has_node(SYNC_NAME):
_add_sync(node, SYNC_NAME, state_config(node))
static func _add_sync(node: Node, sync_name: String, config: SceneReplicationConfig) -> void:
var sync := MultiplayerSynchronizer.new()
sync.name = sync_name
sync.replication_config = config
# Sync every network tick. ON_CHANGE properties are only sent when they
# actually change regardless of this interval.
sync.replication_interval = 0.0
# Inherit the node's authority rather than defaulting to the server. Items are
# server-owned and this changes nothing for them, but a player avatar sets its
# authority to the peer it belongs to in _enter_tree — which has already run by
# the time we get here — and its synchronizer has to agree, or the owning peer
# would be receiving its own head and hands back from the server.
sync.set_multiplayer_authority(node.get_multiplayer_authority())
node.add_child(sync)
## Transform-only config. ALWAYS rather than ON_CHANGE: a carried or simulated
## object changes every tick anyway, so ON_CHANGE would only add a comparison
## per property per tick. spawn = true so a replicated object arrives already in
## the right place instead of sitting at the origin for a frame.
static func _transform_config() -> SceneReplicationConfig:
var config := SceneReplicationConfig.new()
_add(config, ".:position", true, MODE_ALWAYS)
_add(config, ".:quaternion", true, MODE_ALWAYS)
return config
## Script-state config for `node` and its scripted descendants. Public so the
## tests can inspect what the convention picked up without spinning up a session.
##
## ON_CHANGE, not ALWAYS: the value is then only sent — and, crucially, only
## ASSIGNED on the receiving peer — when it actually changes. Under ALWAYS every
## replicated setter becomes a per-tick hot path, which is how this project
## previously ended up rebuilding every plate's visuals 60 times a second.
static func state_config(node: Node) -> SceneReplicationConfig:
var config := SceneReplicationConfig.new()
for path in _script_var_paths(node, node):
_add(config, path, true, MODE_ON_CHANGE)
return config
static func _add(config: SceneReplicationConfig, path: String, spawn: bool, mode: int) -> void:
var np := NodePath(path)
config.add_property(np)
config.property_set_spawn(np, spawn)
config.property_set_replication_mode(np, mode)
## Whether a script comes from a third-party addon rather than this game.
##
## Addon components are local plumbing, and replicating their configuration is
## not merely wasteful — it is actively wrong. godot-xr-tools' snap zones and
## pickables both expose a public `enabled`, which is precisely the flag each
## peer has to set for ITSELF: a client disables its stations' snap zones because
## placement is the server's decision, and disables a pickable another player is
## holding. Replicating those meant the server helpfully sent `enabled = true`
## straight back over every client's gate, so stations on clients went on
## grabbing objects out of the local player's hands.
##
## Their values are authored in the scene file and therefore already identical on
## every peer, so nothing is lost by leaving them alone.
static func _is_addon(script: Script) -> bool:
return script.resource_path.begins_with("res://addons/")
## Whether a typed array holds something that can cross the wire.
##
## An array of nodes cannot, and this game has several: ItemContainer's
## meal_positions/side_positions are Array[Node3D], and contained_items is
## Array[FoodItem]. Replicating one would try to serialise live node references.
##
## GDScript reports the element type three different ways, so all three are
## handled here (verified against the real scripts):
## Array[String] hint 23, hint_string "4:" -> element type 4
## Array[Node3D] hint 23, hint_string "24/34:Node3D" -> element type 24
## Array[FoodItem] hint 31, hint_string "FoodItem" -> a class name
## An untyped Array reports an empty hint_string and is excluded too: it can hold
## anything, including nodes, so there is no safe answer.
static func _is_syncable_array(prop: Dictionary) -> bool:
var hint_string := str(prop["hint_string"])
if hint_string.is_empty():
return false
var head := hint_string.split(":")[0].split("/")[0]
if not head.is_valid_int():
# A bare class name, e.g. "FoodItem".
return false
return SYNCABLE_TYPES.has(head.to_int()) and head.to_int() != TYPE_ARRAY
## Every "<relative path>:<var>" on `node` and its scripted descendants.
## Descends through children but stops at anything carrying its own synchronizer
## — that subtree replicates itself and must not be replicated twice.
static func _script_var_paths(root: Node, node: Node) -> Array[String]:
var paths: Array[String] = []
var prefix: String = "." if node == root else str(root.get_path_to(node))
var script: Script = node.get_script() as Script
# Note the descent below still happens for an addon-scripted node — only its
# own properties are skipped. plate.tscn's root is godot-xr-tools' pickable.gd
# and its PlateController child is where the game state actually lives.
if script and _is_addon(script):
script = null
if script:
for prop in script.get_script_property_list():
var prop_name := str(prop["name"])
if prop_name.begins_with("_"):
continue
if not (prop["usage"] & PROPERTY_USAGE_SCRIPT_VARIABLE):
continue
if not SYNCABLE_TYPES.has(prop["type"]):
continue
if prop["type"] == TYPE_ARRAY and not _is_syncable_array(prop):
continue
paths.append("%s:%s" % [prefix, prop_name])
for child in node.get_children():
if child is MultiplayerSynchronizer or child is MultiplayerSpawner:
continue
if child.has_node(SYNC_NAME) or child.has_node(XFORM_NAME):
continue
paths.append_array(_script_var_paths(root, child))
return paths
+1
View File
@@ -0,0 +1 @@
uid://bmuqb0yywjfyw
+64
View File
@@ -0,0 +1,64 @@
extends Node
class_name NetStations
## Server-side placement rules for stations. Generic over the "station" group —
## there is nothing per-station here, and nothing any individual station scene
## has to opt into.
##
## Placement is a server decision for the same reason cooking is: every peer runs
## its own copy of a snap zone, so letting each decide independently means the
## same object gets grabbed in two places at once.
## Every snap zone belonging to a station. Some stations (Table) have more than
## one, so this is not a one-per-station lookup.
static func zones(context: Node) -> Array:
var found := []
for station in context.get_tree().get_nodes_in_group("station"):
for child in station.get_children():
if child is XRToolsSnapZone:
found.append(child)
return found
## Frees an object from whatever station is currently holding it, because
## someone has just taken it by hand.
static func release_from_zones(context: Node, item: Node) -> void:
for zone in zones(context):
if zone.picked_up_object == item:
zone.drop_object()
# Make the zone forget it as well. These zones are snap_mode=RANGE, so
# every frame they re-grab anything still listed in their grab area — and
# Jolt does NOT emit body_exited when let_go() switches the object's
# collision layer back out of the zone's mask, so the entry never clears
# on its own. The station then snatches the object straight back off the
# player who just took it and teleports it home. Bringing it near again
# re-adds it properly, and releasing next to a station is handled
# explicitly by try_snap below.
if zone._object_in_grab_area.has(item):
zone._object_in_grab_area.erase(item)
## Snaps a just-released object into the nearest empty station zone in range.
##
## Call this DEFERRED. XRToolsFunctionPickup's own "grab an object out of a snap
## zone" path calls zone.drop_object() before it calls pick_up() on the hand's
## behalf, and drop_object() synchronously fires the `dropped` signal that lands
## here. Running inline would immediately re-snap the object into the very zone
## it is still physically inside, stealing it before the hand's own pick_up()
## later in the same call stack ever runs — leaving the hand pointing at an
## object whose grab driver belongs to the zone, which crashes on the next
## controller press. The is_picked_up() check below is the second guard, for the
## case where something grabs it for real before this runs.
static func try_snap(context: Node, item: Node) -> void:
if not (item is Node3D) or not is_instance_valid(item):
return
if item.has_method("is_picked_up") and item.is_picked_up():
return
for zone in zones(context):
if is_instance_valid(zone.picked_up_object):
continue
if zone.global_position.distance_to(item.global_position) <= zone.grab_distance:
NetworkManager.log_line("snapped %s into %s" % [item.name, zone.get_parent().name])
zone.pick_up_object(item)
return
+1
View File
@@ -0,0 +1 @@
uid://cgp15pxa7ui1r
+251
View File
@@ -0,0 +1,251 @@
extends Node
class_name NetWorld
## Owns the replicated contents of the world: what exists, where it lives, and
## which peer is allowed to simulate it.
##
## Everything here runs on Godot's stock MultiplayerSpawner in its DEFAULT mode.
## There is no spawn_function and no payload dictionary: the server instantiates
## a scene, sets it up, and adds it under the spawn path — the spawner replicates
## the creation (and later the deletion) to every peer, including late joiners,
## and the synchronizers NetReplication attaches carry the state.
##
## The two hooks that make this generic, rather than something each object opts
## into:
##
## * content_root.child_entered_tree -> NetReplication.attach, on EVERY peer.
## The client's copy is built by the spawner straight from the .tscn, so this
## is what gives it synchronizers at all. It also runs early enough for them
## to pick up the spawn payload.
## * the same hook, on clients only -> _gate. One rule decides what a client is
## not allowed to simulate, for any object, whatever it happens to be.
## Directories scanned for spawnable scenes. Anything in them can be spawned
## over the network without being registered by hand anywhere.
const SPAWNABLE_DIRS := [
"res://Items/",
"res://Containers/",
"res://Stations/",
"res://Prefabs/",
]
var _spawner: MultiplayerSpawner
var _content_root: Node
## Wires this up to the world scene's spawner and content root. Must run on every
## peer BEFORE it connects, so the spawnable list is identical by the time any
## spawn packet can arrive.
func setup(spawner: MultiplayerSpawner, content_root: Node) -> void:
_spawner = spawner
_content_root = content_root
_register_spawnables()
_content_root.child_entered_tree.connect(_on_content_child_entered)
## Registers every scene under SPAWNABLE_DIRS, sorted.
##
## The sort is not cosmetic. Auto-spawn puts an INDEX into this list on the wire,
## not a path, so a peer whose list is ordered differently instantiates the wrong
## scene entirely. Directory listing order is not guaranteed to match across
## machines, so it is pinned here.
func _register_spawnables() -> void:
var scenes: Array[String] = []
for dir in SPAWNABLE_DIRS:
for file in ResourceLoader.list_directory(dir):
if file.ends_with(".tscn"):
scenes.append(dir + file)
scenes.sort()
for scene in scenes:
_spawner.add_spawnable_scene(scene)
NetworkManager.log_line("Registered %d spawnable scenes" % scenes.size())
func _on_content_child_entered(node: Node) -> void:
# Our own synchronizers re-enter here as children of the node, not of the
# content root, so this only ever sees spawned roots — but the guard is cheap
# and makes the intent explicit.
if node is MultiplayerSynchronizer:
return
NetReplication.attach(node)
# Grab handling is wired up centrally, so no scene has to carry a networking
# component to be pickable over the network.
if node is XRToolsPickable:
NetGrab.watch(node)
if not NetworkManager.owns_world():
_gate(node)
# Deferred, in this order, because both depend on the node being fully
# constructed: XRToolsPickable captures original_collision_mask in an @onready,
# which has not run yet at child_entered_tree time. Reading it now would
# record 0 as the object's authored collision mask and it would never collide
# with anything again.
_remember_authored.call_deferred(node)
apply_physics_role.call_deferred(node)
# --- spawning --------------------------------------------------------------
## Creates a networked object. Server-only when online (the spawner replicates
## it from there); works directly when offline.
##
## `props` are applied BEFORE the node enters the tree, so they ride the spawn
## packet as the synchronizer's spawn properties and every peer builds the object
## already configured. Note that this means their setters run before the node is
## in the tree, where @onready references are still null — any setter reachable
## this way has to be null-guarded.
func spawn(scene_path: String, xform: Transform3D, node_name: String = "", props: Dictionary = {}) -> Node:
if not NetworkManager.owns_world():
return null
var scene: PackedScene = load(scene_path)
if not scene:
push_error("NetWorld.spawn: could not load scene %s" % scene_path)
return null
var inst := scene.instantiate()
if node_name != "":
inst.name = node_name
for key in props:
inst.set(key, props[key])
if inst is Node3D:
inst.transform = xform
_content_root.add_child(inst)
# global_transform can only be honoured once the node has a parent to be
# global relative to. Content roots are normally at the origin, but a debug
# scene is free to move one.
if inst is Node3D:
inst.global_transform = xform
NetworkManager.log_line("spawn: %s as %s" % [scene_path.get_file(), inst.name])
return inst
## Destroys a networked object everywhere. The spawner broadcasts the despawn
## when a tracked node leaves the tree on the authority, so freeing it here is
## the whole implementation — there is no despawn RPC any more.
##
## Callers reach this holding all sorts of nodes (a component such as
## DespawningItem, or a visual deep inside a plate), so it walks up to the object
## the spawner actually knows about. Getting that wrong used to leave a ghost
## copy on every client, which then blocked the station it was sitting in.
func despawn(node: Node) -> void:
if not NetworkManager.owns_world() or not is_instance_valid(node):
return
var root := _spawned_root(node)
if not root:
# Not part of the replicated world at all (a cosmetic copy parented under
# a plate, say). Freeing it locally is all that was ever meant.
node.queue_free()
return
NetworkManager.log_line("despawn: %s" % root.name)
root.queue_free()
# The ancestor that is a direct child of the content root — i.e. the node the
# spawner tracks — or null if this node is not part of the replicated world.
func _spawned_root(node: Node) -> Node:
var current := node
while current:
if current.get_parent() == _content_root:
return current
current = current.get_parent()
return null
## Every replicated object currently in the world.
func objects() -> Array[Node]:
var found: Array[Node] = []
if _content_root:
for child in _content_root.get_children():
found.append(child)
return found
# --- what a client is not allowed to simulate ------------------------------
## The one gating rule, applied to every replicated object on peers that do not
## own world logic.
##
## Stations decide things (what has cooked, what is clean, what snaps where) and
## those decisions are the server's, so a client neither runs their logic nor
## lets their snap zones grab anything. Without this each peer independently
## grabs and simulates the same shared object, and the copies drift apart.
##
## Note what is NOT here: display code. A client still has to show a lit hob and
## a dirty plate, so anything visual must be driven from a replicated value's
## setter rather than from _process — which is where it belongs anyway, since
## that is the only version that also works for a late joiner.
func _gate(node: Node) -> void:
if node.is_in_group("station"):
node.set_process(false)
var zones := _snap_zones_of(node)
for zone in zones:
zone.enabled = false
zone.set_process(false)
NetworkManager.log_line("gated %s (%d snap zones)" % [node.name, zones.size()])
func _snap_zones_of(node: Node) -> Array:
var zones := []
for child in node.get_children():
if child is XRToolsSnapZone:
zones.append(child)
return zones
## Puts a body into the right physics state for whether this peer is currently
## driving it, which is exactly "do we own its NetXform".
##
## The authority IS the state here. The old implementation carried a replicated
## `net_held_by` peer id alongside the authority and reconciled the two by hand,
## which is what made held items get stuck frozen, or disabled forever, when the
## two disagreed. There is only one source of truth now.
##
## Called when an object is created and again whenever its NetXform changes
## hands, which is the complete set of moments the answer can change.
func apply_physics_role(node: Node) -> void:
if not (node is RigidBody3D):
return
var xform := node.get_node_or_null(NetReplication.XFORM_NAME)
if not xform:
return
var body: RigidBody3D = node
if xform.is_multiplayer_authority():
# We simulate it: restore whatever the scene authored. XRToolsPickable
# manages freeze and collision itself while an object is actually in a
# hand, so a held object is left alone.
if body is XRToolsPickable and body.is_picked_up():
return
body.freeze = false
body.freeze_mode = body.get_meta("net_freeze_mode", body.freeze_mode)
if body is XRToolsPickable:
body.collision_mask = body.original_collision_mask
# `enabled` has to be restored explicitly. Nothing else ever writes it
# back: the non-authority branch below clears it, so once any peer had
# held this object every other peer left it disabled forever. On the
# server that quietly broke everything downstream — hands could no
# longer pick the object up, while a snap zone still reported having
# grabbed it.
body.enabled = body.get_meta("net_enabled", body.enabled)
return
# Someone else drives it: stop simulating and just follow the sync. Kinematic
# rather than static so the incoming transform can still move it.
if body is XRToolsPickable and body.is_picked_up():
body.drop()
body.freeze = true
body.freeze_mode = RigidBody3D.FREEZE_MODE_KINEMATIC
body.collision_mask = 0
if body is XRToolsPickable:
# Still grabbable if the SERVER owns it, because that just means the object
# is lying around loose — being able to pick those up is the entire point.
# Only an object held by another player is off limits, and that is exactly
# when NetXform belongs to a peer other than 1.
body.enabled = xform.get_multiplayer_authority() == 1
# Records the state the scene authored, before gating has a chance to overwrite
# it, so reclaiming an object restores what it was built with rather than
# whatever the frozen-follower state last forced on it.
func _remember_authored(node: Node) -> void:
if not (node is RigidBody3D) or node.has_meta("net_freeze_mode"):
return
node.set_meta("net_freeze_mode", node.freeze_mode)
if node is XRToolsPickable:
node.set_meta("net_enabled", node.enabled)
+1
View File
@@ -0,0 +1 @@
uid://bgo0xq4uupuhi
+78 -297
View File
@@ -1,36 +1,34 @@
extends Node
## Client-server session manager for VRyHungry (listen-server model).
## Session manager for VRyHungry (listen-server model: the host is peer 1 and
## also plays).
##
## Registered as the "NetworkManager" autoload. Owns transport (ENet), tracks
## the session, and is the single place that reassigns multiplayer authority
## (only the server does so). The world scene (main.gd) registers its spawners
## here via [method register_world]; higher layers (players, items, stations)
## build on top of this in later phases.
## Registered as the "NetworkManager" autoload. This owns the transport and the
## session lifecycle, and nothing else — what exists in the world and who is
## allowed to simulate it belongs to NetWorld, and interaction belongs to
## NetGrab. The spawn_item/despawn_item pair below are deliberately thin
## forwards, so game code keeps one obvious place to call.
const DEFAULT_PORT := 24565
const MAX_CLIENTS := 7
## Emitted on every peer (including the server for its own local player) when a
## player peer joins. On the server this fires for each remote peer; the server
## uses it to spawn that peer's player.
## uses it to spawn that peer's avatar.
signal player_joined(peer_id: int)
signal player_left(peer_id: int)
signal session_started(is_server: bool)
signal session_ended()
signal connection_failed()
# World hooks, registered by main.gd once the scene tree exists.
var _world: Node = null
var _players_spawner: MultiplayerSpawner = null
var _items_spawner: MultiplayerSpawner = null
var _content_root: Node = null
var _net_world: NetWorld = null
var _log_file: FileAccess
## Reason the session ended, shown by the menu on the next _ready() (see
## Reason the session ended, shown by the menu on its next _ready() (see
## take_status). Avoids depending on a live signal connection to a panel that
## doesn't exist yet at the moment the session actually ends.
## does not exist yet at the moment the session actually ends.
var last_status := ""
@@ -43,9 +41,9 @@ func _ready() -> void:
multiplayer.server_disconnected.connect(_on_server_disconnected)
# --- Public API ------------------------------------------------------------
# --- session ---------------------------------------------------------------
## Start hosting. The host is peer 1 and also plays (listen server).
## Start hosting. The host is peer 1 and also plays.
func host(port: int = DEFAULT_PORT) -> Error:
var peer := ENetMultiplayerPeer.new()
var err := peer.create_server(port, MAX_CLIENTS)
@@ -55,8 +53,7 @@ func host(port: int = DEFAULT_PORT) -> Error:
multiplayer.multiplayer_peer = peer
log_line("HOST started on port %d (peer id %d)" % [port, multiplayer.get_unique_id()])
session_started.emit(true)
# The host's own local player joins immediately.
_on_player_present(multiplayer.get_unique_id())
player_joined.emit(multiplayer.get_unique_id())
return OK
@@ -79,9 +76,9 @@ func leave() -> void:
session_ended.emit()
# Restore Godot's default OfflineMultiplayerPeer (rather than leaving the peer
# null), so is_multiplayer_authority()/get_unique_id() keep working while we are
# back in single-player / menu state.
# Restore Godot's default OfflineMultiplayerPeer rather than leaving the peer
# null: is_multiplayer_authority() and get_unique_id() both throw on a null peer,
# and plenty of code keeps calling them while we are back in menu state.
func _go_offline() -> void:
if multiplayer.multiplayer_peer:
multiplayer.multiplayer_peer.close()
@@ -89,221 +86,6 @@ func _go_offline() -> void:
unregister_world()
# --- Item spawning ---------------------------------------------------------
## Spawn a networked item. Server-only when online (replicates to all peers via
## the ItemsSpawner, including late joiners); works directly when offline.
## node_name gives the spawned node a deterministic, identical name on every
## peer (needed for NodePath-based RPCs to resolve it); props are applied to
## the instance before it enters the tree, so exported vars land correctly.
## Returns the new node on the machine that owns spawning, else null.
func spawn_item(scene_path: String, xform: Transform3D, node_name: String = "", props: Dictionary = {}) -> Node:
if is_online() and not is_server():
return null
var data := {"scene": scene_path, "xform": xform, "name": node_name, "props": props}
var via := "spawner" if (is_online() and _items_spawner) else "offline"
log_line("spawn_item: %s (name=%s, via=%s)" % [scene_path.get_file(), node_name, via])
if is_online() and _items_spawner:
return _items_spawner.spawn(data)
# Offline: instantiate directly under the registered content root, or (for
# scenes that never call register_world, e.g. the offline menu/dev scenes)
# the current scene, so this keeps working without every offline scene
# needing to opt in.
var inst := _spawn_item_from_data(data)
if inst:
var parent: Node = _content_root if _content_root else get_tree().current_scene
if parent:
parent.add_child(inst)
return inst
## Despawn a server-spawned item. MultiplayerSpawner broadcasts a despawn to
## every peer when a tracked node exits the tree on the authority, so this is
## the single seam for destroying spawned items (works offline too).
func despawn_item(node: Node) -> void:
if owns_world() and is_instance_valid(node):
log_line("despawn_item: %s" % node.name)
node.queue_free()
# MultiplayerSpawner custom spawn function: runs on every peer to build the node
# from the replicated payload.
func _spawn_item_from_data(data: Variant) -> Node:
var scene: PackedScene = load(data["scene"])
if not scene:
push_error("spawn_item: could not load scene %s" % str(data.get("scene")))
return null
var inst := scene.instantiate()
if inst is Node3D:
inst.transform = data["xform"]
if data.get("name", "") != "":
inst.name = data["name"]
for key in data.get("props", {}):
inst.set(key, data["props"][key])
if not owns_world():
_gate_station(inst)
return inst
# Stations run their own logic and auto-grab (XRToolsSnapZone with
# snap_mode=RANGE) identically on every peer by default, which would let each
# peer independently grab/simulate the same shared object. Disable both on
# every peer except the one that owns world logic; the server-authoritative
# item-authority RPCs are what let clients still grab a server-held item by
# hand. Runs before the node enters the tree, so its own _ready() sees the
# final (disabled) state.
func _gate_station(node: Node) -> void:
if not (node is StaticBody3D):
return
for child in node.get_children():
if child is XRToolsSnapZone:
child.enabled = false
child.set_process(false)
node.set_process(false)
log_line("gated station (non-owner peer): %s" % node.name)
# --- Item grab-authority transfer -----------------------------------------
## Called by NetPickable when this peer grabs an item by hand. Godot rejects
## rpc_id() targeting your own peer id ("RPC on yourself is not allowed"), so
## when we ARE the server this runs the logic directly instead of round-
## tripping an RPC to ourselves — otherwise every host-side grab/drop was
## silently failing to run its server-side half (no denial checks, and
## crucially no auto-snap-into-station on release).
func request_item_authority_from(item_path: NodePath) -> void:
if is_server():
_grant_or_reject_item_authority(item_path, multiplayer.get_unique_id())
else:
_request_item_authority_rpc.rpc_id(1, item_path)
@rpc("any_peer", "reliable")
func _request_item_authority_rpc(item_path: NodePath) -> void:
if not is_server():
return
_grant_or_reject_item_authority(item_path, multiplayer.get_remote_sender_id())
## Runs on the server (called directly if the requester IS the server, or via
## the RPC above otherwise). If the item was snapped into a station, the
## station releases it so the grabber cleanly takes ownership.
func _grant_or_reject_item_authority(item_path: NodePath, sender: int) -> void:
var item := get_node_or_null(item_path)
if item:
var np := item.get_node_or_null("NetPickable")
if np and np.net_held_by != 0 and np.net_held_by != sender:
# Already legitimately held by a different live peer: reject the
# requester's optimistic client-side grab instead of stealing it.
log_line("request_item_authority: DENIED %s to peer %d (already held by %d)" % [item.name, sender, np.net_held_by])
_force_release_item_to(sender, item_path)
return
log_line("request_item_authority: granting %s to peer %d" % [str(item.name) if item else str(item_path), sender])
# Assign authority + held state first (disables the item on the server so its
# snap zone won't re-grab it), then release it from any station.
_set_item_authority.rpc(item_path, sender)
if item:
_release_from_snap_zones(item)
## Called by NetPickable when this peer releases an item, forwarding its throw
## velocity so the server can resume simulating it. Same self-RPC issue as
## above: runs directly if we're the server.
func release_item_authority_from(item_path: NodePath, lin: Vector3, ang: Vector3) -> void:
if is_server():
_do_release_item_authority(item_path, lin, ang, multiplayer.get_unique_id())
else:
_release_item_authority_rpc.rpc_id(1, item_path, lin, ang)
@rpc("any_peer", "reliable")
func _release_item_authority_rpc(item_path: NodePath, lin: Vector3, ang: Vector3) -> void:
if not is_server():
return
_do_release_item_authority(item_path, lin, ang, multiplayer.get_remote_sender_id())
## Runs on the server. If released next to a station, the server snaps it in
## (server-authoritative placement).
func _do_release_item_authority(item_path: NodePath, lin: Vector3, ang: Vector3, sender: int) -> void:
log_line("release_item_authority: %s released by peer %d" % [str(item_path), sender])
_set_item_authority.rpc(item_path, 1)
var item := get_node_or_null(item_path)
if item is RigidBody3D:
item.freeze = false
item.linear_velocity = lin
item.angular_velocity = ang
_try_snap_into_station(item)
# All station snap zones in the world (every XRToolsSnapZone child of a node in
# the "station" group — some stations, e.g. Table, have more than one).
func _station_snap_zones() -> Array:
var zones := []
for station in get_tree().get_nodes_in_group("station"):
for child in station.get_children():
if child is XRToolsSnapZone:
zones.append(child)
return zones
# If the item is snapped into any station, drop it from that station.
func _release_from_snap_zones(item: Node) -> void:
for zone in _station_snap_zones():
if zone.picked_up_object == item:
zone.drop_object()
# Snap the item into the nearest empty station snap zone within grab range.
func _try_snap_into_station(item: Node) -> void:
if not (item is Node3D):
return
for zone in _station_snap_zones():
if is_instance_valid(zone.picked_up_object):
continue
if zone.global_position.distance_to(item.global_position) <= zone.grab_distance:
log_line("snapped %s into %s" % [item.name, zone.get_parent().name])
zone.pick_up_object(item)
return
# Server broadcasts an authority assignment so every peer agrees on who owns the
# item (set_multiplayer_authority is a local call and must run everywhere).
@rpc("authority", "call_local", "reliable")
func _set_item_authority(item_path: NodePath, peer: int) -> void:
var item := get_node_or_null(item_path)
if not item:
return
log_line("_set_item_authority: %s -> peer %d" % [item.name, peer])
item.set_multiplayer_authority(peer) # recursive: item + synchronizer + NetPickable
var np := item.get_node_or_null("NetPickable")
if np:
np.net_held_by = 0 if peer == 1 else peer
np.apply_held_state()
## Rejects peer's optimistic grab (the item was already legitimately held by
## someone else). Same self-RPC concern: if the rejected peer is the server
## itself, apply it directly rather than rpc_id-ing ourselves.
func _force_release_item_to(peer: int, item_path: NodePath) -> void:
if peer == 1:
_do_force_release(item_path)
else:
force_release_item.rpc_id(peer, item_path)
@rpc("authority", "reliable")
func force_release_item(item_path: NodePath) -> void:
_do_force_release(item_path)
func _do_force_release(item_path: NodePath) -> void:
log_line("force_release_item: dropping %s (server rejected our grab)" % str(item_path))
var item := get_node_or_null(item_path)
if item and item.has_method("drop"):
item.drop()
func is_server() -> bool:
return is_online() and multiplayer.is_server()
@@ -316,71 +98,69 @@ func is_online() -> bool:
## True on the machine that owns authoritative world logic: the server when
## online, or the single player when offline. Station logic and spawning should
## only run where this is true, so state has one source of truth.
## online, or the single player when offline. Station logic and spawning only run
## where this is true, so state has one source of truth.
func owns_world() -> bool:
return not is_online() or is_server()
# --- Station work-progress seam -------------------------------------------
# --- world -----------------------------------------------------------------
## Reusable entry point for a client to contribute work to a station (e.g. a
## future chopping/gesture station). The client detects the gesture locally and
## calls this; the server validates and accumulates. Timer-driven stations like
## the Hob don't need it, but it is the drop-in seam for input-driven ones.
@rpc("any_peer", "reliable")
func submit_work(station_path: NodePath, amount: float) -> void:
if not is_server():
return
var station := get_node_or_null(station_path)
if station and station.has_method("add_work"):
log_line("submit_work: peer %d contributed %.2f to %s" % [multiplayer.get_remote_sender_id(), amount, station.name])
station.add_work(multiplayer.get_remote_sender_id(), amount)
## Called by the world scene once it's ready, passing its spawners. Must run
## before world_ready()/host()/join() on every peer so the custom spawn
## function is installed before any spawn packet can arrive.
func register_world(world: Node, players_spawner: MultiplayerSpawner, items_spawner: MultiplayerSpawner) -> void:
## Called by the world scene once its tree exists. Must run before
## world_ready()/host()/join() on every peer, so the spawnable scene list is
## registered before any spawn packet can arrive.
func register_world(world: Node, net_world: NetWorld) -> void:
_world = world
_players_spawner = players_spawner
_items_spawner = items_spawner
_content_root = items_spawner.get_node(items_spawner.spawn_path) if items_spawner else world
if _items_spawner:
_items_spawner.spawn_function = _spawn_item_from_data
log_line("World registered (players_spawner=%s items_spawner=%s)" % [str(players_spawner != null), str(items_spawner != null)])
_net_world = net_world
log_line("World registered")
## Called when the world scene goes away (disconnect, leaving the session) so
## the autoload doesn't hold stale/freed references across a scene reload.
## Called when the world scene goes away (disconnect, leaving the session) so the
## autoload does not hold freed references across a scene reload.
func unregister_world() -> void:
_world = null
_content_root = null
_players_spawner = null
_items_spawner = null
_net_world = null
## Returns the reason the last session ended (if any) and clears it. The menu
## pulls this on its own _ready() rather than depending on a live signal
## connection to a panel that doesn't exist yet when the session ends.
func take_status() -> String:
var s := last_status
last_status = ""
return s
## Creates a networked object. See NetWorld.spawn.
func spawn_item(scene_path: String, xform: Transform3D, node_name: String = "", props: Dictionary = {}) -> Node:
if not _net_world:
push_error("spawn_item called with no world registered: %s" % scene_path)
return null
return _net_world.spawn(scene_path, xform, node_name, props)
## Called by main.gd after it has registered the world and connected its
## player_joined/left listeners. Kicks off any menu- or command-line-driven
## session so that session signals never fire before the world is listening.
## Destroys a networked object everywhere. See NetWorld.despawn.
func despawn_item(node: Node) -> void:
if _net_world:
_net_world.despawn(node)
## Puts an object into the right physics state for whether this peer drives it.
func apply_physics_role(node: Node) -> void:
if _net_world:
_net_world.apply_physics_role(node)
## Every replicated object currently in the world.
func replicated_objects() -> Array[Node]:
if not _net_world:
return []
return _net_world.objects()
## Called by the world scene after it has registered itself and connected its
## listeners. Kicks off any menu- or command-line-driven session, so session
## signals never fire before the world is listening for them.
func world_ready() -> void:
consume_pending_session()
# --- Menu-driven session request -------------------------------------------
# --- menu-driven session request -------------------------------------------
# Set by the main menu's Host/Join buttons before switching to the multiplayer
# scene; consumed once that scene's world is ready to listen for session
# signals (avoids a race between change_scene_to_file and connection callbacks).
# scene; consumed once that scene is ready to listen for session signals (avoids
# a race between change_scene_to_file and the connection callbacks).
var pending_action := ""
var pending_ip := ""
@@ -402,18 +182,29 @@ func consume_pending_session() -> void:
_handle_cmdline()
# --- Session signal handlers ----------------------------------------------
## Returns the reason the last session ended (if any) and clears it. The menu
## pulls this on its own _ready() rather than depending on a live signal
## connection to a panel that does not exist yet when the session ends.
func take_status() -> String:
var s := last_status
last_status = ""
return s
# --- session signal handlers ----------------------------------------------
func _on_peer_connected(peer_id: int) -> void:
log_line("peer_connected: %d" % peer_id)
# Only the server reacts by materialising that peer's player.
if is_server():
_on_player_present(peer_id)
player_joined.emit(peer_id)
func _on_peer_disconnected(peer_id: int) -> void:
log_line("peer_disconnected: %d" % peer_id)
if is_server():
_on_player_absent(peer_id)
# Anything still in their hand would otherwise stay frozen on every
# remaining peer, waiting on an authority that has gone.
NetGrab.reclaim_from(peer_id)
player_left.emit(peer_id)
func _on_connected_to_server() -> void:
log_line("connected_to_server (my id=%d)" % multiplayer.get_unique_id())
@@ -432,18 +223,7 @@ func _on_server_disconnected() -> void:
session_ended.emit()
# Player materialise/dematerialise. Phase 2 wires these to the PlayersSpawner;
# for now they announce presence so the transport layer is independently testable.
func _on_player_present(peer_id: int) -> void:
log_line("player_present: %d" % peer_id)
player_joined.emit(peer_id)
func _on_player_absent(peer_id: int) -> void:
log_line("player_absent: %d" % peer_id)
player_left.emit(peer_id)
# --- Command-line driven test bootstrap -----------------------------------
# --- command-line driven test bootstrap -----------------------------------
func _handle_cmdline() -> void:
var args := OS.get_cmdline_user_args()
@@ -459,7 +239,7 @@ func _handle_cmdline() -> void:
join(addr)
# --- Logging ---------------------------------------------------------------
# --- logging ---------------------------------------------------------------
func _open_log() -> void:
var dir := OS.get_environment("TEMP")
@@ -471,6 +251,7 @@ func _open_log() -> void:
_log_file = FileAccess.open(path, FileAccess.WRITE)
log_line("=== NetworkManager log (pid %d) ===" % OS.get_process_id())
func log_line(s: String) -> void:
var id := 0
var p := multiplayer.multiplayer_peer
+71 -73
View File
@@ -1,81 +1,79 @@
extends Node
class_name WorldLayout
## Data-driven description of what's in the multiplayer world. The server (or
## the single machine, when offline) spawns every entry through
## NetworkManager.spawn_item() instead of baking these into the scene file, so
## a joining client receives them from the server rather than assuming its own
## copy of the scene matches. Swapping the contents of these two functions is
## the only change needed for a future varying/procedural layout.
## Reads the kitchen a scene file authored and describes it as data, so the
## server can respawn it as replicated objects.
##
## Positions below are transcribed verbatim from the previous baked layout in
## Scenes/multiPlayer.tscn so the starting world is unchanged.
## The authored nodes are a template, not the live world. Baking them into the
## scene would mean each peer ran its own unsynced copy; spawning them means the
## client receives the server's, through the same path as a mid-session join.
static func get_stations() -> Array[Dictionary]:
return [
{"scene": "res://Stations/Hob.tscn", "name": "Hob",
"xform": Transform3D(Basis(), Vector3(0.29336345, 0.8981018, -1.484)), "props": {}},
{"scene": "res://Stations/BurgerBunsDispenser.tscn", "name": "BurgerBunsDispenser",
"xform": Transform3D(Basis(), Vector3(-1.832131, 0.40028095, -1.4813508)), "props": {}},
{"scene": "res://Stations/sink.tscn", "name": "Sink",
"xform": Transform3D(Basis(), Vector3(1.3140475, 0.9061539, -1.4941733)), "props": {}},
{"scene": "res://Stations/dirt_station.tscn", "name": "DirtStation",
"xform": Transform3D(Basis(), Vector3(2.0864775, 0.8981018, -1.244947)), "props": {}},
{"scene": "res://Stations/Counter.tscn", "name": "Counter",
"xform": Transform3D(Basis(), Vector3(-0.7124918, 0.90304357, -1.4886917)), "props": {}},
{"scene": "res://Stations/Counter.tscn", "name": "Counter2",
"xform": Transform3D(Vector3(-4.371139e-08, 0.0, 1.0), Vector3(0.0, 1.0, 0.0), Vector3(-1.0, 0.0, -4.371139e-08), Vector3(-1.7648025, 0.90304357, -0.4458799)), "props": {}},
{"scene": "res://Stations/Counter.tscn", "name": "Counter3",
"xform": Transform3D(Vector3(-4.371139e-08, 0.0, 1.0), Vector3(0.0, 1.0, 0.0), Vector3(-1.0, 0.0, -4.371139e-08), Vector3(-1.7648025, 0.90304357, 0.55367994)), "props": {}},
{"scene": "res://Stations/Counter.tscn", "name": "Counter4",
"xform": Transform3D(Vector3(-4.371139e-08, 0.0, 1.0), Vector3(0.0, 1.0, 0.0), Vector3(-1.0, 0.0, -4.371139e-08), Vector3(-1.7648025, 0.90304357, 1.5539298)), "props": {}},
{"scene": "res://Stations/table.tscn", "name": "Table",
"xform": Transform3D(Basis(), Vector3(1.633146, 0.9030438, 1.1343781)),
"props": {
"initial_thinking_time": 8.0,
"initial_primary_time": 40.0,
"initial_friend_time": 3.0,
"initial_eating_time": 3.0,
}},
]
## Directories whose scenes count as world content, and the base type to look for
## in each. Anything instanced from these is picked up automatically — adding a
## new station or item needs no change here.
const SOURCES := [
{"dir": "res://Stations/", "type": "StaticBody3D"},
{"dir": "res://Items/", "type": "XRToolsPickable"},
{"dir": "res://Containers/", "type": "XRToolsPickable"},
]
static func get_items() -> Array[Dictionary]:
var items: Array[Dictionary] = []
items.append(_item("res://Items/BurgerBuns.tscn", "BurgerBuns", Vector3(-1.8162017, 1.6081157, -1.4714175)))
items.append(_item("res://Items/BurgerBuns.tscn", "BurgerBuns2", Vector3(-1.3596323, 1.4110342, -0.22482127)))
items.append(_item("res://Containers/plate.tscn", "Plate", Vector3(-1.5717233, 1.5454081, 1.5373346)))
items.append(_item("res://Containers/plate.tscn", "Plate2", Vector3(-1.5730225, 1.499024, 0.59790254)))
items.append(_item("res://Containers/plate.tscn", "Plate3", Vector3(-1.5818124, 1.499024, -0.4634577)))
items.append(_item("res://Items/burger.tscn", "burger", Vector3(0.6888188, 1.4195822, -1.7110313)))
items.append(_item("res://Items/burger.tscn", "burger2", Vector3(0.6931299, 1.5300478, -1.71225)))
items.append(_item("res://Items/burger.tscn", "burger3", Vector3(0.69027674, 1.4969791, -1.7210286)))
items.append(_item("res://Items/burger.tscn", "burger4", Vector3(0.69134104, 1.4543622, -1.7210286)))
items.append(_item("res://Items/hamburger.tscn", "Hamburger", Vector3(-1.9352558, 1.623975, 1.2447833)))
items.append(_item("res://Items/hamburger.tscn", "Hamburger2", Vector3(-1.9857153, 1.5329368, 0.9472374)))
items.append(_item("res://Items/hamburger.tscn", "Hamburger3", Vector3(-1.7201865, 1.5329367, 0.14773655)))
items.append(_item("res://Items/cooked_burger.tscn", "CookedBurger", Vector3(-0.30671906, 1.4131018, -1.0928738)))
items.append(_item("res://Items/cooked_burger.tscn", "CookedBurger2", Vector3(-0.30671906, 1.4496142, -1.0928738)))
items.append(_item("res://Items/cooked_burger.tscn", "CookedBurger3", Vector3(-1.3344773, 1.4398065, -0.7096845)))
items.append(_item("res://Items/cooked_burger.tscn", "CookedBurger4", Vector3(-0.30671906, 1.525444, -1.0928738)))
items.append(_item("res://Items/PickupCube.tscn", "PickableObject", Vector3(0.6225724, 1.4792972, -1.0473135)))
items.append(_item("res://Items/PickupCube.tscn", "PickableObject2", Vector3(0.6359743, 1.4639391, -1.1673055)))
items.append(_item("res://Items/PickupCube.tscn", "PickableObject3", Vector3(0.5142721, 1.4792972, -1.0473135)))
items.append(_item("res://Items/PickupCube.tscn", "PickableObject4", Vector3(0.5276739, 1.4639391, -1.1673055)))
items.append(_item("res://Items/PickupCube.tscn", "PickableObject5", Vector3(0.73287535, 1.4792972, -1.0473135)))
items.append(_item("res://Items/PickupCube.tscn", "PickableObject6", Vector3(0.7462772, 1.4639391, -1.1673055)))
items.append(_item("res://Items/PickupCube.tscn", "PickableObject7", Vector3(-1.3556751, 1.4792972, 0.28881657)))
items.append(_item("res://Items/PickupCube.tscn", "PickableObject8", Vector3(-1.3422732, 1.4639391, 0.16882455)))
items.append(_item("res://Items/PickupCube.tscn", "PickableObject9", Vector3(-1.4639754, 1.4792972, 0.28881657)))
items.append(_item("res://Items/PickupCube.tscn", "PickableObject10", Vector3(-1.4505737, 1.4639391, 0.16882455)))
return items
## Every authored node in the current scene, stations first.
##
## Order matters: stations have to exist before items, so an item spawning on top
## of one lands in a snap zone that is already there.
func get_authored_nodes() -> Array[Node]:
var found: Array[Node] = []
for source in SOURCES:
for node in _instances_of(source["dir"], source["type"]):
if not found.has(node):
found.append(node)
return found
static func _item(scene: String, name: String, pos: Vector3) -> Dictionary:
return {"scene": scene, "name": name, "xform": Transform3D(Basis(), pos), "props": {}}
func _instances_of(dir: String, type: String) -> Array[Node]:
var scenes := []
for file in ResourceLoader.list_directory(dir):
scenes.append(dir + file)
var found: Array[Node] = []
for node in get_tree().root.find_children("*", type, true, false):
if node.scene_file_path in scenes:
found.append(node)
return found
## Turns authored nodes into spawn descriptions.
func describe(nodes: Array[Node]) -> Array[Dictionary]:
var data: Array[Dictionary] = []
for node in nodes:
data.append(_describe_one(node))
return data
func _describe_one(node: Node) -> Dictionary:
return {
"scene": node.scene_file_path,
"name": node.name,
# Global, not local: the copies are respawned under one content root, so
# an authored node nested inside another (JonScene parents Counter5 under
# Counter3) would otherwise land in the wrong place.
"xform": node.global_transform,
"props": _authored_props(node),
}
# Only authored configuration — @export vars, the ones the editor exposes. Plain
# script variables are live runtime state, and replaying those into a fresh
# instance re-runs their setters before the node is in the tree, where any setter
# touching an @onready reference blows up.
func _authored_props(node: Node) -> Dictionary:
var props := {}
var script: Script = node.get_script() as Script
if not script:
return props
for prop in script.get_script_property_list():
var prop_name := str(prop["name"])
if not (prop["usage"] & PROPERTY_USAGE_EDITOR) or prop_name.begins_with("_"):
continue
props[prop_name] = node.get(prop_name)
return props
+78 -43
View File
@@ -1,71 +1,106 @@
extends Node3D
## Networked representation of one connected player. The owning peer's local
## XR rig (found via the "local_xr_origin" group) drives Head/LeftHand/
## RightHand each frame; the MultiplayerSynchronizer replicates those
## transforms so every other peer sees a matching avatar.
## Networked representation of one connected player.
##
## The owning peer's local XR rig drives the three transforms below every frame;
## the generated NetSync replicates them, and every other peer applies them to
## the avatar's head and hands. They are ordinary script variables rather than an
## authored replication config, so the avatar goes through exactly the same
## convention as every other replicated object.
@onready var _head: Node3D = $Head
@onready var _left_hand: Node3D = $LeftHand
@onready var _right_hand: Node3D = $RightHand
## Replicated pose. Underscore-free by design — that is what marks a variable as
## replicated (see NetReplication). Written by the owning peer, applied by
## everyone else through the setters.
var head_xform: Transform3D = Transform3D.IDENTITY: set = _set_head_xform
var left_xform: Transform3D = Transform3D.IDENTITY: set = _set_left_xform
var right_xform: Transform3D = Transform3D.IDENTITY: set = _set_right_xform
var _local_camera: Node3D
var _local_left_hand: Node3D
var _local_right_hand: Node3D
func _enter_tree() -> void:
# MultiplayerSynchronizer resolves authority when this node enters the
# tree, so authority must be set here rather than in _ready(), or the
# first synced frames go the wrong direction.
# The avatar's name is the peer id it belongs to. Authority has to be claimed
# here rather than in _ready(): NetReplication reads it when it attaches the
# synchronizers, which happens as this node enters the tree.
set_multiplayer_authority(str(name).to_int())
func _ready() -> void:
# LeftHand/RightHand are the full godot-xr-tools glove scenes, whose root
# node carries hand.gd (XRToolsHand). That script sets top_level = true
# and every physics frame does global_transform = get_parent().
# global_transform * offset — i.e. it actively repositions itself to
# track a live XRController3D parent. Here the parent is just this
# NetPlayer node, not a controller, so left running it fights (and mostly
# wins, since it runs every physics tick regardless of our own _process)
# against both the local authority's transform copy below and the
# replicated values on other peers — the exact "hands stuck near origin,
# only occasionally correct" symptom. Disable it everywhere; nothing else
# in that script matters here since _controller is always null without a
# real controller ancestor (grip/trigger animation already no-ops).
# carries hand.gd. That script sets top_level = true and every physics frame
# repositions itself to track a live XRController3D parent. Here the parent is
# just this avatar, not a controller, so leaving it running fights both the
# local copy below and the replicated values on other peers — and mostly wins,
# since it runs every physics tick regardless of our _process. That was the
# "hands stuck near the origin, only occasionally correct" symptom. Nothing
# else in that script matters here; _controller is always null without a real
# controller ancestor, so the grip animation already no-ops.
_left_hand.set_physics_process(false)
_right_hand.set_physics_process(false)
if is_multiplayer_authority():
var origin := get_tree().get_first_node_in_group("local_xr_origin")
if origin:
_local_camera = origin.get_node_or_null("XRCamera3D")
_local_left_hand = origin.get_node_or_null("XRControllerLeftHand")
_local_right_hand = origin.get_node_or_null("XRControllerRightHand")
# Every peer's rig is baked at the same spot in the scene; spread
# joiners out along X so they don't start stacked on top of each
# other. Peer ids from ENet are large effectively-random 32-bit
# numbers, so this must be bounded, AND kept well within the
# floor's actual footprint (15x15, so ~7.5 units from center) —
# a previous version used up to 12 units and could place a
# joining player off the edge of the floor.
var peer_id := str(name).to_int()
if peer_id != 1:
var slot := absi(peer_id) % 4
origin.position += Vector3((slot - 1.5) * 1.2, 0, 0)
# Don't render your own floating head/hands from the inside.
_head.visible = false
_left_hand.visible = false
_right_hand.visible = false
else:
if not is_multiplayer_authority():
set_process(false)
# State that arrived in the spawn packet was applied before these @onready
# references existed, so render it now.
_apply_pose()
return
var origin := get_tree().get_first_node_in_group("local_xr_origin")
if origin:
_local_camera = origin.get_node_or_null("XRCamera3D")
_local_left_hand = origin.get_node_or_null("XRControllerLeftHand")
_local_right_hand = origin.get_node_or_null("XRControllerRightHand")
# Every peer's rig is baked at the same spot, so spread joiners along X
# rather than starting them stacked on top of each other. ENet peer ids
# are large effectively-random 32-bit numbers, so this has to be bounded
# AND kept well inside the floor's footprint — an earlier version used up
# to 12 units and could drop a joining player off the edge.
var peer_id := str(name).to_int()
if peer_id != 1:
var slot := absi(peer_id) % 4
origin.position += Vector3((slot - 1.5) * 1.2, 0, 0)
# Don't render your own floating head and hands from the inside.
_head.visible = false
_left_hand.visible = false
_right_hand.visible = false
func _process(_delta: float) -> void:
if _local_camera:
_head.global_transform = _local_camera.global_transform
head_xform = _local_camera.global_transform
if _local_left_hand:
_left_hand.global_transform = _local_left_hand.global_transform
left_xform = _local_left_hand.global_transform
if _local_right_hand:
_right_hand.global_transform = _local_right_hand.global_transform
right_xform = _local_right_hand.global_transform
# The setters are null-guarded because a spawn-replicated property fires its
# setter BEFORE the node is in the tree, when @onready references are still null.
func _set_head_xform(value: Transform3D) -> void:
head_xform = value
if _head:
_head.global_transform = value
func _set_left_xform(value: Transform3D) -> void:
left_xform = value
if _left_hand:
_left_hand.global_transform = value
func _set_right_xform(value: Transform3D) -> void:
right_xform = value
if _right_hand:
_right_hand.global_transform = value
func _apply_pose() -> void:
_head.global_transform = head_xform
_left_hand.global_transform = left_xform
_right_hand.global_transform = right_xform
+1 -26
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=5 format=3]
[gd_scene load_steps=4 format=3]
[ext_resource type="Script" path="res://Player/net_player.gd" id="1_np001"]
[ext_resource type="PackedScene" uid="uid://bq86r4yll8po" path="res://addons/godot-xr-tools/hands/scenes/lowpoly/left_fullglove_low.tscn" id="2_np002"]
@@ -8,26 +8,6 @@
radius = 0.09
height = 0.22
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_np005"]
properties/0/path = NodePath("Head:position")
properties/0/spawn = false
properties/0/replication_mode = 1
properties/1/path = NodePath("Head:quaternion")
properties/1/spawn = false
properties/1/replication_mode = 1
properties/2/path = NodePath("LeftHand:position")
properties/2/spawn = false
properties/2/replication_mode = 1
properties/3/path = NodePath("LeftHand:quaternion")
properties/3/spawn = false
properties/3/replication_mode = 1
properties/4/path = NodePath("RightHand:position")
properties/4/spawn = false
properties/4/replication_mode = 1
properties/5/path = NodePath("RightHand:quaternion")
properties/5/spawn = false
properties/5/replication_mode = 1
[node name="NetPlayer" type="Node3D"]
script = ExtResource("1_np001")
@@ -37,8 +17,3 @@ mesh = SubResource("CapsuleMesh_np004")
[node name="LeftHand" parent="." instance=ExtResource("2_np002")]
[node name="RightHand" parent="." instance=ExtResource("3_np003")]
[node name="Sync" type="MultiplayerSynchronizer" parent="."]
root_path = NodePath("..")
replication_config = SubResource("SceneReplicationConfig_np005")
replication_interval = 0.033
-3
View File
@@ -72,13 +72,10 @@ func _on_body_entered(body: Node3D) -> void:
# Instantiate the result of combination and free the two ingredient items
func _combine(other_body: Node3D, result: PackedScene) -> void:
print("CombinableItem _combine: combining %s + %s into %s" % [_food_item.id, _find_food_item(other_body).id, result.resource_path])
_combining = true
# Get Snapzone
var snap_zone := _pickable.get_picked_up_by()
if not snap_zone or not snap_zone.has_method("pick_up_object"):
push_warning("CombineZone: base item is not held by a snap zone; cannot combine.")
_combining = false
return
# Spawn the result through the server (so it replicates to every peer,
+3 -3
View File
@@ -2,8 +2,8 @@
[ext_resource type="Script" uid="uid://dounic663dn5q" path="res://Prefabs/combinable_item.gd" id="1_q21ti"]
[sub_resource type="BoxShape3D" id="BoxShape3D_combine"]
size = Vector3(0.16, 0.16, 0.16)
[sub_resource type="SphereShape3D" id="SphereShape3D_o1b3t"]
radius = 0.2
[node name="CombinableItem" type="Node3D" unique_id=996936271]
script = ExtResource("1_q21ti")
@@ -11,4 +11,4 @@ script = ExtResource("1_q21ti")
[node name="Area3d" type="Area3D" parent="." unique_id=1514178016]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3d" unique_id=706892516]
shape = SubResource("BoxShape3D_combine")
shape = SubResource("SphereShape3D_o1b3t")
+63
View File
@@ -0,0 +1,63 @@
extends Node
class_name DespawningItem
@export var time_to_despawn: float = 8
# The minimum speed required to reset despawn timer.
@export var minimum_speed_square: float = 0.1
@onready var _pickable: XRToolsPickable = get_parent() as XRToolsPickable
@onready var _rigid: RigidBody3D = get_parent() as RigidBody3D
var _time_left: float = time_to_despawn
func _ready() -> void:
if not _pickable:
push_error("DespawningItem must be a grand child of an XRToolsPickable.")
return
if not _rigid:
push_error("DespawningItem must be a grand child of an RigidBody3D.")
return
func _process(delta: float) -> void:
# Despawning is a world decision, so only the owner of world logic runs the
# clock. Every peer used to run its own copy: the countdown drifted between
# them and the blink below toggled `visible` locally, so the same item was
# shown on one peer and hidden on the other. Non-owners just follow the
# server, which removes the item for everyone when its time is up.
if not NetworkManager.owns_world():
return
# if we're held or moving, reset timer and return
if _pickable.get_picked_up_by() or _rigid.linear_velocity.length_squared() > pow(minimum_speed_square,2):
_time_left = time_to_despawn
_set_visible(true)
return
# Count down to zero and despawn
_time_left -= delta
if _time_left <= 0:
print("DespawningItem despawning!" , get_parent())
NetworkManager.despawn_item(get_parent())
# Stop counting: despawn_item() only queues the free, so without this we
# keep re-reporting the same item every frame until it actually goes.
set_process(false)
return
# Make item blink in and out before despawning
if _time_left < time_to_despawn / 2:
_set_visible(int(_time_left * 5.0) % 2 == 0)
# `visible` is not a replicated property, so a blink driven only here would make
# the item flicker on the host and stay solid on clients. Until it is synced,
# only warn when there is nobody else to disagree with.
func _set_visible(value: bool) -> void:
if NetworkManager.is_online():
get_parent().visible = true
return
get_parent().visible = value
+1
View File
@@ -0,0 +1 @@
uid://deyna316ka4xs
+6
View File
@@ -0,0 +1,6 @@
[gd_scene format=3 uid="uid://b5ukku8i0hilb"]
[ext_resource type="Script" uid="uid://deyna316ka4xs" path="res://Prefabs/despawning_item.gd" id="1_ayqk8"]
[node name="DespawningItem" type="Node" unique_id=303090111]
script = ExtResource("1_ayqk8")
+16
View File
@@ -0,0 +1,16 @@
[gd_scene format=3 uid="uid://mpapt5mkbuao"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_4m60m"]
friction = 0.0
bounce = 1.0
[sub_resource type="SphereShape3D" id="SphereShape3D_nn8tr"]
radius = 0.2752769
[node name="SlideOffDome" type="StaticBody3D" unique_id=1427609426]
collision_layer = 7
physics_material_override = SubResource("PhysicsMaterial_4m60m")
[node name="CollisionShape3D2" type="CollisionShape3D" parent="." unique_id=513124640]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.99165964, 0)
shape = SubResource("SphereShape3D_nn8tr")
+4 -4
View File
@@ -45,7 +45,7 @@ static func get_combination_result(first_id: StringName, second_id: StringName)
return get_item_scene(result_id)
static func get_cooking_result(ingredient_id: StringName) -> PackedScene:
static func get_cooking_result(ingredient_id: StringName) -> String:
load_recipes()
for cooked_id in _cooking_map.keys():
var cook_defs = _cooking_map[cooked_id]
@@ -53,12 +53,12 @@ static func get_cooking_result(ingredient_id: StringName) -> PackedScene:
if typeof(cook_defs) == TYPE_ARRAY:
for cook_def in cook_defs:
if cook_def["ingredient"] == ingredient_id:
return get_item_scene(cooked_id)
return cooked_id
else:
var cook_def = cook_defs
if cook_def["ingredient"] == ingredient_id:
return get_item_scene(cooked_id)
return null
return cooked_id
return ""
static func get_cooking_time(ingredient_id: StringName) -> float:
+145
View File
@@ -0,0 +1,145 @@
[gd_scene format=3 uid="uid://22shbqdvnwgo"]
[ext_resource type="Script" uid="uid://b4ldkd3ngs0vp" path="res://main.gd" id="1_m3h4l"]
[ext_resource type="PackedScene" uid="uid://j5s5wus7tuhb" path="res://XROrigin.tscn" id="2_8pfaf"]
[ext_resource type="Material" uid="uid://cmia50cfqxxo4" path="res://Textures/dev_material_3d.tres" id="3_gatbn"]
[ext_resource type="PackedScene" uid="uid://j7caslh27nor" path="res://Stations/Hob.tscn" id="4_3lufs"]
[ext_resource type="Sky" uid="uid://c1abtpwhdm2d5" path="res://Textures/sky/NightSkyHDRI009_16K.tres" id="5_kh26v"]
[ext_resource type="PackedScene" uid="uid://c6rift56ql3f8" path="res://Stations/BurgerBunsDispenser.tscn" id="7_tejmp"]
[ext_resource type="PackedScene" uid="uid://dpot5qie20vf6" path="res://Items/burger.tscn" id="9_rwx83"]
[ext_resource type="PackedScene" uid="uid://dvrk268s7gkxh" path="res://Stations/sink.tscn" id="12_ah4xa"]
[ext_resource type="PackedScene" uid="uid://cnjwtnhwh0i8q" path="res://Stations/dirt_station.tscn" id="13_46xi2"]
[ext_resource type="PackedScene" uid="uid://ck5tuftqmyiue" path="res://Stations/plate_dispenser.tscn" id="14_h88sx"]
[ext_resource type="PackedScene" uid="uid://cwnwo4i28upap" path="res://Stations/raw_burger_dispenser.tscn" id="15_m3h4l"]
[ext_resource type="PackedScene" uid="uid://efaec6ymgabo" path="res://Stations/Counter.tscn" id="15_tpcje"]
[ext_resource type="PackedScene" uid="uid://caf0xanmxbshy" path="res://Stations/table.tscn" id="16_g2k6a"]
[ext_resource type="Script" uid="uid://k8ywnvlhcic4" path="res://Scenes/testworldLoad.gd" id="16_m3h4l"]
[ext_resource type="PackedScene" uid="uid://clujaf3u776a3" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" id="17_gatbn"]
[ext_resource type="PackedScene" uid="uid://xtcei2uvd5li" path="res://UI/game_over_panel.tscn" id="18_3lufs"]
[ext_resource type="Script" uid="uid://cwijoksyou1ey" path="res://Scenes/GameOvercontroler.gd" id="19_3lufs"]
[sub_resource type="BoxShape3D" id="BoxShape3D_vlqg6"]
size = Vector3(16, 0.1, 16)
[sub_resource type="BoxMesh" id="BoxMesh_24d3s"]
material = ExtResource("3_gatbn")
size = Vector3(16, 0.1, 16)
[sub_resource type="Environment" id="Environment_bvwq1"]
background_mode = 2
sky = ExtResource("5_kh26v")
reflected_light_source = 2
ssr_enabled = true
ssao_enabled = true
ssil_enabled = true
sdfgi_enabled = true
[sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"]
size = Vector3(16, 10, 0.1)
[node name="Main" type="Node3D" unique_id=1312265607]
script = ExtResource("1_m3h4l")
[node name="XROrigin3D" parent="." unique_id=2055526621 instance=ExtResource("2_8pfaf")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.6, 0)
[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)
[node name="Table" parent="." unique_id=1863572470 instance=ExtResource("16_g2k6a")]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 2.739665, 0.47583598, -1.1895752)
primary_duration = 35.0
[node name="Floor" type="StaticBody3D" parent="." unique_id=122279514]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor" unique_id=958841648]
shape = SubResource("BoxShape3D_vlqg6")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Floor/CollisionShape3D" unique_id=1939997056]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0002836883, 0.0006355047, -0.0054528117)
mesh = SubResource("BoxMesh_24d3s")
[node name="Hob" parent="." unique_id=1687971542 instance=ExtResource("4_3lufs")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, -1.2)
[node name="Hob2" parent="." unique_id=496572049 instance=ExtResource("4_3lufs")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.6, 0.5, -1.2)
[node name="Hob3" parent="." unique_id=421567982 instance=ExtResource("4_3lufs")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.2, 0.5, -1.2)
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1177077250]
environment = SubResource("Environment_bvwq1")
[node name="BurgerBunsDispenser" parent="." unique_id=1720683779 instance=ExtResource("7_tejmp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8, 0.015, -1.2)
[node name="Sink" parent="." unique_id=2055277359 instance=ExtResource("12_ah4xa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5997182, 0.5, -1.2)
[node name="Sink2" parent="." unique_id=1692612192 instance=ExtResource("12_ah4xa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.1997182, 0.5, -1.2)
[node name="DirtStation" parent="." unique_id=160842153 instance=ExtResource("13_46xi2")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.8000001, 0.5, -1.2)
[node name="Counter2" parent="." unique_id=368890752 instance=ExtResource("15_tpcje")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.8, 0.5, -0.6)
[node name="Counter3" parent="." unique_id=1498817646 instance=ExtResource("15_tpcje")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.8, 0.5, 0)
[node name="Counter4" parent="." unique_id=906748771 instance=ExtResource("15_tpcje")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.8, 0.5, 0.6)
[node name="Counter5" parent="." unique_id=1487893288 instance=ExtResource("15_tpcje")]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, -0.6, 0.5, 1.2)
[node name="Counter6" parent="." unique_id=1154936647 instance=ExtResource("15_tpcje")]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0, 0.5, 1.2)
[node name="Counter7" parent="." unique_id=990260272 instance=ExtResource("15_tpcje")]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0.6, 0.5, 1.2)
[node name="StaticBody3D" type="StaticBody3D" parent="." unique_id=315740174]
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" unique_id=33059670]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.689, 8)
shape = SubResource("BoxShape3D_24d3s")
[node name="CollisionShape3D2" type="CollisionShape3D" parent="StaticBody3D" unique_id=2018792171]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.689, -8)
shape = SubResource("BoxShape3D_24d3s")
[node name="CollisionShape3D3" type="CollisionShape3D" parent="StaticBody3D" unique_id=757662929]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -8, 4.689, 0)
shape = SubResource("BoxShape3D_24d3s")
[node name="CollisionShape3D4" type="CollisionShape3D" parent="StaticBody3D" unique_id=1468386997]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 8, 4.689, 0)
shape = SubResource("BoxShape3D_24d3s")
[node name="GameOverPanel" parent="." unique_id=221361954 instance=ExtResource("17_gatbn")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.46454135, 3.4496074, -1.832967)
visible = false
scene = ExtResource("18_3lufs")
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=1302491889]
script = ExtResource("19_3lufs")
[node name="PlateDispenser" parent="." unique_id=710538846 instance=ExtResource("14_h88sx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8, 0, 1.2)
[node name="RawBurgerDispenser" parent="." unique_id=235630131 instance=ExtResource("15_m3h4l")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.2, 0, 1.2)
[node name="Node" type="Node" parent="." unique_id=1224933801]
script = ExtResource("16_m3h4l")
[node name="raw_burger" parent="." unique_id=1675596942 instance=ExtResource("9_rwx83")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.6, 1.2, -0.6)
+140
View File
@@ -0,0 +1,140 @@
[gd_scene format=3 uid="uid://22shbqdvnwgo"]
[ext_resource type="Script" uid="uid://b4ldkd3ngs0vp" path="res://main.gd" id="1_m3h4l"]
[ext_resource type="PackedScene" uid="uid://j5s5wus7tuhb" path="res://XROrigin.tscn" id="2_8pfaf"]
[ext_resource type="Material" uid="uid://cmia50cfqxxo4" path="res://Textures/dev_material_3d.tres" id="3_gatbn"]
[ext_resource type="PackedScene" uid="uid://j7caslh27nor" path="res://Stations/Hob.tscn" id="4_3lufs"]
[ext_resource type="Sky" uid="uid://c1abtpwhdm2d5" path="res://Textures/sky/NightSkyHDRI009_16K.tres" id="5_kh26v"]
[ext_resource type="PackedScene" uid="uid://c6rift56ql3f8" path="res://Stations/BurgerBunsDispenser.tscn" id="7_tejmp"]
[ext_resource type="PackedScene" uid="uid://dvrk268s7gkxh" path="res://Stations/sink.tscn" id="12_ah4xa"]
[ext_resource type="PackedScene" uid="uid://cnjwtnhwh0i8q" path="res://Stations/dirt_station.tscn" id="13_46xi2"]
[ext_resource type="PackedScene" uid="uid://ck5tuftqmyiue" path="res://Stations/plate_dispenser.tscn" id="14_h88sx"]
[ext_resource type="PackedScene" uid="uid://cwnwo4i28upap" path="res://Stations/raw_burger_dispenser.tscn" id="15_m3h4l"]
[ext_resource type="PackedScene" uid="uid://efaec6ymgabo" path="res://Stations/Counter.tscn" id="15_tpcje"]
[ext_resource type="PackedScene" uid="uid://caf0xanmxbshy" path="res://Stations/table.tscn" id="16_g2k6a"]
[ext_resource type="Script" uid="uid://k8ywnvlhcic4" path="res://Scenes/testworldLoad.gd" id="16_m3h4l"]
[ext_resource type="PackedScene" uid="uid://clujaf3u776a3" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" id="17_gatbn"]
[ext_resource type="PackedScene" uid="uid://xtcei2uvd5li" path="res://UI/game_over_panel.tscn" id="18_3lufs"]
[ext_resource type="Script" uid="uid://cwijoksyou1ey" path="res://Scenes/GameOvercontroler.gd" id="19_3lufs"]
[sub_resource type="BoxShape3D" id="BoxShape3D_vlqg6"]
size = Vector3(16, 0.1, 16)
[sub_resource type="BoxMesh" id="BoxMesh_24d3s"]
material = ExtResource("3_gatbn")
size = Vector3(16, 0.1, 16)
[sub_resource type="Environment" id="Environment_bvwq1"]
background_mode = 2
sky = ExtResource("5_kh26v")
reflected_light_source = 2
ssr_enabled = true
ssao_enabled = true
ssil_enabled = true
sdfgi_enabled = true
[sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"]
size = Vector3(16, 10, 0.1)
[node name="Main" type="Node3D" unique_id=1312265607]
script = ExtResource("1_m3h4l")
[node name="XROrigin3D" parent="." unique_id=2055526621 instance=ExtResource("2_8pfaf")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.6, 0)
[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)
[node name="Floor" type="StaticBody3D" parent="." unique_id=122279514]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor" unique_id=958841648]
shape = SubResource("BoxShape3D_vlqg6")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Floor/CollisionShape3D" unique_id=1939997056]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0002836883, 0.0006355047, -0.0054528117)
mesh = SubResource("BoxMesh_24d3s")
[node name="Hob" parent="." unique_id=1687971542 instance=ExtResource("4_3lufs")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, -1.2)
[node name="Hob2" parent="." unique_id=496572049 instance=ExtResource("4_3lufs")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.6, 0.5, -1.2)
[node name="Hob3" parent="." unique_id=421567982 instance=ExtResource("4_3lufs")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.2, 0.5, -1.2)
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1177077250]
environment = SubResource("Environment_bvwq1")
[node name="BurgerBunsDispenser" parent="." unique_id=1720683779 instance=ExtResource("7_tejmp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8, 0.015, -1.2)
[node name="Sink" parent="." unique_id=2055277359 instance=ExtResource("12_ah4xa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5997182, 0.5, -1.2)
[node name="Sink2" parent="." unique_id=1692612192 instance=ExtResource("12_ah4xa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.1997182, 0.5, -1.2)
[node name="DirtStation" parent="." unique_id=160842153 instance=ExtResource("13_46xi2")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.8000001, 0.5, -1.2)
[node name="Counter2" parent="." unique_id=368890752 instance=ExtResource("15_tpcje")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.8, 0.5, -0.6)
[node name="Counter3" parent="." unique_id=1498817646 instance=ExtResource("15_tpcje")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.8, 0.5, 0)
[node name="Counter4" parent="." unique_id=906748771 instance=ExtResource("15_tpcje")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.8, 0.5, 0.6)
[node name="Counter5" parent="." unique_id=1487893288 instance=ExtResource("15_tpcje")]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, -0.6, 0.5, 1.2)
[node name="Counter6" parent="." unique_id=1154936647 instance=ExtResource("15_tpcje")]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0, 0.5, 1.2)
[node name="Counter7" parent="." unique_id=990260272 instance=ExtResource("15_tpcje")]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0.6, 0.5, 1.2)
[node name="Table" parent="." unique_id=1863572470 instance=ExtResource("16_g2k6a")]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 2.739665, 0.47583598, -1.1895752)
[node name="StaticBody3D" type="StaticBody3D" parent="." unique_id=315740174]
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" unique_id=33059670]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.689, 8)
shape = SubResource("BoxShape3D_24d3s")
[node name="CollisionShape3D2" type="CollisionShape3D" parent="StaticBody3D" unique_id=2018792171]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.689, -8)
shape = SubResource("BoxShape3D_24d3s")
[node name="CollisionShape3D3" type="CollisionShape3D" parent="StaticBody3D" unique_id=757662929]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -8, 4.689, 0)
shape = SubResource("BoxShape3D_24d3s")
[node name="CollisionShape3D4" type="CollisionShape3D" parent="StaticBody3D" unique_id=1468386997]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 8, 4.689, 0)
shape = SubResource("BoxShape3D_24d3s")
[node name="GameOverPanel" parent="." unique_id=221361954 instance=ExtResource("17_gatbn")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.46454135, 3.4496074, -1.832967)
visible = false
scene = ExtResource("18_3lufs")
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=1302491889]
script = ExtResource("19_3lufs")
[node name="PlateDispenser" parent="." unique_id=710538846 instance=ExtResource("14_h88sx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8, 0, 1.2)
[node name="RawBurgerDispenser" parent="." unique_id=235630131 instance=ExtResource("15_m3h4l")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.2, 0, 1.2)
[node name="Node" type="Node" parent="." unique_id=1224933801]
script = ExtResource("16_m3h4l")
+140
View File
@@ -0,0 +1,140 @@
[gd_scene format=3 uid="uid://22shbqdvnwgo"]
[ext_resource type="Script" uid="uid://b4ldkd3ngs0vp" path="res://main.gd" id="1_m3h4l"]
[ext_resource type="PackedScene" uid="uid://j5s5wus7tuhb" path="res://XROrigin.tscn" id="2_8pfaf"]
[ext_resource type="Material" uid="uid://cmia50cfqxxo4" path="res://Textures/dev_material_3d.tres" id="3_gatbn"]
[ext_resource type="PackedScene" uid="uid://j7caslh27nor" path="res://Stations/Hob.tscn" id="4_3lufs"]
[ext_resource type="Sky" uid="uid://c1abtpwhdm2d5" path="res://Textures/sky/NightSkyHDRI009_16K.tres" id="5_kh26v"]
[ext_resource type="PackedScene" uid="uid://c6rift56ql3f8" path="res://Stations/BurgerBunsDispenser.tscn" id="7_tejmp"]
[ext_resource type="PackedScene" uid="uid://dvrk268s7gkxh" path="res://Stations/sink.tscn" id="12_ah4xa"]
[ext_resource type="PackedScene" uid="uid://cnjwtnhwh0i8q" path="res://Stations/dirt_station.tscn" id="13_46xi2"]
[ext_resource type="PackedScene" uid="uid://ck5tuftqmyiue" path="res://Stations/plate_dispenser.tscn" id="14_h88sx"]
[ext_resource type="PackedScene" uid="uid://cwnwo4i28upap" path="res://Stations/raw_burger_dispenser.tscn" id="15_m3h4l"]
[ext_resource type="PackedScene" uid="uid://efaec6ymgabo" path="res://Stations/Counter.tscn" id="15_tpcje"]
[ext_resource type="PackedScene" uid="uid://caf0xanmxbshy" path="res://Stations/table.tscn" id="16_g2k6a"]
[ext_resource type="Script" uid="uid://k8ywnvlhcic4" path="res://Scenes/testworldLoad.gd" id="16_m3h4l"]
[ext_resource type="PackedScene" uid="uid://clujaf3u776a3" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" id="17_gatbn"]
[ext_resource type="PackedScene" uid="uid://xtcei2uvd5li" path="res://UI/game_over_panel.tscn" id="18_3lufs"]
[ext_resource type="Script" uid="uid://cwijoksyou1ey" path="res://Scenes/GameOvercontroler.gd" id="19_3lufs"]
[sub_resource type="BoxShape3D" id="BoxShape3D_vlqg6"]
size = Vector3(16, 0.1, 16)
[sub_resource type="BoxMesh" id="BoxMesh_24d3s"]
material = ExtResource("3_gatbn")
size = Vector3(16, 0.1, 16)
[sub_resource type="Environment" id="Environment_bvwq1"]
background_mode = 2
sky = ExtResource("5_kh26v")
reflected_light_source = 2
ssr_enabled = true
ssao_enabled = true
ssil_enabled = true
sdfgi_enabled = true
[sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"]
size = Vector3(16, 10, 0.1)
[node name="Main" type="Node3D" unique_id=1312265607]
script = ExtResource("1_m3h4l")
[node name="XROrigin3D" parent="." unique_id=2055526621 instance=ExtResource("2_8pfaf")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.6, 0)
[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)
[node name="Floor" type="StaticBody3D" parent="." unique_id=122279514]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor" unique_id=958841648]
shape = SubResource("BoxShape3D_vlqg6")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Floor/CollisionShape3D" unique_id=1939997056]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0002836883, 0.0006355047, -0.0054528117)
mesh = SubResource("BoxMesh_24d3s")
[node name="Hob" parent="." unique_id=1687971542 instance=ExtResource("4_3lufs")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, -1.2)
[node name="Hob2" parent="." unique_id=496572049 instance=ExtResource("4_3lufs")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.6, 0.5, -1.2)
[node name="Hob3" parent="." unique_id=421567982 instance=ExtResource("4_3lufs")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.2, 0.5, -1.2)
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1177077250]
environment = SubResource("Environment_bvwq1")
[node name="BurgerBunsDispenser" parent="." unique_id=1720683779 instance=ExtResource("7_tejmp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8, 0.015, -1.2)
[node name="Sink" parent="." unique_id=2055277359 instance=ExtResource("12_ah4xa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5997182, 0.5, -1.2)
[node name="Sink2" parent="." unique_id=1692612192 instance=ExtResource("12_ah4xa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.1997182, 0.5, -1.2)
[node name="DirtStation" parent="." unique_id=160842153 instance=ExtResource("13_46xi2")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.8000001, 0.5, -1.2)
[node name="Counter2" parent="." unique_id=368890752 instance=ExtResource("15_tpcje")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.8, 0.5, -0.6)
[node name="Counter3" parent="." unique_id=1498817646 instance=ExtResource("15_tpcje")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.8, 0.5, 0)
[node name="Counter4" parent="." unique_id=906748771 instance=ExtResource("15_tpcje")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.8, 0.5, 0.6)
[node name="Counter5" parent="." unique_id=1487893288 instance=ExtResource("15_tpcje")]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, -0.6, 0.5, 1.2)
[node name="Counter6" parent="." unique_id=1154936647 instance=ExtResource("15_tpcje")]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0, 0.5, 1.2)
[node name="Counter7" parent="." unique_id=990260272 instance=ExtResource("15_tpcje")]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0.6, 0.5, 1.2)
[node name="Table" parent="." unique_id=1863572470 instance=ExtResource("16_g2k6a")]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 2.739665, 0.47583598, -1.1895752)
[node name="StaticBody3D" type="StaticBody3D" parent="." unique_id=315740174]
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" unique_id=33059670]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.689, 8)
shape = SubResource("BoxShape3D_24d3s")
[node name="CollisionShape3D2" type="CollisionShape3D" parent="StaticBody3D" unique_id=2018792171]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.689, -8)
shape = SubResource("BoxShape3D_24d3s")
[node name="CollisionShape3D3" type="CollisionShape3D" parent="StaticBody3D" unique_id=757662929]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -8, 4.689, 0)
shape = SubResource("BoxShape3D_24d3s")
[node name="CollisionShape3D4" type="CollisionShape3D" parent="StaticBody3D" unique_id=1468386997]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 8, 4.689, 0)
shape = SubResource("BoxShape3D_24d3s")
[node name="GameOverPanel" parent="." unique_id=221361954 instance=ExtResource("17_gatbn")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.46454135, 3.4496074, -1.832967)
visible = false
scene = ExtResource("18_3lufs")
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=1302491889]
script = ExtResource("19_3lufs")
[node name="PlateDispenser" parent="." unique_id=710538846 instance=ExtResource("14_h88sx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8, 0, 1.2)
[node name="RawBurgerDispenser" parent="." unique_id=235630131 instance=ExtResource("15_m3h4l")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.2, 0, 1.2)
[node name="Node" type="Node" parent="." unique_id=1224933801]
script = ExtResource("16_m3h4l")
+11
View File
@@ -0,0 +1,11 @@
extends Node
func _ready() -> void:
$"..".visible = false
# Listen for the game over signal from GameManager
Signals.game_over.connect(_on_game_over)
func _on_game_over() -> void:
$"..".visible = true
+1
View File
@@ -0,0 +1 @@
uid://cwijoksyou1ey
+88 -133
View File
@@ -1,46 +1,62 @@
[gd_scene format=3 uid="uid://do6mrslyqe5qe"]
[ext_resource type="Script" uid="uid://b4ldkd3ngs0vp" path="res://main.gd" id="1_57ppd"]
[ext_resource type="Script" uid="uid://d1cefhe3yyyds" path="res://Scenes/multiplayer_world.gd" id="1_57ppd"]
[ext_resource type="PackedScene" uid="uid://j5s5wus7tuhb" path="res://XROrigin.tscn" id="2_o1b3t"]
[ext_resource type="Material" uid="uid://cmia50cfqxxo4" path="res://Textures/dev_material_3d.tres" id="3_irf4n"]
[ext_resource type="PackedScene" uid="uid://j7caslh27nor" path="res://Stations/Hob.tscn" id="4_ctden"]
[ext_resource type="PackedScene" uid="uid://e4i6o5oriecx" path="res://Items/PickupCube.tscn" id="6_eoxxy"]
[ext_resource type="Sky" uid="uid://c1abtpwhdm2d5" path="res://Textures/sky/NightSkyHDRI009_16K.tres" id="7_n8fyw"]
[ext_resource type="PackedScene" uid="uid://c0lknik4noobs" path="res://Items/BurgerBuns.tscn" id="8_rraok"]
[ext_resource type="PackedScene" uid="uid://c6rift56ql3f8" path="res://Stations/BurgerBunsDispenser.tscn" id="9_sq0s2"]
[ext_resource type="PackedScene" uid="uid://bp3v1jl8pctro" path="res://Containers/plate.tscn" id="10_ay2w6"]
[ext_resource type="PackedScene" uid="uid://dpot5qie20vf6" path="res://Items/burger.tscn" id="11_qn1ku"]
[ext_resource type="PackedScene" uid="uid://b3m2ag8g5rj4r" path="res://Items/hamburger.tscn" id="12_hfwnn"]
[ext_resource type="PackedScene" uid="uid://cwnwo4i28upap" path="res://Stations/raw_burger_dispenser.tscn" id="11_ctden"]
[ext_resource type="PackedScene" uid="uid://bbg7dwsbxxh1t" path="res://Scenes/cube_side_dispense.tscn" id="12_57ppd"]
[ext_resource type="PackedScene" uid="uid://ck5tuftqmyiue" path="res://Stations/plate_dispenser.tscn" id="13_irf4n"]
[ext_resource type="PackedScene" uid="uid://dvrk268s7gkxh" path="res://Stations/sink.tscn" id="13_o1b3t"]
[ext_resource type="PackedScene" uid="uid://clujaf3u776a3" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" id="14_di04w"]
[ext_resource type="PackedScene" uid="uid://cnjwtnhwh0i8q" path="res://Stations/dirt_station.tscn" id="14_irf4n"]
[ext_resource type="PackedScene" uid="uid://cfc4ho67u4r5e" path="res://Items/cooked_burger.tscn" id="15_ctden"]
[ext_resource type="PackedScene" uid="uid://efaec6ymgabo" path="res://Stations/Counter.tscn" id="15_di04w"]
[ext_resource type="PackedScene" uid="uid://xtcei2uvd5li" path="res://UI/game_over_panel.tscn" id="15_eoxxy"]
[ext_resource type="PackedScene" uid="uid://caf0xanmxbshy" path="res://Stations/table.tscn" id="16_di04w"]
[sub_resource type="BoxShape3D" id="BoxShape3D_vlqg6"]
size = Vector3(5, 0.1, 5)
[sub_resource type="BoxMesh" id="BoxMesh_24d3s"]
material = ExtResource("3_irf4n")
size = Vector3(5, 0.1, 5)
[ext_resource type="Script" uid="uid://cwijoksyou1ey" path="res://Scenes/GameOvercontroler.gd" id="16_n8fyw"]
[sub_resource type="Environment" id="Environment_bvwq1"]
background_mode = 2
sky = ExtResource("7_n8fyw")
ambient_light_source = 3
ambient_light_color = Color(1, 1, 1, 1)
ambient_light_sky_contribution = 0.9
reflected_light_source = 2
ssr_enabled = true
ssao_enabled = true
ssil_enabled = true
sdfgi_enabled = true
[sub_resource type="BoxShape3D" id="BoxShape3D_vlqg6"]
size = Vector3(20, 0.1, 20)
[sub_resource type="BoxMesh" id="BoxMesh_24d3s"]
material = ExtResource("3_irf4n")
size = Vector3(20, 0.1, 20)
[sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"]
size = Vector3(5.1, 10, 0.1)
size = Vector3(20, 10, 0.1)
[node name="Main" type="Node3D" unique_id=1312265607]
script = ExtResource("1_57ppd")
[node name="XROrigin3D" parent="." unique_id=2055526621 instance=ExtResource("2_o1b3t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.36171648, 0, 0.81835127)
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1177077250]
environment = SubResource("Environment_bvwq1")
[node name="XROrigin3D" parent="." unique_id=2055526621 groups=["local_xr_origin"] instance=ExtResource("2_o1b3t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.9667189, 0)
[node name="WorldContent" type="Node3D" parent="." unique_id=262398468]
[node name="Players" type="Node3D" parent="." unique_id=1772076868]
[node name="ItemsSpawner" type="MultiplayerSpawner" parent="." unique_id=2051771581]
spawn_path = NodePath("../WorldContent")
[node name="PlayersSpawner" type="MultiplayerSpawner" parent="." unique_id=619815427]
spawn_path = NodePath("../Players")
[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)
@@ -55,132 +71,71 @@ shape = SubResource("BoxShape3D_vlqg6")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00018164515, 0.0006352663, -0.002532661)
mesh = SubResource("BoxMesh_24d3s")
[node name="Hob" parent="." unique_id=1687971542 instance=ExtResource("4_ctden")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.29336345, 0.8981018, -1.484)
[node name="InvisibleWalls" type="StaticBody3D" parent="." unique_id=315740174]
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1177077250]
environment = SubResource("Environment_bvwq1")
[node name="CollisionShape3D" type="CollisionShape3D" parent="InvisibleWalls" unique_id=33059670]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.688614, 8.838269)
shape = SubResource("BoxShape3D_24d3s")
[node name="BurgerBuns" parent="." unique_id=1088240294 instance=ExtResource("8_rraok")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8162017, 1.6081157, -1.4714175)
[node name="CollisionShape3D2" type="CollisionShape3D" parent="InvisibleWalls" unique_id=2018792171]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.688614, -10.243342)
shape = SubResource("BoxShape3D_24d3s")
[node name="BurgerBunsDispenser" parent="." unique_id=1720683779 instance=ExtResource("9_sq0s2")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.832131, 0.40028095, -1.4813508)
[node name="CollisionShape3D3" type="CollisionShape3D" parent="InvisibleWalls" unique_id=757662929]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -9.807113, 4.688614, -0.018813243)
shape = SubResource("BoxShape3D_24d3s")
[node name="Plate" parent="." unique_id=190487773 instance=ExtResource("10_ay2w6")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5717233, 1.5454081, 1.5373346)
[node name="burger" parent="." unique_id=1417604760 instance=ExtResource("11_qn1ku")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6888188, 1.4195822, -1.7110313)
[node name="burger2" parent="." unique_id=1584460510 instance=ExtResource("11_qn1ku")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6931299, 1.5300478, -1.71225)
[node name="burger3" parent="." unique_id=1884095916 instance=ExtResource("11_qn1ku")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.69027674, 1.4969791, -1.7210286)
[node name="burger4" parent="." unique_id=1844818864 instance=ExtResource("11_qn1ku")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.69134104, 1.4543622, -1.7210286)
[node name="Hamburger" parent="." unique_id=761091445 instance=ExtResource("12_hfwnn")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.9352558, 1.623975, 1.2447833)
[node name="PickableObject" parent="." unique_id=1675596942 instance=ExtResource("6_eoxxy")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, 0.6225724, 1.4792972, -1.0473135)
[node name="PickableObject2" parent="." unique_id=713087634 instance=ExtResource("6_eoxxy")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, 0.6359743, 1.4639391, -1.1673055)
[node name="PickableObject3" parent="." unique_id=879935619 instance=ExtResource("6_eoxxy")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, 0.5142721, 1.4792972, -1.0473135)
[node name="PickableObject4" parent="." unique_id=198541902 instance=ExtResource("6_eoxxy")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, 0.5276739, 1.4639391, -1.1673055)
[node name="Hamburger2" parent="." unique_id=1349934579 instance=ExtResource("12_hfwnn")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.9857153, 1.5329368, 0.9472374)
[node name="PickableObject5" parent="." unique_id=1021333509 instance=ExtResource("6_eoxxy")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, 0.73287535, 1.4792972, -1.0473135)
[node name="PickableObject6" parent="." unique_id=1268843669 instance=ExtResource("6_eoxxy")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, 0.7462772, 1.4639391, -1.1673055)
[node name="Sink" parent="." unique_id=2055277359 instance=ExtResource("13_o1b3t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.3140475, 0.9061539, -1.4941733)
[node name="DirtStation" parent="." unique_id=160842153 instance=ExtResource("14_irf4n")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.0864775, 0.8981018, -1.244947)
[node name="Plate2" parent="." unique_id=356790445 instance=ExtResource("10_ay2w6")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5730225, 1.499024, 0.59790254)
[node name="CookedBurger" parent="." unique_id=1127807542 instance=ExtResource("15_ctden")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.30671906, 1.4131018, -1.0928738)
[node name="CookedBurger2" parent="." unique_id=160088590 instance=ExtResource("15_ctden")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.30671906, 1.4496142, -1.0928738)
[node name="CookedBurger3" parent="." unique_id=992183367 instance=ExtResource("15_ctden")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.3344773, 1.4398065, -0.7096845)
[node name="CookedBurger4" parent="." unique_id=1837607086 instance=ExtResource("15_ctden")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.30671906, 1.525444, -1.0928738)
[node name="BurgerBuns2" parent="." unique_id=1210358958 instance=ExtResource("8_rraok")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.3596323, 1.4110342, -0.22482127)
[node name="PickableObject7" parent="." unique_id=641653545 instance=ExtResource("6_eoxxy")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, -1.3556751, 1.4792972, 0.28881657)
[node name="PickableObject8" parent="." unique_id=1733819363 instance=ExtResource("6_eoxxy")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, -1.3422732, 1.4639391, 0.16882455)
[node name="PickableObject9" parent="." unique_id=12419746 instance=ExtResource("6_eoxxy")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, -1.4639754, 1.4792972, 0.28881657)
[node name="PickableObject10" parent="." unique_id=313160217 instance=ExtResource("6_eoxxy")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, -1.4505737, 1.4639391, 0.16882455)
[node name="Counter" parent="." unique_id=1487893288 instance=ExtResource("15_di04w")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.7124918, 0.90304357, -1.4886917)
[node name="Counter2" parent="." unique_id=368890752 instance=ExtResource("15_di04w")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.7648025, 0.90304357, -0.4458799)
[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.7648025, 0.90304357, 0.55367994)
[node name="Counter4" parent="." unique_id=906748771 instance=ExtResource("15_di04w")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.7648025, 0.90304357, 1.5539298)
[node name="CollisionShape3D4" type="CollisionShape3D" parent="InvisibleWalls" unique_id=1468386997]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 9.934778, 4.297072, -0.018813023)
shape = SubResource("BoxShape3D_24d3s")
[node name="Table" parent="." unique_id=1863572470 instance=ExtResource("16_di04w")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.50244665, 0.9030438, -0.20709503)
initial_thinking_time = 8.0
initial_primary_time = 40.0
initial_friend_time = 3.0
initial_eating_time = 3.0
transform = Transform3D(-1, 0, 8.742277e-08, 0, 1, 0, -8.742277e-08, 0, -1, 3.6294794, 0.54177135, 0.0973109)
primary_duration = 35.0
[node name="Hamburger3" parent="." unique_id=369573848 instance=ExtResource("12_hfwnn")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.7201865, 1.5329367, 0.14773655)
[node name="Hob" parent="." unique_id=1687971542 instance=ExtResource("4_ctden")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.35077858, 0.50655985, -1.2833805)
[node name="Plate3" parent="." unique_id=2004250522 instance=ExtResource("10_ay2w6")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5818124, 1.499024, -0.4634577)
[node name="Sink" parent="." unique_id=2055277359 instance=ExtResource("13_o1b3t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.24685252, 0.51461196, -1.2828919)
[node name="StaticBody3D" type="StaticBody3D" parent="." unique_id=315740174]
[node name="DirtStation" parent="." unique_id=160842153 instance=ExtResource("14_irf4n")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.7978771, 0.50655985, -1.2598276)
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" unique_id=33059670]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.688614, 2.5070028)
shape = SubResource("BoxShape3D_24d3s")
[node name="Counter" parent="." unique_id=1487893288 instance=ExtResource("15_di04w")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.94890714, 0.5115015, -1.3041471)
[node name="CollisionShape3D2" type="CollisionShape3D" parent="StaticBody3D" unique_id=2018792171]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.688614, -2.5446289)
shape = SubResource("BoxShape3D_24d3s")
[node name="Counter2" parent="." unique_id=368890752 instance=ExtResource("15_di04w")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.5477214, 0.5115016, -0.1103079)
[node name="CollisionShape3D3" type="CollisionShape3D" parent="StaticBody3D" unique_id=757662929]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -2.525816, 4.688614, -0.018813243)
shape = SubResource("BoxShape3D_24d3s")
[node name="Counter4" parent="." unique_id=1748373996 instance=ExtResource("15_di04w")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.5477214, 0.5115016, -0.70863545)
[node name="CollisionShape3D4" type="CollisionShape3D" parent="StaticBody3D" unique_id=1468386997]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 2.525816, 4.688614, -0.018813023)
shape = SubResource("BoxShape3D_24d3s")
[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(-1, 0, 4.371139e-08, 0, 1, 0, -4.371139e-08, 0, -1, -0.12681937, 2.3841858e-07, 3.538899)
[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)
[node name="RawBurgerDispenser" parent="." unique_id=235630131 instance=ExtResource("11_ctden")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.8896122, 0.008738995, 1.0872328)
[node name="PlateDispenser" parent="." unique_id=710538846 instance=ExtResource("13_irf4n")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.26631236, 0.008738995, 1.087036)
[node name="GameOverPanel" parent="." unique_id=1234658657 instance=ExtResource("14_di04w")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -2.0281777, 2.8122003, 0)
scene = ExtResource("15_eoxxy")
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=803158176]
script = ExtResource("16_n8fyw")
[node name="CubeSideDispenser2" parent="." unique_id=200950572 instance=ExtResource("12_57ppd")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.35154933, 0, 1.1119425)
+72
View File
@@ -0,0 +1,72 @@
[gd_scene format=3 uid="uid://bbg7dwsbxxh1t"]
[ext_resource type="Script" uid="uid://0y6wnjcsum6" path="res://Stations/item_dispenser.gd" id="1_4m60m"]
[ext_resource type="PackedScene" uid="uid://e4i6o5oriecx" path="res://Items/PickupCube.tscn" id="2_nn8tr"]
[ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="3_ahn1e"]
[ext_resource type="PackedScene" uid="uid://mpapt5mkbuao" path="res://Prefabs/slide_off_dome.tscn" id="4_nn8tr"]
[sub_resource type="SphereShape3D" id="SphereShape3D_xmbo2"]
radius = 0.3
[sub_resource type="CylinderShape3D" id="CylinderShape3D_24d3s"]
radius = 0.29541016
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_24d3s"]
albedo_color = Color(0.1764706, 1, 1, 1)
[sub_resource type="BoxMesh" id="BoxMesh_irf4n"]
material = SubResource("StandardMaterial3D_24d3s")
size = Vector3(0.1, 0.1, 0.1)
[node name="CubeSideDispenser2" type="StaticBody3D" unique_id=200950572]
script = ExtResource("1_4m60m")
item_scene = ExtResource("2_nn8tr")
[node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=1018021004]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00070536137, 1.0440714, -0.002165556)
collision_layer = 65536
collision_mask = 65536
script = ExtResource("3_ahn1e")
snap_mode = 1
metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
[node name="CollisionShape3D" type="CollisionShape3D" parent="XRToolsSnapZone" unique_id=182042233]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.15291119, 0)
shape = SubResource("SphereShape3D_xmbo2")
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1974757539]
shape = SubResource("CylinderShape3D_24d3s")
[node name="SlideOffDome" parent="." unique_id=1427609426 instance=ExtResource("4_nn8tr")]
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="." unique_id=1172420592]
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=1073546772]
radius = 0.3
sides = 32
[node name="Cubes" type="Node3D" parent="." unique_id=100532970]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Cubes" unique_id=2040729886]
transform = Transform3D(0.9709369, 0, 0.23933554, 0, 1, 0, -0.23933554, 0, 0.9709369, -0.0038359165, 1.0421022, -0.1349423)
mesh = SubResource("BoxMesh_irf4n")
[node name="MeshInstance3D2" type="MeshInstance3D" parent="Cubes" unique_id=2119335322]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.1336323, 1.0421022, 0.049409628)
mesh = SubResource("BoxMesh_irf4n")
[node name="MeshInstance3D3" type="MeshInstance3D" parent="Cubes" unique_id=896999260]
transform = Transform3D(0.94914126, 0, -0.31485054, 0, 1, 0, 0.31485054, 0, 0.94914126, 0.021345377, 1.0421022, 0.13508391)
mesh = SubResource("BoxMesh_irf4n")
[node name="MeshInstance3D4" type="MeshInstance3D" parent="Cubes" unique_id=1055210121]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.14830339, 1.0421022, 0.054090023)
mesh = SubResource("BoxMesh_irf4n")
[node name="MeshInstance3D5" type="MeshInstance3D" parent="Cubes" unique_id=1800524097]
transform = Transform3D(0.966823, 0, -0.2554472, 0, 1, 0, 0.2554472, 0, 0.966823, 0.12695658, 1.0421022, -0.07926583)
mesh = SubResource("BoxMesh_irf4n")
[node name="MeshInstance3D6" type="MeshInstance3D" parent="Cubes" unique_id=192094054]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.11111963, 1.0421022, -0.094003916)
mesh = SubResource("BoxMesh_irf4n")
+35 -35
View File
@@ -41,7 +41,7 @@ script = ExtResource("1_72gy5")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.36171648, 0, 0.81835127)
[node name="MainMenuPanel3D" parent="." unique_id=1448860532 instance=ExtResource("16_vp")]
transform = Transform3D(5, 0, 0, 0, 5, 0, 0, 0, 5, 0.36171648, 2.543398, -1.9758987)
transform = Transform3D(5, 0, 0, 0, 5, 0, 0, 0, 5, 0.36171648, 2.0238447, -1.9758987)
screen_size = Vector2(0.6, 0.4)
scene = ExtResource("17_panel")
viewport_size = Vector2(600, 400)
@@ -61,106 +61,106 @@ shape = SubResource("BoxShape3D_vlqg6")
mesh = SubResource("BoxMesh_24d3s")
[node name="Hob" parent="." unique_id=1687971542 instance=ExtResource("4_5kvh0")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.29336345, 0.8981018, -1.484)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.29336345, 0.5, -1.484)
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1177077250]
environment = SubResource("Environment_bvwq1")
[node name="BurgerBuns" parent="." unique_id=1088240294 instance=ExtResource("6_bktvt")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8162017, 1.6081157, -1.4714175)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5530176, 1.0505146, -1.3074328)
[node name="BurgerBunsDispenser" parent="." unique_id=1720683779 instance=ExtResource("7_1nkd0")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.832131, 0.40028095, -1.4813508)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.568947, -0.018512607, -1.317366)
[node name="Plate" parent="." unique_id=190487773 instance=ExtResource("8_l1owj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5717233, 1.5454081, 1.5373346)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5717233, 1.1548845, 1.5373346)
[node name="burger" parent="." unique_id=1417604760 instance=ExtResource("9_220hi")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6888188, 1.4195822, -1.7110313)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6888188, 1.0325116, -1.7110313)
[node name="burger2" parent="." unique_id=1584460510 instance=ExtResource("9_220hi")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6931299, 1.5300478, -1.71225)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6931299, 1.1429771, -1.71225)
[node name="burger3" parent="." unique_id=1884095916 instance=ExtResource("9_220hi")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.69027674, 1.4969791, -1.7210286)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.69027674, 1.1099085, -1.7210286)
[node name="burger4" parent="." unique_id=1844818864 instance=ExtResource("9_220hi")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.69134104, 1.4543622, -1.7210286)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.69134104, 1.0672915, -1.7210286)
[node name="Hamburger" parent="." unique_id=761091445 instance=ExtResource("10_qacki")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.9352558, 1.623975, 1.2447833)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.9352558, 1.2334514, 1.2447833)
[node name="PickableObject" parent="." unique_id=1675596942 instance=ExtResource("11_npf8s")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, 0.6225724, 1.4792972, -1.0473135)
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, 0.6225724, 1.0654817, -1.0473135)
[node name="PickableObject2" parent="." unique_id=713087634 instance=ExtResource("11_npf8s")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, 0.6359743, 1.4639391, -1.1673055)
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, 0.6359743, 1.0501236, -1.1673055)
[node name="PickableObject3" parent="." unique_id=879935619 instance=ExtResource("11_npf8s")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, 0.5142721, 1.4792972, -1.0473135)
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, 0.5142721, 1.0654817, -1.0473135)
[node name="PickableObject4" parent="." unique_id=198541902 instance=ExtResource("11_npf8s")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, 0.5276739, 1.4639391, -1.1673055)
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, 0.5276739, 1.0501236, -1.1673055)
[node name="Hamburger2" parent="." unique_id=1349934579 instance=ExtResource("10_qacki")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.9857153, 1.5329368, 0.9472374)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.9857153, 1.1424131, 0.9472374)
[node name="PickableObject5" parent="." unique_id=1021333509 instance=ExtResource("11_npf8s")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, 0.73287535, 1.4792972, -1.0473135)
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, 0.73287535, 1.0922265, -1.0473135)
[node name="PickableObject6" parent="." unique_id=1268843669 instance=ExtResource("11_npf8s")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, 0.7462772, 1.4639391, -1.1673055)
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, 0.7462772, 1.0768684, -1.1673055)
[node name="Sink" parent="." unique_id=2055277359 instance=ExtResource("12_8apyq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.3147688, 0.9045367, -1.4940417)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.3147688, 0.5, -1.4940417)
[node name="DirtStation" parent="." unique_id=160842153 instance=ExtResource("13_jnwcx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.0864775, 0.8981018, -1.244947)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.0864775, 0.5, -1.244947)
[node name="Plate2" parent="." unique_id=356790445 instance=ExtResource("8_l1owj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5730225, 1.499024, 0.59790254)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5730225, 1.1085004, 0.59790254)
[node name="CookedBurger" parent="." unique_id=1127807542 instance=ExtResource("14_1lg2m")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.30671906, 1.4131018, -1.0928738)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.30782473, 1.1446649, -1.0928738)
[node name="CookedBurger2" parent="." unique_id=160088590 instance=ExtResource("14_1lg2m")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.30671906, 1.4496142, -1.0928738)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.30671906, 1.0522771, -1.0928738)
[node name="CookedBurger3" parent="." unique_id=992183367 instance=ExtResource("14_1lg2m")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.3344773, 1.4398065, -0.7096845)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.3344773, 1.0492828, -0.7096845)
[node name="CookedBurger4" parent="." unique_id=1837607086 instance=ExtResource("14_1lg2m")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.30671906, 1.525444, -1.0928738)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.30671906, 1.098119, -1.0928738)
[node name="BurgerBuns2" parent="." unique_id=1210358958 instance=ExtResource("6_bktvt")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.3596323, 1.4110342, -0.22482127)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.3596323, 1.0205106, -0.22482127)
[node name="PickableObject7" parent="." unique_id=641653545 instance=ExtResource("11_npf8s")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, -1.3556751, 1.4792972, 0.28881657)
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, -1.3556751, 1.0887735, 0.28881657)
[node name="PickableObject8" parent="." unique_id=1733819363 instance=ExtResource("11_npf8s")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, -1.3422732, 1.4639391, 0.16882455)
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, -1.3422732, 1.0734154, 0.16882455)
[node name="PickableObject9" parent="." unique_id=12419746 instance=ExtResource("11_npf8s")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, -1.4639754, 1.4792972, 0.28881657)
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, -1.4639754, 1.0887735, 0.28881657)
[node name="PickableObject10" parent="." unique_id=313160217 instance=ExtResource("11_npf8s")]
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, -1.4505737, 1.4639391, 0.16882455)
transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, -5.293956e-23, -2.6077032e-08, 1.4901161e-08, 1, -1.4505737, 1.0734154, 0.16882455)
[node name="Counter" parent="." unique_id=1487893288 instance=ExtResource("15_yy81s")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.7124918, 0.90304357, -1.4886917)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.7124918, 0.5, -1.4886917)
[node name="Counter2" parent="." unique_id=368890752 instance=ExtResource("15_yy81s")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.7648025, 0.90304357, -0.4458799)
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.7648025, 0.5, -0.4458799)
[node name="Counter3" parent="." unique_id=1498817646 instance=ExtResource("15_yy81s")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.7648025, 0.90304357, 0.55367994)
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.7648025, 0.5, 0.55367994)
[node name="Counter4" parent="." unique_id=906748771 instance=ExtResource("15_yy81s")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.7648025, 0.90304357, 1.5539298)
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.7648025, 0.5, 1.5539298)
[node name="Hamburger3" parent="." unique_id=369573848 instance=ExtResource("10_qacki")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.7201865, 1.5329367, 0.14773655)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.7201865, 1.142413, 0.14773655)
[node name="Plate3" parent="." unique_id=2004250522 instance=ExtResource("8_l1owj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5818124, 1.499024, -0.4634577)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5818124, 1.1085004, -0.4634577)
+4 -1
View File
@@ -4,6 +4,7 @@
[ext_resource type="PackedScene" uid="uid://j5s5wus7tuhb" path="res://XROrigin.tscn" id="2_g30gi"]
[ext_resource type="Material" uid="uid://cmia50cfqxxo4" path="res://Textures/dev_material_3d.tres" id="3_75ecy"]
[ext_resource type="Sky" uid="uid://c1abtpwhdm2d5" path="res://Textures/sky/NightSkyHDRI009_16K.tres" id="5_c3xgf"]
[ext_resource type="Script" uid="uid://biu4qr3nr1eny" path="res://test/mp_test_driver.gd" id="99_mptst"]
[sub_resource type="BoxShape3D" id="BoxShape3D_vlqg6"]
size = Vector3(15, 0.1, 15)
@@ -54,7 +55,6 @@ environment = SubResource("Environment_bvwq1")
spawn_path = NodePath("../WorldContent")
[node name="PlayersSpawner" type="MultiplayerSpawner" parent="." unique_id=106645565]
_spawnable_scenes = PackedStringArray("res://Player/net_player.tscn")
spawn_path = NodePath("../Players")
[node name="StaticBody3D" type="StaticBody3D" parent="." unique_id=4404969]
@@ -74,3 +74,6 @@ shape = SubResource("BoxShape3D_arao0")
[node name="CollisionShape3D4" type="CollisionShape3D" parent="StaticBody3D" unique_id=1431367494]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 7.502467, 9.197384, -0.018813023)
shape = SubResource("BoxShape3D_arao0")
[node name="TestDriver" type="Node" parent="."]
script = ExtResource("99_mptst")
+77 -42
View File
@@ -1,20 +1,26 @@
extends Node3D
## World script for the multiplayer scene. Consumes the host/join request set
## by the main menu, spawns the world's stations/items on whichever machine
## owns the world (server, or the local player when offline), spawns/despawns
## a player avatar per connected peer, and returns to the menu if the session
## ends.
## World script for the multiplayer scene. Starts the host/join the menu asked
## for, turns the authored kitchen into replicated objects, gives every connected
## peer an avatar, and returns to the menu when the session ends.
##
## The world's actual content (stations, items) is NOT baked into this scene
## it's spawned at runtime from Net/world_layout.gd via NetworkManager, so a
## joining client receives it from the server (MultiplayerSpawner replays
## existing spawns to late joiners) instead of relying on its own local copy
## matching.
## The world's contents are NOT left baked into the scene file. Whatever the
## scene authors is treated as a template: the server spawns real copies of it
## through NetWorld and every peer drops its own authored originals. A client
## therefore shows the server's world rather than assuming its local copy of the
## scene matches — which is also exactly the path a player joining mid-session
## takes.
const PLAYER_SCENE := preload("res://Player/net_player.tscn")
const PLAYER_SCENE := "res://Player/net_player.tscn"
## Whether to build the full kitchen on the machine that owns the world. The real
## game scene wants this; focused debug scenes bake their own handful of objects
## and turn it off, so the thing under test is not sharing the world with a
## second copy of the whole kitchen.
@export var populate_from_layout: bool = true
var xr_interface: XRInterface
var _net_world: NetWorld
var _populated := false
@@ -24,34 +30,38 @@ func _ready() -> void:
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_DISABLED)
get_viewport().use_xr = true
NetworkManager.register_world(self, $PlayersSpawner, $ItemsSpawner)
# Both roots go through the same generic replication hook, so a player avatar
# is just another replicated object — nothing about it is special-cased.
_net_world = NetWorld.new()
_net_world.name = "NetWorld"
add_child(_net_world)
_net_world.setup($ItemsSpawner, $WorldContent)
$PlayersSpawner.add_spawnable_scene(PLAYER_SCENE)
$Players.child_entered_tree.connect(_on_player_entered)
NetworkManager.register_world(self, _net_world)
NetworkManager.player_joined.connect(_on_player_joined)
NetworkManager.player_left.connect(_on_player_left)
NetworkManager.session_started.connect(_on_session_started)
NetworkManager.session_ended.connect(_on_session_ended)
NetworkManager.connection_failed.connect(_on_connection_failed)
# world_ready() is what actually calls host()/join() (or the cmdline
# equivalent). Populating before this point is wrong for EVERY case, not
# world_ready() is what actually calls host()/join() (or the command-line
# equivalent). Populating before this point would be wrong for every case, not
# just offline: is_online() is still false until host()/join() runs, so
# owns_world() would read true for a joining client too, and it would
# build its own local copy instead of receiving the server's via the
# spawner. host() emits session_started synchronously, which populates
# via _on_session_started below; the explicit call after world_ready()
# only matters for the case where neither host() nor join() ran (no
# pending session, no cmdline args) — running this scene directly offline.
# owns_world() reads true for a joining client too and it would build its own
# copy instead of receiving the server's. host() emits session_started
# synchronously, which populates via _on_session_started; the call after
# world_ready() only covers the case where neither ran — this scene opened
# directly, offline.
NetworkManager.world_ready()
_populate_world_if_owner()
get_tree().create_timer(3.0).timeout.connect(_log_world_state)
# Temporary-ish sanity check: confirms WorldContent actually ended up
# populated on this peer (whether by spawning it or by receiving it via
# replication), so a silent replication failure shows up in the net log
# instead of just an empty-looking world.
func _log_world_state() -> void:
NetworkManager.log_line("World state: WorldContent=%d children, Players=%d children" % [$WorldContent.get_child_count(), $Players.get_child_count()])
func _on_player_entered(node: Node) -> void:
if node is MultiplayerSynchronizer:
return
NetReplication.attach(node)
func _exit_tree() -> void:
@@ -62,32 +72,57 @@ func _on_session_started(_is_server: bool) -> void:
_populate_world_if_owner()
## Spawns the world's stations/items exactly once, on the machine that owns
## world logic (server or offline). Safe to call multiple times/entry points.
## Turns the authored template into replicated objects, exactly once, on the
## machine that owns world logic. Safe to call from several entry points.
func _populate_world_if_owner() -> void:
if not NetworkManager.owns_world() or _populated:
if _populated or not populate_from_layout:
return
# WorldLayout reads the live scene tree to find what to replicate, so it has
# to be an instance sitting in that tree.
var layout := WorldLayout.new()
add_child(layout)
var authored := layout.get_authored_nodes()
# Every peer drops its authored copies. The client would otherwise show its
# local originals on top of the server's replicated ones, and the two sets
# would drift apart because only the server's are synced.
if not NetworkManager.owns_world():
NetworkManager.log_line("Clearing %d authored nodes; the server's copies replace them" % authored.size())
_remove_authored(authored)
layout.queue_free()
return
_populated = true
GameManager.meals_in_play = ["hamburger"]
var stations := WorldLayout.get_stations()
var items := WorldLayout.get_items()
NetworkManager.log_line("Populating world: %d stations, %d items" % [stations.size(), items.size()])
for d in stations:
NetworkManager.spawn_item(d["scene"], d["xform"], d["name"], d["props"])
for d in items:
var objects := layout.describe(authored)
layout.queue_free()
_remove_authored(authored)
NetworkManager.log_line("Populating world: %d objects" % objects.size())
for d in objects:
NetworkManager.spawn_item(d["scene"], d["xform"], d["name"], d["props"])
NetworkManager.log_line("World populated")
## Only the server (or the single offline machine) materialises player
## avatars; MultiplayerSpawner replicates the result to everyone else,
## including late joiners.
# Freed immediately rather than queue_free()d, so the names are released before
# the replicated copies are spawned under the same ones.
func _remove_authored(nodes: Array[Node]) -> void:
for node in nodes:
if is_instance_valid(node):
node.get_parent().remove_child(node)
node.free()
## Only the server (or the single offline machine) creates avatars;
## MultiplayerSpawner replicates the result to everyone else, late joiners
## included.
func _on_player_joined(peer_id: int) -> void:
if not NetworkManager.owns_world() or $Players.has_node(str(peer_id)):
return
var p := PLAYER_SCENE.instantiate()
var p: Node = load(PLAYER_SCENE).instantiate()
# The name is the peer id, which is how net_player.gd knows whose avatar it
# is on every peer — MultiplayerSpawner replicates the name.
p.name = str(peer_id)
$Players.add_child(p, true)
$Players.add_child(p)
NetworkManager.log_line("Spawned avatar for peer %d" % peer_id)
+84
View File
@@ -0,0 +1,84 @@
[gd_scene format=3 uid="uid://dbgu4r127ke5v"]
[ext_resource type="Script" uid="uid://b4ldkd3ngs0vp" path="res://main.gd" id="1_1ymas"]
[ext_resource type="Sky" uid="uid://c1abtpwhdm2d5" path="res://Textures/sky/NightSkyHDRI009_16K.tres" id="2_1jq86"]
[ext_resource type="PackedScene" uid="uid://j5s5wus7tuhb" path="res://XROrigin.tscn" id="3_bryd6"]
[ext_resource type="Material" uid="uid://cmia50cfqxxo4" path="res://Textures/dev_material_3d.tres" id="4_kpgm6"]
[ext_resource type="PackedScene" uid="uid://j7caslh27nor" path="res://Stations/Hob.tscn" id="5_gfdi7"]
[ext_resource type="PackedScene" uid="uid://dvrk268s7gkxh" path="res://Stations/sink.tscn" id="6_fmmg3"]
[ext_resource type="PackedScene" uid="uid://efaec6ymgabo" path="res://Stations/Counter.tscn" id="7_jnxsa"]
[ext_resource type="PackedScene" uid="uid://e4i6o5oriecx" path="res://Items/PickupCube.tscn" id="8_xl5nn"]
[sub_resource type="Environment" id="Environment_bvwq1"]
background_mode = 2
sky = ExtResource("2_1jq86")
ambient_light_source = 3
ambient_light_color = Color(1, 1, 1, 1)
ambient_light_sky_contribution = 0.9
reflected_light_source = 2
ssr_enabled = true
ssao_enabled = true
ssil_enabled = true
sdfgi_enabled = true
[sub_resource type="BoxShape3D" id="BoxShape3D_vlqg6"]
size = Vector3(20, 0.1, 20)
[sub_resource type="BoxMesh" id="BoxMesh_24d3s"]
material = ExtResource("4_kpgm6")
size = Vector3(20, 0.1, 20)
[sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"]
size = Vector3(20, 10, 0.1)
[node name="Main" type="Node3D" unique_id=1312265607]
script = ExtResource("1_1ymas")
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1177077250]
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, 0)
[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)
[node name="Floor" type="StaticBody3D" parent="." unique_id=122279514]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor" unique_id=958841648]
shape = SubResource("BoxShape3D_vlqg6")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Floor/CollisionShape3D" unique_id=1939997056]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00018164515, 0.0006352663, -0.002532661)
mesh = SubResource("BoxMesh_24d3s")
[node name="InvisibleWalls" type="StaticBody3D" parent="." unique_id=315740174]
[node name="CollisionShape3D" type="CollisionShape3D" parent="InvisibleWalls" unique_id=33059670]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.688614, 8.838269)
shape = SubResource("BoxShape3D_24d3s")
[node name="CollisionShape3D2" type="CollisionShape3D" parent="InvisibleWalls" unique_id=2018792171]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.688614, -10.243342)
shape = SubResource("BoxShape3D_24d3s")
[node name="CollisionShape3D3" type="CollisionShape3D" parent="InvisibleWalls" unique_id=757662929]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -9.807113, 4.688614, -0.018813243)
shape = SubResource("BoxShape3D_24d3s")
[node name="CollisionShape3D4" type="CollisionShape3D" parent="InvisibleWalls" unique_id=1468386997]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 9.934778, 4.297072, -0.018813023)
shape = SubResource("BoxShape3D_24d3s")
[node name="Hob" parent="." unique_id=1687971542 instance=ExtResource("5_gfdi7")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.35077858, 0.50655985, -1.2833805)
[node name="Sink" parent="." unique_id=2055277359 instance=ExtResource("6_fmmg3")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.24685252, 0.51461196, -1.2828919)
[node name="Counter" parent="." unique_id=1487893288 instance=ExtResource("7_jnxsa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.94890714, 0.5115015, -1.3041471)
[node name="PickableObject" parent="." unique_id=1675596942 instance=ExtResource("8_xl5nn")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.87560004, 1.5534955, -1.2869046)
+62
View File
@@ -0,0 +1,62 @@
extends Node
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
print(get_stations())
print(get_items())
func get_node_data(node):
# {"scene": "res://Stations/Hob.tscn", "name": "Hob",
# "xform": Transform3D(Basis(), Vector3(0.29336345, 0.8981018, -1.484)), "props": {}},
var data = {}
data["scene"] = node.scene_file_path
data["name"] = node.name
data["xform"] = node.transform
data["props"] = {}
var scrip = node.get_script()
if scrip:
for i in scrip.get_script_property_list():
if i.usage & PROPERTY_USAGE_STORAGE:
data["props"][i["name"]] = node.get(i["name"])
return data
func get_stations() -> Array[Dictionary]:
var Stations = ResourceLoader.list_directory("res://Stations/")
var Stations2 = []
for i in Stations:
Stations2.append("res://Stations/" + i)
Stations = Stations2
var Stations_nodes = []
for i in get_tree().root.find_children("*", "StaticBody3D", true, false):
if i.scene_file_path in Stations:
Stations_nodes.append(i)
var data: Array[Dictionary] = []
for i in Stations_nodes:
data.append(get_node_data(i))
return data
func get_items() -> Array[Dictionary]:
var Items = ResourceLoader.list_directory("res://Items/")
var Items2 = []
for i in Items:
Items2.append("res://Items/" + i)
Items = Items2
var Items_nodes = []
for i in get_tree().root.find_children("*", "XRToolsPickable", true, false):
if i.scene_file_path in Items:
Items_nodes.append(i)
var data: Array[Dictionary] = []
for i in Items_nodes:
data.append(get_node_data(i))
return data
+1
View File
@@ -0,0 +1 @@
uid://k8ywnvlhcic4
+4
View File
@@ -0,0 +1,4 @@
extends Node
signal game_over
signal restart_game
+1
View File
@@ -0,0 +1 @@
uid://fuux6cxfjwdc
Binary file not shown.
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://mmasxwqyqmib"
path="res://.godot/imported/220175__gameaudio__pop-click.wav-1330523e09eacb15d341a14b80e4481e.sample"
[deps]
source_file="res://Sounds/220175__gameaudio__pop-click.wav"
dest_files=["res://.godot/imported/220175__gameaudio__pop-click.wav-1330523e09eacb15d341a14b80e4481e.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
Binary file not shown.
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://ecva70pect61"
path="res://.godot/imported/220178__gameaudio__click.wav-ca46bf33c1c48e1e526f04c43ca7d450.sample"
[deps]
source_file="res://Sounds/220178__gameaudio__click.wav"
dest_files=["res://.godot/imported/220178__gameaudio__click.wav-ca46bf33c1c48e1e526f04c43ca7d450.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
Binary file not shown.
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://b3wxawyrvuc6s"
path="res://.godot/imported/220179__gameaudio__click-metal-ting.wav-b01c457287fe42298a36c3de7c536c68.sample"
[deps]
source_file="res://Sounds/220179__gameaudio__click-metal-ting.wav"
dest_files=["res://.godot/imported/220179__gameaudio__click-metal-ting.wav-b01c457287fe42298a36c3de7c536c68.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
Binary file not shown.
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://b7sr2sb1ks5en"
path="res://.godot/imported/220180__gameaudio__click-pop.wav-9e467150046193d705dd830885c89cd1.sample"
[deps]
source_file="res://Sounds/220180__gameaudio__click-pop.wav"
dest_files=["res://.godot/imported/220180__gameaudio__click-pop.wav-9e467150046193d705dd830885c89cd1.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
Binary file not shown.
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://1ccsqbju32ey"
path="res://.godot/imported/220187__gameaudio__loosedeny-casual-1.wav-cb0e560d42c6026ded2d2e240e614433.sample"
[deps]
source_file="res://Sounds/220187__gameaudio__loosedeny-casual-1.wav"
dest_files=["res://.godot/imported/220187__gameaudio__loosedeny-casual-1.wav-cb0e560d42c6026ded2d2e240e614433.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
Binary file not shown.
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bdnsgt7xt3261"
path="res://.godot/imported/220194__gameaudio__click-heavy.wav-aca40ed286d93eb365d527a162fd3129.sample"
[deps]
source_file="res://Sounds/220194__gameaudio__click-heavy.wav"
dest_files=["res://.godot/imported/220194__gameaudio__click-heavy.wav-aca40ed286d93eb365d527a162fd3129.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
Binary file not shown.
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://daiv8ubwdbidf"
path="res://.godot/imported/220195__gameaudio__click-wooden-1.wav-9368ef861eabf2cf1d5bd0db33c616c8.sample"
[deps]
source_file="res://Sounds/220195__gameaudio__click-wooden-1.wav"
dest_files=["res://.godot/imported/220195__gameaudio__click-wooden-1.wav-9368ef861eabf2cf1d5bd0db33c616c8.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
Binary file not shown.
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://qed775b4j1gg"
path="res://.godot/imported/220196__gameaudio__click-wooden-2.wav-45bb63efefaf817b60155beec9343d74.sample"
[deps]
source_file="res://Sounds/220196__gameaudio__click-wooden-2.wav"
dest_files=["res://.godot/imported/220196__gameaudio__click-wooden-2.wav-45bb63efefaf817b60155beec9343d74.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
Binary file not shown.
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bqtk1adk8umbx"
path="res://.godot/imported/220197__gameaudio__click-basic.wav-9f173e2b7206278e95710ab077d62c32.sample"
[deps]
source_file="res://Sounds/220197__gameaudio__click-basic.wav"
dest_files=["res://.godot/imported/220197__gameaudio__click-basic.wav-9f173e2b7206278e95710ab077d62c32.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
Binary file not shown.
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://ysgfx76jkx2q"
path="res://.godot/imported/220198__gameaudio__click-with-two-parts.wav-089977567529b37b0fd9cd019eb7b3c2.sample"
[deps]
source_file="res://Sounds/220198__gameaudio__click-with-two-parts.wav"
dest_files=["res://.godot/imported/220198__gameaudio__click-with-two-parts.wav-089977567529b37b0fd9cd019eb7b3c2.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
Binary file not shown.
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dtyh22ccebiv5"
path="res://.godot/imported/220199__gameaudio__click-higher.wav-d1c1550d99a0cc873012c4010877005b.sample"
[deps]
source_file="res://Sounds/220199__gameaudio__click-higher.wav"
dest_files=["res://.godot/imported/220199__gameaudio__click-higher.wav-d1c1550d99a0cc873012c4010877005b.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
Binary file not shown.
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cywjbbeintjew"
path="res://.godot/imported/220208__gameaudio__click-pop-two-part.wav-04cb5eb3e0b3459771dbab42bbd24be9.sample"
[deps]
source_file="res://Sounds/220208__gameaudio__click-pop-two-part.wav"
dest_files=["res://.godot/imported/220208__gameaudio__click-pop-two-part.wav-04cb5eb3e0b3459771dbab42bbd24be9.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
Binary file not shown.
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://claw3d2wnyr6a"
path="res://.godot/imported/220212__gameaudio__ping-bing.wav-2a1049829e71a0034c7e8d18745663f1.sample"
[deps]
source_file="res://Sounds/220212__gameaudio__ping-bing.wav"
dest_files=["res://.godot/imported/220212__gameaudio__ping-bing.wav-2a1049829e71a0034c7e8d18745663f1.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
BIN
View File
Binary file not shown.
+19
View File
@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://clkjwcawdqvta"
path="res://.godot/imported/money.mp3-95c717b8402507d80974f4f4287b0b63.mp3str"
[deps]
source_file="res://Sounds/money.mp3"
dest_files=["res://.godot/imported/money.mp3-95c717b8402507d80974f4f4287b0b63.mp3str"]
[params]
loop=false
loop_offset=0.0
bpm=0.0
beat_count=0
bar_beats=4
+8 -4
View File
@@ -3,11 +3,13 @@
[ext_resource type="Script" uid="uid://0y6wnjcsum6" path="res://Stations/item_dispenser.gd" id="1_myl3s"]
[ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="1_p30r1"]
[ext_resource type="PackedScene" uid="uid://c0lknik4noobs" path="res://Items/BurgerBuns.tscn" id="2_1q74o"]
[ext_resource type="PackedScene" uid="uid://mpapt5mkbuao" path="res://Prefabs/slide_off_dome.tscn" id="4_rf1b2"]
[sub_resource type="SphereShape3D" id="SphereShape3D_xmbo2"]
radius = 0.3
[sub_resource type="CylinderShape3D" id="CylinderShape3D_24d3s"]
radius = 0.3
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_vlqg6"]
albedo_color = Color(0.6784191, 0.54546416, 0.016760282, 1)
@@ -30,14 +32,16 @@ shape = SubResource("SphereShape3D_xmbo2")
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1470079357]
shape = SubResource("CylinderShape3D_24d3s")
[node name="SlideOffDome" parent="." unique_id=1427609426 instance=ExtResource("4_rf1b2")]
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="." unique_id=1746426494]
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=858311379]
radius = 0.4
radius = 0.3
sides = 32
[node name="CSGCombiner3DBuns" type="CSGCombiner3D" parent="CSGCombiner3D" unique_id=1459017790]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.108142376, 1.0341886, -0.19146484)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.16038476, 1.0341886, -0.09012994)
autosmooth = true
smoothing_angle = 138.9
@@ -118,7 +122,7 @@ cone = true
material = SubResource("StandardMaterial3D_vlqg6")
[node name="CSGCombiner3DBuns4" type="CSGCombiner3D" parent="CSGCombiner3D" unique_id=2055085730]
transform = Transform3D(0.95670986, 0, 0.29104328, 0, 1, 0, -0.29104328, 0, 0.95670986, -0.14758292, 1.0341886, -0.1304872)
transform = Transform3D(0.95670986, 0, 0.29104328, 0, 1, 0, -0.29104328, 0, 0.95670986, -0.08665481, 1.0341886, -0.10344604)
autosmooth = true
smoothing_angle = 138.9
@@ -145,7 +149,7 @@ cone = true
material = SubResource("StandardMaterial3D_vlqg6")
[node name="CSGCombiner3DBuns5" type="CSGCombiner3D" parent="CSGCombiner3D" unique_id=546748728]
transform = Transform3D(0.20608562, 0, -0.978534, 0, 1, 0, 0.978534, 0, 0.20608562, -0.082762055, 1.0341886, 0.2722176)
transform = Transform3D(0.20608562, 0, -0.978534, 0, 1, 0, 0.978534, 0, 0.20608562, -0.047733016, 1.0341886, 0.19433105)
autosmooth = true
smoothing_angle = 138.9
+41 -25
View File
@@ -1,74 +1,90 @@
[gd_scene format=3 uid="uid://efaec6ymgabo"]
[ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="1_dlkho"]
[ext_resource type="AudioStream" uid="uid://bqtk1adk8umbx" path="res://Sounds/220197__gameaudio__click-basic.wav" id="2_0aadn"]
[sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"]
size = Vector3(0.6, 1, 0.6)
[sub_resource type="SphereShape3D" id="SphereShape3D_dlkho"]
radius = 0.3
[sub_resource type="BoxShape3D" id="BoxShape3D_1ntq7"]
size = Vector3(0.6, 0.12802735, 0.6)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_24d3s"]
albedo_color = Color(0.49, 0.3854667, 0.29400003, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pt8vn"]
albedo_color = Color(0.66595805, 0.53976387, 0.4331022, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_vlqg6"]
albedo_color = Color(1.1759251, 0.741115, 0.5692133, 1)
[node name="Counter" type="StaticBody3D" unique_id=1487893288 groups=["station"]]
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=692568688]
[node name="CollisionShape3DCuttingBoard" type="CollisionShape3D" parent="." unique_id=706340473]
shape = SubResource("BoxShape3D_24d3s")
[node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=1647380272 groups=["station"]]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5608841, 0)
collision_layer = 65536
collision_mask = 65536
collision_mask = 65540
script = ExtResource("1_dlkho")
stash_sound = ExtResource("2_0aadn")
snap_mode = 1
metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
[node name="CollisionShape3D2" type="CollisionShape3D" parent="XRToolsSnapZone" unique_id=969340130]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.000975132, 0)
shape = SubResource("SphereShape3D_dlkho")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.002, 0)
shape = SubResource("BoxShape3D_1ntq7")
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="XRToolsSnapZone" unique_id=1786831079]
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="." unique_id=451757283]
use_collision = true
[node name="CSGBox3D" type="CSGBox3D" parent="CSGCombiner3D" unique_id=305755330]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.045776367, 0)
size = Vector3(1, 0.90844727, 1)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.046, -0.025)
size = Vector3(0.6, 0.908, 0.55)
material = SubResource("StandardMaterial3D_24d3s")
[node name="CSGBox3D7" type="CSGBox3D" parent="CSGCombiner3D" unique_id=1086568272]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.39999902, 0.22965088)
operation = 2
size = Vector3(0.6, 0.22992969, 0.14069825)
material = SubResource("StandardMaterial3D_24d3s")
[node name="CSGBox3D2" type="CSGBox3D" parent="CSGCombiner3D" unique_id=43663195]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.45385742, 0.025390625)
size = Vector3(1, 0.092285156, 1.0507813)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
size = Vector3(0.6, 0.202, 0.6)
[node name="CSGBox3D3" type="CSGBox3D" parent="CSGCombiner3D" unique_id=1210567516]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5040283, -0.46044922)
size = Vector3(1, 0.19262695, 0.07910156)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5617909, 0.060281754)
operation = 2
size = Vector3(0.6, 0.12051563, 0.6402156)
[node name="CSGBox3D4" type="CSGBox3D" parent="CSGCombiner3D" unique_id=1533996708]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.25531006, -0.054498255, 0.5233302)
size = Vector3(0.48937988, 0.90844727, 0.023986816)
material = SubResource("StandardMaterial3D_24d3s")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.15, 0.08, 0.26034504)
size = Vector3(0.25, 0.6, 0.024)
material = SubResource("StandardMaterial3D_pt8vn")
[node name="CSGBox3D5" type="CSGBox3D" parent="CSGCombiner3D" unique_id=645225767]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.24944723, -0.054498255, 0.5233302)
size = Vector3(0.48937988, 0.90844727, 0.023986816)
material = SubResource("StandardMaterial3D_24d3s")
[node name="CSGBox3D5" type="CSGBox3D" parent="CSGCombiner3D" unique_id=1983709234]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.15, 0.08, 0.26034504)
size = Vector3(0.25, 0.6, 0.024)
material = SubResource("StandardMaterial3D_pt8vn")
[node name="CSGSphere3D" type="CSGSphere3D" parent="CSGCombiner3D" unique_id=1785057925]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.057649717, 0.12459713, 0.55428153)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.057649717, 0.12459713, 0.29140875)
radius = 0.025492515
[node name="CSGSphere3D2" type="CSGSphere3D" parent="CSGCombiner3D" unique_id=1224446005]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.060837455, 0.12459713, 0.55428153)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.060837455, 0.12459713, 0.29140875)
radius = 0.025492515
[node name="CSGBox3D6" type="CSGBox3D" parent="CSGCombiner3D" unique_id=187377667]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.060742255, 0.4885016, 0.0011152327)
size = Vector3(0.56365967, 0.092285156, 0.42160034)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.514, 0)
size = Vector3(0.48251343, 0.037231445, 0.42160034)
material = SubResource("StandardMaterial3D_vlqg6")
[node name="CSGBox3D6" type="CSGBox3D" parent="CSGCombiner3D/CSGBox3D6" unique_id=1146824846]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.19631815, 0.01924485, -0.0039587077)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.1899699, 0.01924485, -0.0039587095)
operation = 2
size = Vector3(0.06542969, 0.092285156, 0.26757813)
size = Vector3(0.037109375, 0.092285156, 0.26757813)
+185 -38
View File
@@ -2,41 +2,179 @@
[ext_resource type="Script" uid="uid://bsn8vhv5adxdo" path="res://Stations/hob.gd" id="1_7jc4g"]
[ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="2_er1dp"]
[ext_resource type="AudioStream" uid="uid://bqtk1adk8umbx" path="res://Sounds/220197__gameaudio__click-basic.wav" id="3_6oyg1"]
[ext_resource type="PackedScene" uid="uid://bxbocxdaayvwx" path="res://UI/progress_bar.tscn" id="3_7uuqv"]
[ext_resource type="Material" uid="uid://d1djvskv4n4m3" path="res://Textures/hob_off.tres" id="4_8qpxk"]
[ext_resource type="Material" uid="uid://db7c7w4apwti7" path="res://Textures/hob_on.tres" id="6_m7l4u"]
[sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"]
[sub_resource type="BoxShape3D" id="BoxShape3D_kdxnr"]
size = Vector3(0.6, 1, 0.6)
[sub_resource type="SphereShape3D" id="SphereShape3D_vlqg6"]
radius = 0.3
[sub_resource type="BoxShape3D" id="BoxShape3D_7uuqv"]
size = Vector3(0.6, 0.12802735, 0.6)
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_np_hob"]
properties/0/path = NodePath(".:time_cooked")
properties/0/spawn = true
properties/0/replication_mode = 1
properties/1/path = NodePath(".:cooking_result_time")
properties/1/spawn = true
properties/1/replication_mode = 1
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_gkb3v"]
[sub_resource type="Animation" id="Animation_7uuqv"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("CSGCombiner3D/CSGTorus3D3:material")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("4_8qpxk")]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("CSGCombiner3D/CSGTorus3D2:material")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("4_8qpxk")]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("CSGCombiner3D/CSGTorus3D:material")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("4_8qpxk")]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("CSGCombiner3D/CSGTorus3D3:material:emission_energy_multiplier")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("OmniLight3D:light_energy")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="Animation" id="Animation_6oyg1"]
resource_name = "hob"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("CSGCombiner3D/CSGTorus3D3:material")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("6_m7l4u")]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("CSGCombiner3D/CSGTorus3D2:material")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("6_m7l4u")]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("CSGCombiner3D/CSGTorus3D:material")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("6_m7l4u")]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("CSGCombiner3D/CSGTorus3D3:material:emission_energy_multiplier")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.5, 1),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [1.0, 0.0, 1.0]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("OmniLight3D:light_energy")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.5, 1),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [1.0, 0.0, 1.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ac5f3"]
_data = {
&"RESET": SubResource("Animation_7uuqv"),
&"hob": SubResource("Animation_6oyg1")
}
[node name="Hob" type="StaticBody3D" unique_id=1687971542 groups=["station"]]
script = ExtResource("1_7jc4g")
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1283846023]
shape = SubResource("BoxShape3D_24d3s")
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 = 65536
collision_mask = 65540
script = ExtResource("2_er1dp")
stash_sound = ExtResource("3_6oyg1")
snap_mode = 1
metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
[node name="CollisionShape3D2" type="CollisionShape3D" parent="XRToolsSnapZone" unique_id=370920392]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.000975132, 0)
shape = SubResource("SphereShape3D_vlqg6")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.000975132, 0)
shape = SubResource("BoxShape3D_7uuqv")
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="XRToolsSnapZone" unique_id=1991627595]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.022546828, -0.5270121, 0.36528283)
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="." unique_id=70901698]
[node name="CSGBox3D" type="CSGBox3D" parent="CSGCombiner3D" unique_id=1111505172]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.00894776)
size = Vector3(0.6, 1, 0.5821045)
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="CSGCombiner3D/CSGBox3D" unique_id=1338463939]
transform = Transform3D(0.8943019, 0, 0, 0, 0.8943019, 0, 0, 0, 0.8943019, 0, 0.5103538, -7.827557e-05)
@@ -50,18 +188,21 @@ transform = Transform3D(0.8943019, 0, 0, 0, 0.8943019, 0, 0, 0, 0.8943019, 0, 0.
inner_radius = 0.09153879
outer_radius = 0.120084204
sides = 32
[node name="CSGTorus3D" type="CSGTorus3D" parent="CSGCombiner3D" unique_id=1901978664]
transform = Transform3D(0.8943019, 0, 0, 0, 0.8943019, 0, 0, 0, 0.8943019, 0, 0.5003869, -7.827557e-05)
inner_radius = 0.20426142
outer_radius = 0.2321898
sides = 32
material = ExtResource("4_8qpxk")
[node name="CSGTorus3D2" type="CSGTorus3D" parent="CSGCombiner3D" unique_id=24541894]
transform = Transform3D(0.8943019, 0, 0, 0, 0.8943019, 0, 0, 0, 0.8943019, 0, 0.5003869, -7.827557e-05)
inner_radius = 0.15036294
outer_radius = 0.17592031
sides = 32
material = ExtResource("4_8qpxk")
[node name="CSGTorus3D" type="CSGTorus3D" parent="CSGCombiner3D" unique_id=1901978664]
transform = Transform3D(0.8943019, 0, 0, 0, 0.8943019, 0, 0, 0, 0.8943019, 0, 0.5003869, -7.827557e-05)
inner_radius = 0.20426142
outer_radius = 0.2321898
sides = 32
material = ExtResource("4_8qpxk")
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=1107239311]
transform = Transform3D(0.8943019, 0, 0, 0, 0.8943019, 0, 0, 0, 0.8943019, 0, 0.4498226, -7.827557e-05)
@@ -80,38 +221,44 @@ radius = 0.008
height = 0.44487303
[node name="CSGCylinder3D4" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=1619646436]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, -0.26920843, 0.42728558, 0.4856163)
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, -0.20412213, 0.42728558, 0.26171687)
radius = 0.044433594
height = 0.10932617
material = SubResource("StandardMaterial3D_gkb3v")
[node name="CSGCylinder3D5" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=1748405277]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0.1318646, 0.42728558, 0.4856163)
[node name="CSGCylinder3D5" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=548846612]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0.12531614, 0.42728558, 0.26171687)
radius = 0.044433594
height = 0.10932617
material = SubResource("StandardMaterial3D_gkb3v")
[node name="CSGCylinder3D6" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=624102144]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0.25760216, 0.42728558, 0.4856163)
[node name="CSGCylinder3D6" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=1208989647]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0.22979808, 0.42728558, 0.26171687)
radius = 0.044433594
height = 0.10932617
material = SubResource("StandardMaterial3D_gkb3v")
[node name="CSGBox3D2" type="CSGBox3D" parent="CSGCombiner3D" unique_id=465340362]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.039733887, -0.07685089, 0.47770447)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.039733887, -0.07685089, 0.29250562)
operation = 2
size = Vector3(1.0999756, 0.8462982, 0.072387695)
[node name="CSGBox3D3" type="CSGBox3D" parent="CSGCombiner3D" unique_id=1813079759]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.003479004, -0.08253479, 0.4977833)
size = Vector3(0.9842529, 0.8349304, 0.072387695)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.003479004, -0.08253479, 0.2656765)
size = Vector3(0.55, 0.835, 0.072)
[node name="CSGBox3D4" type="CSGBox3D" parent="CSGCombiner3D" unique_id=1978186019]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.003479004, -0.45215607, 0.46387827)
size = Vector3(0.9842529, 0.095687866, 0.14019775)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.003479004, -0.45215607, 0.24655426)
size = Vector3(0.55, 0.096, 0.14)
[node name="CSGBox3D5" type="CSGBox3D" parent="CSGCombiner3D" unique_id=1423530445]
transform = Transform3D(0.94465846, 0, 0, 0, 0.94465846, 0, 0, 0, 0.94465846, -0.003479004, -0.08253479, 0.5616675)
operation = 2
size = Vector3(0.9842529, 0.8349304, 0.072387695)
[node name="ProgressBar3D" parent="." unique_id=654673176 instance=ExtResource("3_7uuqv")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.74736404, -0.09216304)
[node name="Sync" type="MultiplayerSynchronizer" parent="."]
root_path = NodePath("..")
replication_config = SubResource("SceneReplicationConfig_np_hob")
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=1525460719]
libraries/ = SubResource("AnimationLibrary_ac5f3")
[node name="OmniLight3D" type="OmniLight3D" parent="." unique_id=1618457623]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5053487, 0)
light_color = Color(1, 0.13725491, 0, 1)
light_energy = 0.0
omni_range = 0.5
+4
View File
@@ -0,0 +1,4 @@
[gd_scene format=3 uid="uid://cwwnbx5uat3fw"]
[node name="CSGBox3D" type="CSGBox3D" unique_id=725518829]
+5 -5
View File
@@ -13,8 +13,8 @@ albedo_color = Color(0.45262197, 0.26770625, 0.2601587, 1)
material = SubResource("StandardMaterial3D_qn1ku")
size = Vector3(0.5, 1, 0.5)
[sub_resource type="SphereShape3D" id="SphereShape3D_dlkho"]
radius = 0.3
[sub_resource type="BoxShape3D" id="BoxShape3D_mep2a"]
size = Vector3(0.81640625, 0.5635376, 0.79351807)
[node name="DirtStation" type="StaticBody3D" unique_id=160842153 groups=["station"]]
script = ExtResource("1_hc1d4")
@@ -33,11 +33,11 @@ text = "Dirt"
[node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=333161027 groups=["station"]]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5270121, 0)
collision_layer = 65536
collision_mask = 65536
collision_mask = 65540
script = ExtResource("2_v0ytd")
snap_mode = 1
metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
[node name="CollisionShape3D2" type="CollisionShape3D" parent="XRToolsSnapZone" unique_id=1398712192]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.000975132, 0)
shape = SubResource("SphereShape3D_dlkho")
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0.008666992, -0.11009073, -0.009353638)
shape = SubResource("BoxShape3D_mep2a")
+70 -11
View File
@@ -4,14 +4,68 @@ const RECIPE_MANAGER = preload("res://RecipeManager.gd")
@export var cook_speed = 1
@onready var snap_zone: XRToolsSnapZone = $XRToolsSnapZone
@onready var progress_bar: ProgressBar3D = $ProgressBar3D
## Cooking state. All three are replicated (see Hob.tscn's Sync node) and each
## refreshes the display when it changes, which is what makes the hob look alive
## on a client: only the world owner runs the station's _process and its snap
## zone, so a client never reaches the code below by itself and would otherwise
## show a hob that never lights up.
var time_cooked: float = 0.0: set = _set_time_cooked
var cooking_result: String = "": set = _set_cooking_result
var cooking_result_time: float = 0.0: set = _set_cooking_result_time
func _set_time_cooked(value: float) -> void:
if is_equal_approx(time_cooked, value):
return
time_cooked = value
_refresh_display()
func _set_cooking_result(value: String) -> void:
if cooking_result == value:
return
cooking_result = value
_refresh_display()
# The flames follow whether we're cooking, on every peer.
_play_animation("hob" if not cooking_result.is_empty() else "RESET")
func _set_cooking_result_time(value: float) -> void:
if is_equal_approx(cooking_result_time, value):
return
cooking_result_time = value
_refresh_display()
var time_cooked = 0
var cooking_result = null
var cooking_result_time = 0
func _ready() -> void:
if not progress_bar or progress_bar is not ProgressBar3D:
push_error("Hob missing reference to progressbar, or wrong type:", progress_bar)
snap_zone.has_picked_up.connect(_on_object_picked_up)
snap_zone.has_dropped.connect(_on_object_dropped)
_refresh_display()
func _play_animation(name: String) -> void:
# Replicated setters can fire before the node is in the tree (spawn payload),
# when the @onready children don't exist yet.
var player := get_node_or_null("AnimationPlayer") as AnimationPlayer
if player:
player.play(name)
func _refresh_display() -> void:
# Guarded for the same reason as _play_animation.
if not progress_bar:
return
var progress := 0.0
if cooking_result and cooking_result_time > 0:
progress = clampf(float(time_cooked) / cooking_result_time, 0.0, 1.0)
progress_bar.set_progress(progress)
progress_bar.set_bar_visible(not cooking_result.is_empty())
progress_bar.override_fill_color(Color.RED if cooking_result == "charcoal" else Color.GREEN)
func _on_object_picked_up(_item) -> void:
print("Hob: object picked up: ", _item)
@@ -23,21 +77,23 @@ func _on_object_picked_up(_item) -> void:
return
var result = RECIPE_MANAGER.get_cooking_result(_food_item.id)
if not result:
print("Hob: held a FoodItem that is not cookable, id: ", _food_item.id)
print("Hob: held a FoodItem that is not cookable, id: %s result: %s" % [_food_item.id, result])
return
cooking_result = result
cooking_result_time = RECIPE_MANAGER.get_cooking_time(_food_item.id)
cooking_result_time = RECIPE_MANAGER.get_cooking_time(_food_item.id)
print("Hob: set cooking_result ", cooking_result)
# The setters above already refresh the display and start the flames.
func _on_object_dropped() -> void:
print("Hob: object drop ")
time_cooked = 0
cooking_result = null
cooking_result_time = 0
cooking_result = ""
cooking_result_time = 0
func convert_held_to_item(_item: PackedScene) -> void:
func convert_held_to_item(_item: String) -> void:
if not NetworkManager.owns_world():
return
print("Hob converting ", _item)
@@ -50,20 +106,23 @@ func convert_held_to_item(_item: PackedScene) -> void:
# Spawn the new item through the server so it replicates to every peer
# (including late joiners), in the old item's position.
var original_transform = old_pickable.global_transform
var new_scene_instance = NetworkManager.spawn_item(_item.resource_path, original_transform)
var new_scene_instance = NetworkManager.spawn_item(RECIPE_MANAGER.get_item_scene(_item).resource_path, original_transform)
# Drop and free the old item and pick up the new one
print("Hob freeing old_pickable ", old_pickable)
snap_zone.drop_object()
NetworkManager.despawn_item(old_pickable)
snap_zone.pick_up_object(new_scene_instance)
# If cooking something, progress cooking, when done, convert item
func _process(delta: float) -> void:
func _process(delta: float) -> void:
if cooking_result:
#print("Hob cooking_result: ", cooking_result)
time_cooked += cook_speed * delta
_refresh_display()
if time_cooked >= cooking_result_time:
time_cooked = 0
convert_held_to_item(cooking_result)
+107
View File
@@ -0,0 +1,107 @@
[gd_scene format=3 uid="uid://ck5tuftqmyiue"]
[ext_resource type="Script" uid="uid://0y6wnjcsum6" path="res://Stations/item_dispenser.gd" id="1_jm0ik"]
[ext_resource type="PackedScene" uid="uid://bp3v1jl8pctro" path="res://Containers/plate.tscn" id="2_tfo2i"]
[ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="3_lr065"]
[ext_resource type="PackedScene" uid="uid://mpapt5mkbuao" path="res://Prefabs/slide_off_dome.tscn" id="4_tfo2i"]
[sub_resource type="SphereShape3D" id="SphereShape3D_xmbo2"]
radius = 0.3
[sub_resource type="CylinderShape3D" id="CylinderShape3D_24d3s"]
radius = 0.3
[node name="PlateDispenser" type="StaticBody3D" unique_id=710538846]
script = ExtResource("1_jm0ik")
item_scene = ExtResource("2_tfo2i")
[node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=238176038]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00070536137, 1.1603245, -0.002165556)
collision_layer = 65536
collision_mask = 65536
script = ExtResource("3_lr065")
snap_mode = 1
metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
[node name="CollisionShape3D" type="CollisionShape3D" parent="XRToolsSnapZone" unique_id=1942470044]
shape = SubResource("SphereShape3D_xmbo2")
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=831688237]
shape = SubResource("CylinderShape3D_24d3s")
[node name="SlideOffDome" parent="." unique_id=1427609426 instance=ExtResource("4_tfo2i")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.061363697, 0)
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="." unique_id=696108271]
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=1339763385]
radius = 0.3
sides = 32
[node name="Plates" type="Node3D" parent="." unique_id=1364909922]
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="Plates" unique_id=2128650644]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.0289642, 0)
autosmooth = true
smoothing_angle = 103.9
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="Plates/CSGCombiner3D" unique_id=472067854]
radius = 0.2
height = 0.03
sides = 16
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="Plates/CSGCombiner3D/CSGCylinder3D" unique_id=7092994]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.010312311, 0)
operation = 2
radius = 0.15
height = 0.03
sides = 16
[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="Plates/CSGCombiner3D" unique_id=23957958]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.027119078, 0)
radius = 0.15
height = 0.02
[node name="CSGCombiner3D2" type="CSGCombiner3D" parent="Plates" unique_id=404631280]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.0762081, 0)
autosmooth = true
smoothing_angle = 103.9
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="Plates/CSGCombiner3D2" unique_id=943162425]
radius = 0.2
height = 0.03
sides = 16
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="Plates/CSGCombiner3D2/CSGCylinder3D" unique_id=218364524]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.010312311, 0)
operation = 2
radius = 0.15
height = 0.03
sides = 16
[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="Plates/CSGCombiner3D2" unique_id=1548327331]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.027119078, 0)
radius = 0.15
height = 0.02
[node name="CSGCombiner3D3" type="CSGCombiner3D" parent="Plates" unique_id=1506211353]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.1214186, 0)
autosmooth = true
smoothing_angle = 103.9
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="Plates/CSGCombiner3D3" unique_id=739830577]
radius = 0.2
height = 0.03
sides = 16
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="Plates/CSGCombiner3D3/CSGCylinder3D" unique_id=1882120753]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.010312311, 0)
operation = 2
radius = 0.15
height = 0.03
sides = 16
[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="Plates/CSGCombiner3D3" unique_id=1904629745]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.027119078, 0)
radius = 0.15
height = 0.02
+98
View File
@@ -0,0 +1,98 @@
[gd_scene format=3 uid="uid://cwnwo4i28upap"]
[ext_resource type="Script" uid="uid://0y6wnjcsum6" path="res://Stations/item_dispenser.gd" id="1_gkb3v"]
[ext_resource type="PackedScene" uid="uid://dpot5qie20vf6" path="res://Items/burger.tscn" id="2_mep2a"]
[ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="3_3xuvi"]
[ext_resource type="Texture2D" uid="uid://cexxfyw03hr81" path="res://Textures/1.png" id="4_1f5le"]
[ext_resource type="PackedScene" uid="uid://mpapt5mkbuao" path="res://Prefabs/slide_off_dome.tscn" id="5_mep2a"]
[sub_resource type="SphereShape3D" id="SphereShape3D_xmbo2"]
radius = 0.3
[sub_resource type="CylinderShape3D" id="CylinderShape3D_24d3s"]
radius = 0.3
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_di04w"]
albedo_texture = ExtResource("4_1f5le")
[node name="RawBurgerDispenser" type="StaticBody3D" unique_id=235630131]
script = ExtResource("1_gkb3v")
item_scene = ExtResource("2_mep2a")
[node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=1523586273]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00070536137, 1.0645258, -0.002165556)
collision_layer = 65536
collision_mask = 65536
script = ExtResource("3_3xuvi")
snap_mode = 1
metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
[node name="CollisionShape3D" type="CollisionShape3D" parent="XRToolsSnapZone" unique_id=2105824734]
shape = SubResource("SphereShape3D_xmbo2")
[node name="SlideOffDome" parent="." unique_id=1427609426 instance=ExtResource("5_mep2a")]
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=378049928]
shape = SubResource("CylinderShape3D_24d3s")
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="." unique_id=1275577257]
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=1973748218]
radius = 0.3
sides = 32
[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=590219609]
transform = Transform3D(1, 0, 0, 0, 0.9532462, 0.30219492, 0, -0.30219492, 0.9532462, -0.1276815, 1.0521446, -0.052202225)
radius = 0.08300781
height = 0.028435059
sides = 16
material = SubResource("StandardMaterial3D_di04w")
[node name="CSGCylinder3D3" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=177377476]
transform = Transform3D(1, 0, 0, 0, 0.9694763, 0.245185, 0, -0.245185, 0.9694763, 0.08106685, 1.0391599, -0.119440794)
radius = 0.08300781
height = 0.03
sides = 16
material = SubResource("StandardMaterial3D_di04w")
[node name="CSGCylinder3D4" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=622291452]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.19005477, 1.0198405, 0.049397707)
radius = 0.08300781
height = 0.03
sides = 16
material = SubResource("StandardMaterial3D_di04w")
[node name="CSGCylinder3D5" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=703594207]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.026051283, 1.0175319, 0.0042250156)
radius = 0.08300781
height = 0.03
sides = 16
material = SubResource("StandardMaterial3D_di04w")
[node name="CSGCylinder3D6" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=955808722]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.05739355, 1.0197641, 0.13219571)
radius = 0.08300781
height = 0.03
sides = 16
material = SubResource("StandardMaterial3D_di04w")
[node name="CSGCylinder3D7" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=1066788957]
transform = Transform3D(0.9111114, 0.40515354, 0.075673, -0.41123694, 0.8813372, 0.2326565, 0.027568169, -0.24309555, 0.9696106, 0.14799988, 1.0345665, 0.11710405)
radius = 0.08300781
height = 0.03
sides = 16
material = SubResource("StandardMaterial3D_di04w")
[node name="CSGCylinder3D8" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=553053058]
transform = Transform3D(0.9541017, 0.29948288, 0, -0.29948288, 0.9541017, 0, 0, 0, 1, 0.041060925, 1.0337045, 0.18304396)
radius = 0.08300781
height = 0.03
sides = 16
material = SubResource("StandardMaterial3D_di04w")
[node name="CSGCylinder3D9" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=980376661]
transform = Transform3D(0.8510151, 0.22759955, 0.47325662, -0.16729629, 0.97174567, -0.16649997, -0.49778044, 0.06251989, 0.8650468, 0.2036674, 1.0335208, -0.024382353)
radius = 0.08300781
height = 0.03
sides = 16
material = SubResource("StandardMaterial3D_di04w")
+82 -28
View File
@@ -1,40 +1,94 @@
extends StaticBody3D
const plate_wash_time: float = 3.0
@export var plate_scene : PackedScene
@export_range(0.0, 10.0, 0.1) var wash_speed: float = 1.0
@onready var snap_zone: XRToolsSnapZone = $XRToolsSnapZone
@onready var progress_bar: ProgressBar3D = $ProgressBar3D
var progress: float = 0.0
## Washing state. Both are replicated (see sink.tscn's Sync node) and refresh the
## display when they change. Only the world owner runs this station's _process
## and snap zone, so without this a client never updates its bar — it stayed
## frozen on screen long after the plate came out clean.
var time_washed: float = 0.0: set = _set_time_washed
var is_washing: bool = false: set = _set_is_washing
var plate: PlateController = null
func _set_time_washed(value: float) -> void:
if is_equal_approx(time_washed, value):
return
time_washed = value
_refresh_progress_bar()
func _set_is_washing(value: bool) -> void:
if is_washing == value:
return
is_washing = value
_refresh_progress_bar()
_set_effects_playing(is_washing)
# Water, bubbles and the animation follow the washing state on every peer, not
# just the one running the logic.
func _set_effects_playing(playing: bool) -> void:
var player := get_node_or_null("AnimationPlayer") as AnimationPlayer
if player:
player.play("working" if playing else "RESET")
for effect in ["water", "bubbles", "GPUParticles3D"]:
var node := get_node_or_null(effect) as Node3D
if node:
node.visible = playing
func _ready() -> void:
if not plate_scene:
push_error("Sink is missing reference to plate scene")
if not progress_bar or progress_bar is not ProgressBar3D:
push_error("Sink missing reference to progressbar, or wrong type:", progress_bar)
snap_zone.has_picked_up.connect(_on_object_picked_up)
snap_zone.has_dropped.connect(_on_object_dropped)
progress_bar.override_fill_color(Color.DODGER_BLUE)
_refresh_progress_bar()
func _refresh_progress_bar() -> void:
if not progress_bar:
return
progress_bar.set_progress(clampf(float(time_washed) / plate_wash_time, 0.0, 1.0))
progress_bar.set_bar_visible(is_washing)
func _on_object_picked_up(_item) -> void:
print("Sink: object picked up: ", _item)
plate = _item.get_node_or_null("PlateController") as PlateController
if plate:
# The setter starts the effects and shows the bar, here and on clients.
is_washing = plate.is_dirty
func _on_object_dropped() -> void:
print("Sink: object drop ")
_reset_sink()
func _reset_sink():
time_washed = 0
is_washing = false
plate = null
func complete_washing():
if not plate:
return
plate.is_dirty = false
_reset_sink()
print("Sink washing complete!")
func _process(delta: float) -> void:
var item = snap_zone.picked_up_object
if not item:
progress = 0
return # Exit early since there's nothing to process
if is_washing:
time_washed += wash_speed * delta
_refresh_progress_bar()
print("Sink washing plate: ", time_washed)
var plate: PlateController = item.get_node_or_null("PlateController") as PlateController
if plate:
# Not dirty? Nothing to wash
if not plate.is_dirty:
return
# Washing logic using the encapsulated property
if progress >= plate_wash_time:
plate.is_dirty = false # This automatically updates visibility and the container state!
print("Sink washing complete!")
else:
progress += wash_speed * delta
print("Sink washing plate: ", progress)
# Sink empty, reset progress
if not snap_zone.picked_up_object:
progress = 0
if time_washed >= plate_wash_time:
complete_washing()
+222 -40
View File
File diff suppressed because one or more lines are too long
+119 -48
View File
@@ -3,17 +3,19 @@ extends StaticBody3D
const GAME_MANAGER = preload("res://GameManager.gd")
@export var initial_thinking_time: float = 6
@export var initial_primary_time: float = 60
@export var initial_friend_time: float = 10
@export var initial_eating_time: float = 4
@export var thinking_duration: float = 3.0
@export var primary_duration: float = 60.0
@export var friend_duration: float = 10.0
@export var eating_duration: float = 4.0
@export var money_sound: AudioStream
@onready var label_3d: Label3D = $Label3D
@onready var label_3d_time: Label3D = $Label3DTime
@onready var snap_zones: Array[XRToolsSnapZone] = []
@onready var progress_bar: ProgressBar3D = $ProgressBar3D
@onready var audio_player: AudioStreamPlayer3D = $AudioStreamPlayer3D
const lbl_thinking: String = "Thinking..."
const lbl_waiting_primary: String = "Waiting for food"
const lbl_thinking: String = "Thinking"
const lbl_gameover: String = "Game Over!"
const lbl_eating: String = "Eating..."
@@ -27,22 +29,37 @@ enum TableState {
EATING
}
## State is server-authoritative and synced (see table.tscn's Sync node);
## 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.
var _state: TableState = TableState.EMPTY: set = _set_state
var _state_time: float = 0.0: set = _set_state_time
var _unsatisfied_orders: Array[String] = []: set = _set_unsatisfied_orders
## State is server-authoritative and replicated. Transitions only ever run where
## NetworkManager.owns_world() is true — the whole station's _process is gated
## off for non-owners (NetWorld._gate) — and the setters below just refresh the
## display, so the server (via _setState) and clients (via incoming sync) show
## the same thing. Use _setState(), never assign `state` directly.
##
## These are deliberately not underscore-prefixed: that prefix is what marks a
## variable as private and unreplicated (see NetReplication), and this is exactly
## the state that has to reach every peer. state_duration is replicated for the
## same reason — the progress bar divides by it, and on a client that never ran a
## transition it would otherwise still be zero.
var state: TableState = TableState.EMPTY: set = _set_state
var state_time: float = 0.0: set = _set_state_time
var state_duration: float = 0.0 # set in _setState alongside state_time
var unsatisfied_orders: Array[String] = []: set = _set_unsatisfied_orders
func _ready() -> void:
if not label_3d:
push_error("Table is missing reference to Label3D")
if not label_3d_time:
push_error("Table is missing reference to Label3DTime")
if not progress_bar or progress_bar is not ProgressBar3D:
push_error("Table missing reference to progressbar, or wrong type:", progress_bar)
progress_bar.y_billboard = true
# Render whatever state already arrived from the server before we were in
# the tree (see the guard in _refresh_display).
_refresh_display.call_deferred()
if not audio_player:
push_error("Table is missing reference to AudioStreamPlayer3D")
# Get snap_zones for plates, store in array snap_zones
for child in get_children():
var snap_zone_node = child as XRToolsSnapZone
@@ -56,15 +73,17 @@ func _ready() -> void:
for snap_zone_node in snap_zones:
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)
func _on_object_picked_up(_item) -> void:
print("Table: object picked up: ", _item)
if state == TableState.EATING:
return
_absorb_item_if_correct(_item)
func _on_object_dropped() -> void:
print("Table: object dropped ")
@@ -84,26 +103,40 @@ func _absorb_item_if_correct(_item: Node) -> void:
# Absorm items from the plate we want
for food_item in plate.container.contained_items:
print("Table: held a plate with FoodItem: ", food_item.id)
if food_item.id in _unsatisfied_orders:
if food_item.id in unsatisfied_orders:
print("Table: held FoodItem is in unsatisfied orders, removing it")
_unsatisfied_orders.erase(food_item.id)
GAME_MANAGER.money += food_item.sell_value
_setState(TableState.WAITING_FRIEND)
# Reassign rather than mutate in place. This property has a setter that
# refreshes the label, and mutating an array never fires it — so the
# peer that actually served the food would be the one peer whose table
# still showed the order outstanding. duplicate() also preserves the
# Array[String] typing the property requires.
var remaining := unsatisfied_orders.duplicate()
remaining.erase(food_item.id)
unsatisfied_orders = remaining
if unsatisfied_orders.size() > 0 and state != TableState.EATING:
_setState(TableState.WAITING_FRIEND)
# Table has everything it wants. Start eating
if _unsatisfied_orders.is_empty():
_setState(TableState.EATING)
# Table has everything it wants. Start eating
elif unsatisfied_orders.is_empty() and state != TableState.EATING:
GAME_MANAGER.money += food_item.sell_value
audio_player.stream = money_sound
audio_player.play()
_setState(TableState.EATING)
func place_order() -> void:
print("Table: place_order()")
_unsatisfied_orders.append(GAME_MANAGER.get_random_meal())
_unsatisfied_orders.append(GAME_MANAGER.get_random_meal())
var new_orders = unsatisfied_orders.duplicate()
new_orders.append(GAME_MANAGER.get_random_meal())
new_orders.append(GAME_MANAGER.get_random_meal())
_set_unsatisfied_orders(new_orders)
func satisfyAllOrders() -> void:
print("Table: satisfyAllOrders()")
_unsatisfied_orders.clear()
# Assigned, not cleared in place, for the same reason as in
# _absorb_item_if_correct: clear() would not fire the setter.
unsatisfied_orders = []
clearAllPlates()
_setState(TableState.EMPTY)
@@ -120,81 +153,119 @@ func clearAllPlates() -> void:
plate.container.clear()
plate.is_dirty = true
func _set_snap_zones_enabled(value: bool) -> void:
for zone in snap_zones:
zone.enabled = value
## Server-only state transition: sets the new state's timer and assigns
## _state (whose setter refreshes the display on every peer).
## state (whose setter refreshes the display on every peer).
func _setState(newState: TableState) -> void:
print("Table set _state: ", TableState.keys()[newState])
print("Table set state: ", TableState.keys()[newState])
match newState:
TableState.EMPTY:
_state_time = 0.0
state_time = 5.0
state_duration = 5.0
TableState.THINKING:
_state_time = initial_eating_time
state_time = thinking_duration
state_duration = thinking_duration # Can't be done in _set_state(), will set duration inside timer
TableState.WAITING_PRIMARY:
_state_time = initial_primary_time
state_time = primary_duration
state_duration = primary_duration
TableState.WAITING_FRIEND:
_state_time = initial_friend_time
state_time = friend_duration
state_duration = friend_duration
TableState.EATING:
_state_time = initial_eating_time
state_time = eating_duration
state_duration = eating_duration
_set_snap_zones_enabled(false)
_state = newState
state = newState
## Pure presentation, driven off the current (locally authoritative or
## synced-from-server) state. Runs on every peer.
func _refresh_display() -> void:
if not label_3d:
# state, state_time and unsatisfied_orders are replicated with spawn=true,
# and MultiplayerSpawner applies a spawn payload BEFORE the node enters the
# tree — so these setters fire while the @onready children below are still
# null. Bail out until _ready() has resolved them; _ready() calls back in
# once it has, so nothing that arrived early is lost.
if not progress_bar or not label_3d or not label_3d_time:
return
match _state:
match state:
TableState.EMPTY:
progress_bar.set_bar_visible(false)
label_3d.text = "empty"
TableState.THINKING:
progress_bar.set_bar_visible(false)
label_3d.text = lbl_thinking
TableState.WAITING_PRIMARY, TableState.WAITING_FRIEND:
label_3d.text = "%s\n%s" % [TableState.keys()[_state], "\n".join(_unsatisfied_orders)]
TableState.WAITING_PRIMARY:
label_3d.text = "%s\n%s" % [TableState.keys()[state], "\n".join(unsatisfied_orders)]
progress_bar.set_bar_visible(true)
progress_bar.override_fill_color(Color.RED if state_time < 10 else Color.YELLOW)
TableState.WAITING_FRIEND:
label_3d.text = "%s\n%s" % [TableState.keys()[state], "\n".join(unsatisfied_orders)]
progress_bar.set_bar_visible(true)
progress_bar.override_fill_color(Color.RED if state_time < 5 else Color.YELLOW)
TableState.EATING:
label_3d.text = lbl_eating
if label_3d_time:
label_3d_time.text = "%.1f" % _state_time
progress_bar.set_bar_visible(false)
label_3d_time.text = "%.1f" % state_time
var progress := state_time / state_duration if state_duration > 0.0 else 0.0
progress_bar.set_progress(clampf(progress, 0.0, 1.0))
func _set_state(value: TableState) -> void:
_state = value
state = value
_refresh_display()
func _set_state_time(value: float) -> void:
_state_time = value
state_time = value
_refresh_display()
func _set_unsatisfied_orders(value: Array[String]) -> void:
_unsatisfied_orders = value
unsatisfied_orders = value
_refresh_display()
func _process(delta: float) -> void:
# Wait for state to finish
if _state_time > 0:
_state_time -= delta
if state_time > 0.0:
state_time = max(0.0, state_time - delta)
return
if GAME_MANAGER.game_state == GAME_MANAGER.GameState.GAME_OVER:
return
# When state timer is finished, do this stuff before moving to next state
match _state:
match state:
TableState.EMPTY:
print("Table State EMPTY finish")
_setState(TableState.THINKING)
TableState.THINKING:
print("Table State THINKING finish")
place_order()
_setState(TableState.WAITING_PRIMARY)
TableState.WAITING_PRIMARY:
print("Table State WAITING_PRIMARY finish")
label_3d.text = lbl_gameover
GAME_MANAGER.game_over()
TableState.WAITING_FRIEND:
print("Table State WAITING_FRIEND finish")
label_3d.text = lbl_gameover
GAME_MANAGER.game_over()
TableState.EATING:
print("Table State EATING finish")
clearAllPlates()
_set_snap_zones_enabled(true)
_setState(TableState.EMPTY)
+48 -33
View File
@@ -2,28 +2,22 @@
[ext_resource type="Script" uid="uid://caeikc7e3igkd" path="res://Stations/table.gd" id="1_2vcpj"]
[ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="1_8j1nt"]
[ext_resource type="AudioStream" uid="uid://clkjwcawdqvta" path="res://Sounds/money.mp3" id="2_jslhm"]
[ext_resource type="AudioStream" uid="uid://daiv8ubwdbidf" path="res://Sounds/220195__gameaudio__click-wooden-1.wav" id="3_0s6ir"]
[ext_resource type="PackedScene" uid="uid://bxbocxdaayvwx" path="res://UI/progress_bar.tscn" id="3_kjf1i"]
[sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"]
size = Vector3(0.6, 1, 0.6)
[sub_resource type="SphereShape3D" id="SphereShape3D_dlkho"]
radius = 0.3
radius = 0.6
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_24d3s"]
albedo_color = Color(0.31, 0.21576, 0.1333, 1)
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_np_table"]
properties/0/path = NodePath(".:_state")
properties/0/spawn = true
properties/0/replication_mode = 1
properties/1/path = NodePath(".:_state_time")
properties/1/spawn = true
properties/1/replication_mode = 1
properties/2/path = NodePath(".:_unsatisfied_orders")
properties/2/spawn = true
properties/2/replication_mode = 1
[node name="Table" type="StaticBody3D" unique_id=1863572470 groups=["station"]]
script = ExtResource("1_2vcpj")
money_sound = ExtResource("2_jslhm")
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=228053941]
shape = SubResource("BoxShape3D_24d3s")
@@ -31,8 +25,9 @@ shape = SubResource("BoxShape3D_24d3s")
[node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=1947858647 groups=["station"]]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.31874347, 0.5270121, 0)
collision_layer = 65536
collision_mask = 65536
collision_mask = 65540
script = ExtResource("1_8j1nt")
stash_sound = ExtResource("3_0s6ir")
snap_mode = 1
metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
@@ -40,11 +35,15 @@ metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.000975132, 0)
shape = SubResource("SphereShape3D_dlkho")
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="XRToolsSnapZone" unique_id=2135860710]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.013531357, -0.015141487, 0.012176305)
[node name="XRToolsSnapZone2" type="Area3D" parent="." unique_id=694448387 groups=["station"]]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.34755045, 0.5270121, 0)
collision_layer = 65536
collision_mask = 65536
collision_mask = 65540
script = ExtResource("1_8j1nt")
stash_sound = ExtResource("3_0s6ir")
snap_mode = 1
metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
@@ -52,11 +51,15 @@ metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.000975132, 0)
shape = SubResource("SphereShape3D_dlkho")
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="XRToolsSnapZone2" unique_id=709529410]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.013531357, -0.015141487, 0.012176305)
[node name="XRToolsSnapZone3" type="Area3D" parent="." unique_id=1734026785 groups=["station"]]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.012355864, 0.5270121, 0.33038777)
collision_layer = 65536
collision_mask = 65536
collision_mask = 65540
script = ExtResource("1_8j1nt")
stash_sound = ExtResource("3_0s6ir")
snap_mode = 1
metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
@@ -64,11 +67,15 @@ metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.000975132, 0)
shape = SubResource("SphereShape3D_dlkho")
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="XRToolsSnapZone3" unique_id=2000860662]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.013531357, -0.015141487, 0.012176305)
[node name="XRToolsSnapZone4" type="Area3D" parent="." unique_id=1358457948 groups=["station"]]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.022546828, 0.5270121, -0.36528283)
collision_layer = 65536
collision_mask = 65536
collision_mask = 65540
script = ExtResource("1_8j1nt")
stash_sound = ExtResource("3_0s6ir")
snap_mode = 1
metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
@@ -76,30 +83,34 @@ metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.000975132, 0)
shape = SubResource("SphereShape3D_dlkho")
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="XRToolsSnapZone4" unique_id=790672192]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.013531357, -0.015141487, 0.012176305)
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="." unique_id=2085635675]
use_collision = true
[node name="CSGBox3D" type="CSGBox3D" parent="CSGCombiner3D" unique_id=411048765]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.46137518, 0)
size = Vector3(1, 0.07678223, 1)
size = Vector3(1, 0.077, 1)
material = SubResource("StandardMaterial3D_24d3s")
[node name="CSGBox3D2" type="CSGBox3D" parent="CSGCombiner3D" unique_id=2093582402]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0023368, 0)
size = Vector3(0.1, 0.8768555, 0.1)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.27815637, 0)
size = Vector3(0.1, 0.31586915, 0.1)
material = SubResource("StandardMaterial3D_24d3s")
[node name="CSGBox3D3" type="CSGBox3D" parent="CSGCombiner3D" unique_id=839228683]
transform = Transform3D(0.86602545, 0.50000006, 0, -0.50000006, 0.86602545, 0, 0, 0, 1, -0.21657634, -0.5113707, 0)
transform = Transform3D(0.86602545, 0.50000006, 0, -0.50000006, 0.86602545, 0, 0, 0, 1, -0.21657634, -0.106895894, 0)
size = Vector3(0.1, 0.8768555, 0.1)
material = SubResource("StandardMaterial3D_24d3s")
[node name="CSGBox3D4" type="CSGBox3D" parent="CSGCombiner3D" unique_id=1028598922]
transform = Transform3D(-0.45971727, -0.2654179, 0.8474747, -0.50000006, 0.86602545, 0, -0.73393464, -0.4237374, -0.53083575, 0.10796261, -0.5113707, 0.16580808)
transform = Transform3D(-0.45971727, -0.2654179, 0.8474747, -0.50000006, 0.86602545, 0, -0.73393464, -0.4237374, -0.53083575, 0.10796261, -0.106895894, 0.16580808)
size = Vector3(0.1, 0.8768555, 0.1)
material = SubResource("StandardMaterial3D_24d3s")
[node name="CSGBox3D5" type="CSGBox3D" parent="CSGCombiner3D" unique_id=892392906]
transform = Transform3D(-0.38498235, -0.12489955, -0.9144338, -0.5286442, 0.8420017, 0.107556336, 0.756521, 0.5248176, -0.39018327, 0.059352398, -0.5113707, -0.2290039)
transform = Transform3D(-0.38498235, -0.12489955, -0.9144338, -0.5286442, 0.8420017, 0.107556336, 0.756521, 0.5248176, -0.39018327, 0.059352398, -0.106895894, -0.2290039)
size = Vector3(0.1, 0.8768555, 0.1)
material = SubResource("StandardMaterial3D_24d3s")
@@ -112,11 +123,11 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.016780734, -0.08218986, 0)
transform = Transform3D(1.095, 0, 0, 0, 1.095, 0, 0, 0, 1.095, 0.08442788, -0.19989291, 0)
[node name="CSGSphere3D" type="CSGSphere3D" parent="Customers/Customer/CSGCombiner3D" unique_id=2104132980]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.88519466, 0.9358529, 0)
transform = Transform3D(0.9999998, 0, 0, 0, 0.9999998, 0, 0, 0, 0.9999998, -0.7149929, 1.2762557, 0)
radius = 0.17520222
[node name="CSGSphere3D2" type="CSGSphere3D" parent="Customers/Customer/CSGCombiner3D" unique_id=808477724]
transform = Transform3D(1, 0, 0, 0, 1.747647, 0, 0, 0, 1, -0.9068739, 0.51278543, 0)
transform = Transform3D(0.9999998, 0, 0, 0, 1.7476468, 0, 0, 0, 0.9999998, -0.7366721, 0.8531885, 0)
radius = 0.17520222
[node name="Seats" type="Node3D" parent="." unique_id=1101423789]
@@ -127,31 +138,31 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.9079602, -0.37259835, 0)
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="Seats/Seat" unique_id=384912485]
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="Seats/Seat/CSGCombiner3D" unique_id=170426769]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.14400849, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.18637085, 0.51674986, 0)
radius = 0.25634766
height = 0.051940918
sides = 16
[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="Seats/Seat/CSGCombiner3D" unique_id=1294605073]
transform = Transform3D(0.24355066, 0.98373884, 0, -1.3339849, 0.1796049, 0, 0, 0, 0.8365013, -0.23884833, 0.48196742, 0)
transform = Transform3D(0.24355066, 0.98373884, 0, -1.3339849, 0.1796049, 0, 0, 0, 0.8365013, -0.05247748, 0.8547088, 0)
radius = 0.25634766
height = 0.051940918
sides = 16
[node name="CSGBox3D" type="CSGBox3D" parent="Seats/Seat/CSGCombiner3D" unique_id=1761839440]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.15600169, -0.18527734, 0.1341562)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.030369163, 0.18746406, 0.1341562)
size = Vector3(0.05, 0.6713196, 0.05)
[node name="CSGBox3D2" type="CSGBox3D" parent="Seats/Seat/CSGCombiner3D" unique_id=1395371703]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.15600169, -0.18527734, -0.15065354)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.030369163, 0.18746406, -0.15065354)
size = Vector3(0.05, 0.6713196, 0.05)
[node name="CSGBox3D3" type="CSGBox3D" parent="Seats/Seat/CSGCombiner3D" unique_id=96608061]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.1444692, -0.18527734, 0.1341562)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.33084005, 0.18746406, 0.1341562)
size = Vector3(0.05, 0.6713196, 0.05)
[node name="CSGBox3D4" type="CSGBox3D" parent="Seats/Seat/CSGCombiner3D" unique_id=1684738537]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.1444692, -0.18527734, -0.15065354)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.33084005, 0.18746406, -0.15065354)
size = Vector3(0.05, 0.6713196, 0.05)
[node name="Label3D" type="Label3D" parent="." unique_id=662960977]
@@ -162,10 +173,14 @@ vertical_alignment = 0
line_spacing = -15.0
[node name="Label3DTime" type="Label3D" parent="." unique_id=1534849507]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.3306234, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.4532461, 0)
pixel_size = 0.003
billboard = 2
text = "20.1s"
[node name="Sync" type="MultiplayerSynchronizer" parent="." unique_id=2000411505]
replication_config = SubResource("SceneReplicationConfig_np_table")
[node name="ProgressBar3D" parent="." unique_id=654673176 instance=ExtResource("3_kjf1i")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.3676775, 0)
y_billboard = true
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="." unique_id=724610642]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.2935008, 0)
+5
View File
@@ -0,0 +1,5 @@
[gd_resource type="StandardMaterial3D" format=3 uid="uid://d1djvskv4n4m3"]
[resource]
albedo_color = Color(0, 0, 0, 1)
emission_energy_multiplier = 0.0
+6
View File
@@ -0,0 +1,6 @@
[gd_resource type="StandardMaterial3D" format=3 uid="uid://db7c7w4apwti7"]
[resource]
albedo_color = Color(0.6553854, 0, 0, 1)
emission_enabled = true
emission = Color(1, 0.27450982, 0, 1)
+13
View File
@@ -0,0 +1,13 @@
extends Control
@onready var _Restart_btn: Button = %Restart
const GAME_MANAGER = preload("res://GameManager.gd")
func _ready() -> void:
_Restart_btn.pressed.connect(_restart)
func _restart():
GAME_MANAGER._restart()
get_tree().reload_current_scene()
+1
View File
@@ -0,0 +1 @@
uid://0iuv73i6epvo
+77
View File
@@ -0,0 +1,77 @@
[gd_scene format=3 uid="uid://xtcei2uvd5li"]
[ext_resource type="Script" uid="uid://0iuv73i6epvo" path="res://UI/game_over_panel.gd" id="1_kuqui"]
[node name="MainMenuPanel" type="Control" unique_id=816925194]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_kuqui")
[node name="Background" type="ColorRect" parent="." unique_id=1357080155]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.09, 0.1, 0.13, 1)
[node name="Margin" type="MarginContainer" parent="." unique_id=1809235566]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_right = 3.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 24
theme_override_constants/margin_top = 16
theme_override_constants/margin_right = 24
theme_override_constants/margin_bottom = 16
[node name="Panel" type="Panel" parent="Margin" unique_id=626023996]
layout_mode = 2
[node name="Title" type="Label" parent="Margin/Panel" unique_id=712414582]
layout_mode = 0
offset_right = 916.0
offset_bottom = 36.0
size_flags_vertical = 0
theme_override_font_sizes/font_size = 26
text = "VRyHungry"
horizontal_alignment = 1
[node name="CenterContainer" type="CenterContainer" parent="Margin" unique_id=386836547]
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="Margin/CenterContainer" unique_id=1621136758]
layout_mode = 2
[node name="Status" type="Label" parent="Margin/CenterContainer/VBoxContainer" unique_id=333264578]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 100
text = "Get Good!"
horizontal_alignment = 1
[node name="RootView" type="VBoxContainer" parent="Margin/CenterContainer/VBoxContainer" unique_id=518577929]
unique_name_in_owner = true
layout_mode = 2
theme_override_constants/separation = 14
[node name="Spacer" type="Control" parent="Margin/CenterContainer/VBoxContainer/RootView" unique_id=756236975]
custom_minimum_size = Vector2(0, 36)
layout_mode = 2
[node name="Restart" type="Button" parent="Margin/CenterContainer/VBoxContainer/RootView" unique_id=1922783842]
unique_name_in_owner = true
custom_minimum_size = Vector2(0, 64)
layout_mode = 2
theme_override_font_sizes/font_size = 26
text = "Restasrt?"
+1 -1
View File
@@ -96,7 +96,7 @@ func _on_john_pressed() -> void:
func _on_host_pressed() -> void:
NetworkManager.request_host()
get_tree().change_scene_to_file.call_deferred(MULTIPLAYER_SCENE)
get_tree().change_scene_to_file.call_deferred("res://Scenes/JonScene.tscn")
func _on_join_pressed() -> void:
+32
View File
@@ -0,0 +1,32 @@
[gd_scene format=3 uid="uid://bxbocxdaayvwx"]
[ext_resource type="Script" uid="uid://bv7oracwmgre8" path="res://UI/progress_bar_3d.gd" id="1_ng8tm"]
[sub_resource type="ViewportTexture" id="ViewportTexture_copv3"]
viewport_path = NodePath("Sprite3D/SubViewport")
[node name="ProgressBar3D" type="Node3D" unique_id=654673176]
script = ExtResource("1_ng8tm")
[node name="Sprite3D" type="Sprite3D" parent="." unique_id=1484008334]
pixel_size = 0.002
texture = SubResource("ViewportTexture_copv3")
[node name="SubViewport" type="SubViewport" parent="Sprite3D" unique_id=35936518]
transparent_bg = true
size = Vector2i(320, 80)
[node name="ProgressBar" type="ProgressBar" parent="Sprite3D/SubViewport" unique_id=727723524]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -150.0
offset_top = -13.5
offset_right = 150.0
offset_bottom = 36.5
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 4
+36
View File
@@ -0,0 +1,36 @@
extends Node3D
class_name ProgressBar3D
@export var y_billboard: bool = false
@onready var progress_bar: ProgressBar = $Sprite3D/SubViewport/ProgressBar
@onready var sprite_3d: Sprite3D = $Sprite3D
func _ready() -> void:
if not progress_bar:
push_error("Progressbar3D missing reference to ProgressBar")
if y_billboard:
$Sprite3D.billboard = BaseMaterial3D.BillboardMode.BILLBOARD_FIXED_Y
func set_progress(value: float) -> void:
progress_bar.value = clamp(value, 0.0, 1.0) * 100
func get_progress() -> float:
return progress_bar.value
func set_bar_visible(value: bool) -> void:
progress_bar.visible = value
func is_bar_visible() -> bool:
return progress_bar != null and progress_bar.visible
func override_fill_color(color: Color) -> void:
var style_box := StyleBoxFlat.new()
style_box.bg_color = color
# Override the 'fill' StyleBox on the ProgressBar
progress_bar.add_theme_stylebox_override("fill", style_box)
+1
View File
@@ -0,0 +1 @@
uid://bv7oracwmgre8
+7 -11
View File
@@ -6,7 +6,6 @@
[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="Script" uid="uid://ck4yn3hxuobj7" path="res://addons/godot-xr-tools/player/player_body.gd" id="5_rd8py"]
[ext_resource type="PackedScene" uid="uid://cqhw276realc" path="res://addons/godot-xr-tools/functions/function_pointer.tscn" id="6_ptr"]
[node name="XROrigin3D" type="XROrigin3D" unique_id=2055526621]
@@ -24,9 +23,9 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.009340696, -0.0074635968,
strafe = true
[node name="FunctionPickup" parent="XRControllerLeftHand" unique_id=2133415351 instance=ExtResource("3_rd8py")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.009340696, -0.0074635968, 0.024033919)
[node name="FunctionPointer" parent="XRControllerLeftHand" instance=ExtResource("6_ptr")]
[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
show_target = true
@@ -42,15 +41,12 @@ turn_mode = 2
smooth_turn_speed = 3.5
[node name="FunctionPickup" parent="XRControllerRightHand" unique_id=1876210450 instance=ExtResource("3_rd8py")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0074635968, 0.024033919)
[node name="FunctionPointer" parent="XRControllerRightHand" instance=ExtResource("6_ptr")]
[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
show_target = true
[node name="PlayerBody" type="CharacterBody3D" parent="." unique_id=1444632058 groups=["player_body"] instance=ExtResource("4_6xr3x")]
process_priority = -100
process_physics_priority = -100
collision_layer = 524288
collision_mask = 1023
script = ExtResource("5_rd8py")
[node name="PlayerBody" parent="." unique_id=1444632058 instance=ExtResource("4_6xr3x")]
collision_mask = 1017
player_calibrate_height = false
@@ -437,7 +437,8 @@ func _pick_up_object(target: Node3D) -> void:
# Pick up our target. Note, target may do instant drop_and_free
picked_up_ranged = not _object_in_grab_area.has(target)
picked_up_object = target
target.pick_up(self)
if target and target.has_method("pick_up"):
target.pick_up(self)
# If object picked up then emit signal
if is_instance_valid(picked_up_object):
@@ -186,6 +186,12 @@ func _is_correct_hand(grabber : Node3D) -> bool:
# Get the positional tracker
var tracker := XRServer.get_tracker(controller.tracker) as XRPositionalTracker
# Without an XR runtime (desktop/headless testing) there is no tracker, so
# we can't tell which hand this is. Treat it as "not the correct hand" —
# the same result the null deref below used to produce after erroring.
if not tracker:
return false
# If left hand then verify left controller
if hand == Hand.LEFT and tracker.hand != XRPositionalTracker.TRACKER_HAND_LEFT:
return false

Some files were not shown because too many files have changed in this diff Show More