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)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://3lr2dhy62rhk"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dounic663dn5q" path="res://Prefabs/combinable_item.gd" id="1_q21ti"]
|
||||
[ext_resource type="Script" uid="uid://dounic663dn5q" path="res://prefabs/combinable_item.gd" id="1_q21ti"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_o1b3t"]
|
||||
radius = 0.2
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
class_name CombineRecipe
|
||||
extends Resource
|
||||
|
||||
## The [CombinableItem.id] of the item that must be combined into the base item.
|
||||
@export var ingredient_id: StringName
|
||||
|
||||
## The scene the base item turns into when [member ingredient_id] is combined in.
|
||||
@export var result: PackedScene
|
||||
@@ -1 +0,0 @@
|
||||
uid://coidnv8b2yvxr
|
||||
@@ -1,9 +0,0 @@
|
||||
class_name CookableItem
|
||||
extends Node
|
||||
|
||||
@export_range(0.0, 30.0, 0.5, "or_greater", "suffix:s") var cooking_time: float = 4.0
|
||||
@export var turns_into: PackedScene
|
||||
|
||||
func _ready() -> void:
|
||||
if not turns_into:
|
||||
push_error("Cooking Error: 'turns_into' PackedScene is missing on ", name, ". Please assign a scene in the Inspector.")
|
||||
@@ -1 +0,0 @@
|
||||
uid://bs7cxydoxk1cx
|
||||
@@ -1,9 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://7earnjgdmwgx"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bs7cxydoxk1cx" path="res://Prefabs/cookable_item.gd" id="1_6hwx6"]
|
||||
[ext_resource type="PackedScene" uid="uid://cucc3gaqu2nab" path="res://Items/Charcoal.tscn" id="2_rpt7j"]
|
||||
|
||||
[node name="CookableItem" type="Node" unique_id=280820828]
|
||||
script = ExtResource("1_6hwx6")
|
||||
cooking_time = 2.0
|
||||
turns_into = ExtResource("2_rpt7j")
|
||||
@@ -28,8 +28,8 @@ func _process(delta: float) -> void:
|
||||
# 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 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):
|
||||
@@ -42,7 +42,7 @@ func _process(delta: float) -> void:
|
||||
_time_left -= delta
|
||||
if _time_left <= 0:
|
||||
print("DespawningItem despawning!" , get_parent())
|
||||
NetworkManager.despawn_item(get_parent())
|
||||
get_parent().queue_free()
|
||||
# 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)
|
||||
@@ -56,8 +56,8 @@ func _process(delta: float) -> void:
|
||||
# `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():
|
||||
func _set_visible(value: bool) -> void: # TODO: Fix blinking
|
||||
if true:# NetworkManager.is_online():
|
||||
get_parent().visible = true
|
||||
return
|
||||
get_parent().visible = value
|
||||
|
||||
@@ -1,6 +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"]
|
||||
[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")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://bfj80jh13t6e5"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://5tpoohkopryv" path="res://Prefabs/food_item.gd" id="1_0na5k"]
|
||||
[ext_resource type="Script" uid="uid://5tpoohkopryv" path="res://prefabs/food_item.gd" id="1_0na5k"]
|
||||
|
||||
[node name="FoodItem" type="Node" unique_id=63948206]
|
||||
script = ExtResource("1_0na5k")
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
uid://cwijoksyou1ey
|
||||
@@ -0,0 +1,55 @@
|
||||
[gd_scene format=3 uid="uid://j5s5wus7tuhb"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bq86r4yll8po" path="res://addons/godot-xr-tools/hands/scenes/lowpoly/left_fullglove_low.tscn" id="1_jr1t4"]
|
||||
[ext_resource type="PackedScene" uid="uid://xqimcf20s2jp" path="res://addons/godot-xr-tools/hands/scenes/lowpoly/right_fullglove_low.tscn" id="2_gshht"]
|
||||
[ext_resource type="PackedScene" uid="uid://bl2nuu3qhlb5k" path="res://addons/godot-xr-tools/functions/movement_direct.tscn" id="2_q1xvu"]
|
||||
[ext_resource type="PackedScene" uid="uid://b4ysuy43poobf" path="res://addons/godot-xr-tools/functions/function_pickup.tscn" id="3_rd8py"]
|
||||
[ext_resource type="PackedScene" uid="uid://diyu06cw06syv" path="res://addons/godot-xr-tools/player/player_body.tscn" id="4_6xr3x"]
|
||||
[ext_resource type="PackedScene" uid="uid://b6bk2pj8vbj28" path="res://addons/godot-xr-tools/functions/movement_turn.tscn" id="4_rd8py"]
|
||||
[ext_resource type="PackedScene" uid="uid://cqhw276realc" path="res://addons/godot-xr-tools/functions/function_pointer.tscn" id="6_ptr"]
|
||||
|
||||
[node name="XROrigin3D" type="XROrigin3D" unique_id=2055526621]
|
||||
|
||||
[node name="XRCamera3D" type="XRCamera3D" parent="." unique_id=983614103]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.8, 0)
|
||||
|
||||
[node name="XRControllerLeftHand" type="XRController3D" parent="." unique_id=1171100950]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.30486506, 1.057469, 0)
|
||||
tracker = &"left_hand"
|
||||
|
||||
[node name="LeftHand" parent="XRControllerLeftHand" unique_id=1805508372 instance=ExtResource("1_jr1t4")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.009340696, -0.0074635968, 0.024033919)
|
||||
|
||||
[node name="MovementDirect" parent="XRControllerLeftHand" unique_id=1865515938 instance=ExtResource("2_q1xvu")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.009340696, -0.0074635968, 0.024033919)
|
||||
strafe = true
|
||||
|
||||
[node name="FunctionPickup" parent="XRControllerLeftHand" unique_id=2133415351 instance=ExtResource("3_rd8py")]
|
||||
|
||||
[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
|
||||
|
||||
[node name="XRControllerRightHand" type="XRController3D" parent="." unique_id=202756852]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2788871, 1.048965, 0)
|
||||
tracker = &"right_hand"
|
||||
|
||||
[node name="RightHand" parent="XRControllerRightHand" unique_id=1112462503 instance=ExtResource("2_gshht")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0074635968, 0.024033919)
|
||||
|
||||
[node name="MovementTurn" parent="XRControllerRightHand" unique_id=154529119 instance=ExtResource("4_rd8py")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0074635968, 0.024033919)
|
||||
turn_mode = 2
|
||||
smooth_turn_speed = 3.5
|
||||
|
||||
[node name="FunctionPickup" parent="XRControllerRightHand" unique_id=1876210450 instance=ExtResource("3_rd8py")]
|
||||
|
||||
[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" parent="." unique_id=1444632058 instance=ExtResource("4_6xr3x")]
|
||||
collision_mask = 1017
|
||||
player_calibrate_height = false
|
||||
Reference in New Issue
Block a user