feat: overhaul UI main and profile
This commit is contained in:
@@ -500,6 +500,10 @@ func set_character(character_name: String) -> void:
|
||||
# Apply outline shader to the active character
|
||||
if active_character:
|
||||
_apply_outline_recursive(active_character)
|
||||
|
||||
# Apply cosmetic loadout to active model (local auth only)
|
||||
if active_character and is_multiplayer_authority():
|
||||
apply_loadout(active_character)
|
||||
|
||||
func _apply_outline_recursive(node: Node):
|
||||
if node is MeshInstance3D and node.mesh:
|
||||
@@ -517,6 +521,22 @@ func _apply_outline_recursive(node: Node):
|
||||
for child in node.get_children():
|
||||
_apply_outline_recursive(child)
|
||||
|
||||
func apply_loadout(character_node: Node3D) -> void:
|
||||
"""Apply equipped cosmetics from UserProfileManager.loadout onto the active character model.
|
||||
Items are expected as child nodes named matching the item ID (e.g. 'head_hat1', 'acc_glasses').
|
||||
All nodes in the cosmetic category groups are hidden first, then the equipped one is shown."""
|
||||
if not has_node("/root/UserProfileManager"):
|
||||
return
|
||||
|
||||
var loadout: Dictionary = UserProfileManager.loadout
|
||||
|
||||
for category in ["head", "costume", "glove", "accessory"]:
|
||||
var equipped: String = loadout.get(category, "")
|
||||
for child in character_node.get_children():
|
||||
# Only manage nodes that start with the category prefix
|
||||
if child.name.begins_with(category):
|
||||
child.visible = (child.name == equipped)
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func sync_character(character_name: String) -> void:
|
||||
"""Sync character selection across all clients."""
|
||||
|
||||
Reference in New Issue
Block a user