diff --git a/Net/net_pickable.gd b/Net/net_pickable.gd index bb77bbb..114e831 100644 --- a/Net/net_pickable.gd +++ b/Net/net_pickable.gd @@ -18,7 +18,7 @@ var _pickable: XRToolsPickable # 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 +var _original_freeze_mode: RigidBody3D.FreezeMode # Same idea for the pickable's authored `enabled` flag, which the non-authority # branch of apply_held_state() clears while someone else is holding the item. @@ -71,7 +71,7 @@ func _set_net_held_by(value: int) -> void: func apply_held_state() -> void: if not _pickable: return - if not NetworkManager.is_online() or is_multiplayer_authority(): + if not NetworkManager.is_online() or (is_inside_tree() and is_multiplayer_authority()) : _grab_race_logged = false # 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 @@ -205,5 +205,5 @@ func _holder_desc() -> String: return "hand(%s)" % by.get_path() if by is XRToolsSnapZone: var station := by.get_parent() - return "zone(%s)" % (station.name if station else str(by.get_path())) + return "zone(%s)" % (str(station.name) if station else str(by.get_path())) return "other(%s: %s)" % [by.get_class(), by.get_path()] diff --git a/Net/network_manager.gd b/Net/network_manager.gd index 31bb256..30ad272 100644 --- a/Net/network_manager.gd +++ b/Net/network_manager.gd @@ -331,7 +331,7 @@ func _try_snap_into_station(item: Node) -> void: var by: Node = null if item.has_method("get_picked_up_by"): by = item.get_picked_up_by() - log_line("skipped snapping %s: already held by %s (grab-race guard)" % [item.name, by.get_path() if by else "?"]) + log_line("skipped snapping %s: already held by %s (grab-race guard)" % [item.name, str(by.get_path()) if by else "?"]) return for zone in _station_snap_zones(): if is_instance_valid(zone.picked_up_object): diff --git a/Net/world_layout.gd b/Net/world_layout.gd index 72ee21e..9e205ea 100644 --- a/Net/world_layout.gd +++ b/Net/world_layout.gd @@ -151,5 +151,5 @@ static func get_items_old() -> Array[Dictionary]: return items -static func _item(scene: String, name: String, pos: Vector3) -> Dictionary: - return {"scene": scene, "name": name, "xform": Transform3D(Basis(), pos), "props": {}} +static func _item(scene: String, item_name: String, pos: Vector3) -> Dictionary: + return {"scene": scene, "name": item_name, "xform": Transform3D(Basis(), pos), "props": {}} diff --git a/Prefabs/combinable_item.gd b/Prefabs/combinable_item.gd index 3a475a2..c2b8823 100644 --- a/Prefabs/combinable_item.gd +++ b/Prefabs/combinable_item.gd @@ -40,8 +40,8 @@ func _ready() -> void: # Enable the trigger only while snapped into a snap zone (not hand-held). func _on_item_picked_up(_item: Node3D) -> void: var by := _pickable.get_picked_up_by() - var snapped: bool = by != null and by.has_method("is_xr_class") and by.is_xr_class("XRToolsSnapZone") - set_deferred("monitoring", snapped) + var is_snapped: bool = by != null and by.has_method("is_xr_class") and by.is_xr_class("XRToolsSnapZone") + set_deferred("monitoring", is_snapped) func _on_item_dropped(_item: Node3D) -> void: set_deferred("monitoring", false) diff --git a/Stations/StationMovement.tscn b/Stations/StationMovement.tscn index b3b3c0f..aeec35f 100644 --- a/Stations/StationMovement.tscn +++ b/Stations/StationMovement.tscn @@ -54,9 +54,6 @@ properties/1/replication_mode = 1 properties/2/path = NodePath(".:rotation") properties/2/spawn = false properties/2/replication_mode = 1 -properties/3/path = NodePath("..:moving") -properties/3/spawn = false -properties/3/replication_mode = 1 [node name="StationMovement" type="Node3D" unique_id=946873975 node_paths=PackedStringArray("move_handle", "move_ghost")] script = ExtResource("1_ldy6a") diff --git a/Stations/item_dispenser.gd b/Stations/item_dispenser.gd index d54f170..de32487 100644 --- a/Stations/item_dispenser.gd +++ b/Stations/item_dispenser.gd @@ -10,7 +10,7 @@ func _ready() -> void: push_error("Item dispenser is missing a reference to its snap zone child") -func _process(delta: float) -> void: +func _process(_delta: float) -> void: if not NetworkManager.owns_world(): return #if snap_zone.picked_up_object: # Player picked up this station diff --git a/Textures/dev_material_3d.tres b/Textures/dev_material_3d.tres index 85f8d56..5d6b83b 100644 --- a/Textures/dev_material_3d.tres +++ b/Textures/dev_material_3d.tres @@ -1,6 +1,6 @@ [gd_resource type="StandardMaterial3D" format=3 uid="uid://cmia50cfqxxo4"] -[ext_resource type="Texture2D" uid="uid://eqp04wybmg" path="res://Textures/devTex.svg" id="1_3jxsn"] +[ext_resource type="Texture2D" uid="uid://eqp04wybmg" path="res://textures/devTex.svg" id="1_3jxsn"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_0gbf8"] transparency = 1 diff --git a/UI/shop_ui.gd b/UI/shop_ui.gd index 9386b0b..cc3eaa4 100644 --- a/UI/shop_ui.gd +++ b/UI/shop_ui.gd @@ -60,7 +60,6 @@ func _set_poke_enabled_for_controller(controller_node: XRController3D, value: bo # For some reason, this is called every frame the button is down. So we need our own timer. func _on_controller_button_pressed(button_name: String) -> void: - print("Shop _on_controller_button_pressed, button: ", button_name) var now := Time.get_ticks_msec() / 1000.0 if now - _last_toggle_time < INPUT_TOGGLE_COOLDOWN: return @@ -76,7 +75,7 @@ func _on_other_controller_button_pressed(button_name: String) -> void: enabled = false -func _on_station_bought(instance) -> void: +func _on_station_bought(_instance) -> void: enabled = false diff --git a/global/Signals.gd b/global/Signals.gd index 08885eb..fd15106 100644 --- a/global/Signals.gd +++ b/global/Signals.gd @@ -1,7 +1,12 @@ extends Node +@warning_ignore("unused_signal") signal game_over +@warning_ignore("unused_signal") signal restart_game +@warning_ignore("unused_signal") signal game_state_changed(new_state: GameManager.GameState) +@warning_ignore("unused_signal") signal station_bought(instance: Node3D) +@warning_ignore("unused_signal") signal request_customer_spawn() diff --git a/test/mp_test_driver.gd b/test/mp_test_driver.gd index b3a8bab..54ef6ce 100644 --- a/test/mp_test_driver.gd +++ b/test/mp_test_driver.gd @@ -176,10 +176,10 @@ var _despawn_timers_seen := {} # Items live either baked in the scene root or, once spawned at runtime, under # WorldContent. Look in both. -func _find(name: String) -> Node3D: - var n := _world.get_node_or_null(name) +func _find(node_name: String) -> Node3D: + var n := _world.get_node_or_null(node_name) if not n: - n = _world.get_node_or_null("WorldContent/" + name) + n = _world.get_node_or_null("WorldContent/" + node_name) return n as Node3D @@ -965,10 +965,10 @@ func _snapshot() -> Dictionary: for child in root.get_children(): if child is XRToolsPickable and not child.is_queued_for_deletion(): out[str(child.name)] = _describe(child) - for name in WATCHED_STATIONS: - var station := _find(name) + for station_name in WATCHED_STATIONS: + var station := _find(station_name) if station: - out["station:" + name] = _describe_station(station) + out["station:" + station_name] = _describe_station(station) return out @@ -1016,37 +1016,37 @@ func _fetch_client_snapshot() -> Dictionary: # Compare the server's view with the client's, returning a list of differences. func _compare(server: Dictionary, client: Dictionary) -> Array[String]: var problems: Array[String] = [] - for name in server: - if not client.has(name): - problems.append("'%s' exists on the server but NOT on the client" % name) - for name in client: - if not server.has(name): - problems.append("'%s' exists on the client but NOT on the server (ghost copy)" % name) - for name in server: - if not client.has(name): + for entity_name in server: + if not client.has(entity_name): + problems.append("'%s' exists on the server but NOT on the client" % entity_name) + for entity_name in client: + if not server.has(entity_name): + problems.append("'%s' exists on the client but NOT on the server (ghost copy)" % entity_name) + for entity_name in server: + if not client.has(entity_name): continue - var s: Dictionary = server[name] - var c: Dictionary = client[name] + var s: Dictionary = server[entity_name] + var c: Dictionary = client[entity_name] # Stations are compared on their displayed state, not a position. if s.has("pos") and c.has("pos"): var dist: float = (s["pos"] as Vector3).distance_to(c["pos"]) if dist > SYNC_POS_TOLERANCE: - problems.append("%s is %.3fm apart (server %s vs client %s)" % [name, dist, s["pos"], c["pos"]]) + problems.append("%s is %.3fm apart (server %s vs client %s)" % [entity_name, dist, s["pos"], c["pos"]]) for key in s: # "_" keys are per-peer diagnostics, not things that must match. if key == "pos" or key.begins_with("_"): continue if s[key] != c[key]: - problems.append("%s.%s: server=%s client=%s" % [name, key, s[key], c[key]]) + problems.append("%s.%s: server=%s client=%s" % [entity_name, key, s[key], c[key]]) # Absolute invariants, checked per peer. A cross-peer diff can't catch a # fault that happens identically on both sides. for peer_name in ["server", "client"]: var snap: Dictionary = server if peer_name == "server" else client - for name in snap: - var d: Dictionary = snap[name] + for entity_name in snap: + var d: Dictionary = snap[entity_name] if d.has("visuals_attached") and not d["visuals_attached"]: problems.append("on the %s, %s's food has come off the plate (%.3fm from it, limit %.2f)" - % [peer_name, name, d.get("_visual_offset", -1.0), MAX_VISUAL_OFFSET]) + % [peer_name, entity_name, d.get("_visual_offset", -1.0), MAX_VISUAL_OFFSET]) return problems @@ -1368,17 +1368,17 @@ func _assert_debug_camera() -> void: func _check_framing() -> void: var size := get_viewport().get_visible_rect().size var offscreen: Array[String] = [] - for name in ["Counter2", "Counter", "Hob", "Sink", "DirtStation", "Plate"]: - var n := _find(name) + for station_name in ["Counter2", "Counter", "Hob", "Sink", "DirtStation", "Plate"]: + var n := _find(station_name) if not n: continue var p := _debug_cam.unproject_position(n.global_position) var frac := Vector2(p.x / size.x, p.y / size.y) var on := not _debug_cam.is_position_behind(n.global_position) \ and frac.x > 0.02 and frac.x < 0.98 and frac.y > 0.02 and frac.y < 0.98 - _log(" framing: %-12s at %.2f,%.2f of frame%s" % [name, frac.x, frac.y, "" if on else " <-- OFF SCREEN"]) + _log(" framing: %-12s at %.2f,%.2f of frame%s" % [station_name, frac.x, frac.y, "" if on else " <-- OFF SCREEN"]) if not on: - offscreen.append(name) + offscreen.append(station_name) if offscreen.is_empty(): _log(" framing: all test objects are in view") else: