Remove AI multiplayer
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
class_name CombinableItem
|
||||
extends Node
|
||||
|
||||
const RECIPE_MANAGER = preload("res://RecipeManager.gd")
|
||||
const RECIPE_MANAGER = preload("res://scripts/recipe_Manager.gd")
|
||||
|
||||
@onready var combine_area_3d: Area3D = $Area3d
|
||||
@onready var _pickable: XRToolsPickable = get_parent() as XRToolsPickable
|
||||
@@ -51,8 +51,8 @@ func _on_item_dropped(_item: Node3D) -> void:
|
||||
# If the other body is a FoodItem, check for a recipe and combine if one exists.
|
||||
# Combining is a server decision (the base item is server-snapped into a zone).
|
||||
func _on_body_entered(body: Node3D) -> void:
|
||||
if not NetworkManager.owns_world():
|
||||
return
|
||||
# if not NetworkManager.owns_world():
|
||||
# return
|
||||
if _combining or body == _pickable:
|
||||
print("CombinableItem _on_body_entered: other is our own pickable")
|
||||
return
|
||||
@@ -81,13 +81,16 @@ func _combine(other_body: Node3D, result: PackedScene) -> void:
|
||||
# Spawn the result through the server (so it replicates to every peer,
|
||||
# including late joiners) at the base item's location, in world space.
|
||||
var base_transform := _pickable.global_transform
|
||||
var result_instance: Node3D = NetworkManager.spawn_item(result.resource_path, base_transform)
|
||||
|
||||
#var result_instance: Node3D = NetworkManager.spawn_item(result.resource_path, base_transform)
|
||||
var result_instance: Node3D = result.instantiate()
|
||||
get_tree().root.add_child(result_instance)
|
||||
result_instance.transform = base_transform
|
||||
|
||||
# Free the pickable / root of this item and consume the incoming item.
|
||||
snap_zone.drop_object()
|
||||
NetworkManager.despawn_item(_pickable)
|
||||
_pickable.queue_free()
|
||||
other_body.drop()
|
||||
NetworkManager.despawn_item(other_body)
|
||||
other_body.queue_free()
|
||||
|
||||
# Snap the result into the now-empty zone.
|
||||
snap_zone.pick_up_object(result_instance)
|
||||
|
||||
Reference in New Issue
Block a user