fix(multiplayer): replicate per-player avatar loadout and preserve original materials
checkpoint / checkpoint (push) Successful in 5m57s

This commit is contained in:
2026-09-17 16:42:15 +00:00
parent 7c77c0b447
commit 50598a0dcb
10 changed files with 395 additions and 60 deletions
+11
View File
@@ -112,6 +112,9 @@ func _ready() -> void:
_refresh_mouse_mode()
_update_camera()
_apply_avatar()
var avatars := get_node_or_null("/root/AvatarSystem")
if avatars != null and avatars.has_signal("loadout_changed"):
avatars.loadout_changed.connect(func(_lo): _apply_avatar())
func _build_crosshair() -> void:
@@ -147,6 +150,14 @@ func _apply_avatar() -> void:
if avatar == null:
push_warning("player.gd: no avatar to show; keeping the placeholder capsule")
return
if _avatar_view != null and is_instance_valid(_avatar_view):
remove_child(_avatar_view)
_avatar_view.queue_free()
if _limb_anim != null and is_instance_valid(_limb_anim):
remove_child(_limb_anim)
_limb_anim.queue_free()
_limb_anim = null
avatar.position = Vector3(0.0, AVATAR_FEET_OFFSET, 0.0)
add_child(avatar)
_avatar_view = avatar