inventory bug fixes, multiplayer pickup sync

This commit is contained in:
N0ble 2025-07-22 00:50:08 -06:00
parent 04a9a299d7
commit 000269875a
14 changed files with 88 additions and 43 deletions

View file

@ -57,7 +57,8 @@ extends CharacterBody3D
@export var CROUCH_ANIMATION : AnimationPlayer
## A reference to the the player's collision shape for use in the character script.
@export var COLLISION_MESH : CollisionShape3D
## A reference to the item holster
@onready var item_holster_one : Marker3D
#endregion
#region Controls Export Group
@ -173,6 +174,7 @@ func _ready():
CAMERA.current = true
inventory_menu = $UserInterface/InventoryMenu
inventory_menu.inventory = INVENTORY
item_holster_one = $Item_holster
func _process(_delta):
# if pausing_enabled:
@ -230,6 +232,10 @@ func teleport_player(location: Vector3, new_rotation: Vector3) -> void:
velocity = Vector3.ZERO
# assign controller to item
#endregion
#region Input Handling
@ -304,13 +310,13 @@ func handle_interact():
interactable.interactable.outline.show()
if "item" in interactable:
if Input.is_action_just_pressed(controls.INTERACT):
print(CAMERA_RAYCAST.get_collider())
var item = interactable as RigidBody3D
item.freeze = true
item.collision_layer = 0
item.hide()
var player_id : int = name.lstrip("Player").to_int()
item.pickup_item.rpc(player_id, item.name)
print('adding a item, heheheheheheheh')
print("adding ID: ", item.item.id)
INVENTORY.add_item(item)
print("This is a item")
elif HIGHLIGHTED_ITEM != null:
HIGHLIGHTED_ITEM.get_node("Interactable").outline.hide()
HIGHLIGHTED_ITEM = null