New player model with anims!!!!!!

This commit is contained in:
Twirpytherobot
2025-11-16 18:42:06 +00:00
parent 9d5feb6f0e
commit 3431c12dc2
10 changed files with 301 additions and 49 deletions
+18 -2
View File
@@ -7,6 +7,7 @@ class_name WorldWeapon
@export var weapon_data: WeaponData
var weapon_id: int = -1 # Set by Level when spawned
var _mesh_instance: Node3D = null
var _collision_shape: CollisionShape3D = null
var _pickup_area: Area3D = null
@@ -119,15 +120,30 @@ func try_pickup(player_id: int):
push_error("WeaponData has no resource path!")
return
# Check weapon_id is valid
if weapon_id == -1:
push_error("WorldWeapon.try_pickup: weapon_id is -1! This weapon was not spawned correctly.")
print(" Weapon name: ", name)
print(" Weapon data: ", weapon_data.resource_path if weapon_data else "null")
return
# Tell the player to equip this weapon (on all clients)
print("[Server] Telling player ", player_id, " to equip weapon via RPC")
player.rpc("equip_weapon_from_world", resource_path)
# Remove this world weapon from all clients
rpc("_remove_from_all_clients")
# Remove this world weapon from all clients using level's centralized system
print("[Server] Removing world weapon ", name, " (ID: ", weapon_id, ") via level.remove_world_weapon")
if level.has_method("remove_world_weapon"):
level.remove_world_weapon(weapon_id)
else:
push_error("Level doesn't have remove_world_weapon method!")
## Remove weapon from all clients
@rpc("any_peer", "call_local", "reliable")
func _remove_from_all_clients():
print("[Client ", multiplayer.get_unique_id(), "] Removing weapon ", name)
# Delay removal to ensure RPC is fully processed
await get_tree().process_frame
queue_free()
## Set weapon data and refresh