feat: fix Bots Using Your Equipped Skin, Equipped Overlay Skins Reverting to Normal

This commit is contained in:
2026-04-22 01:36:05 +08:00
parent f2e14f20f3
commit 083735aec1
4 changed files with 24 additions and 11 deletions
+16 -3
View File
@@ -567,8 +567,9 @@ func apply_loadout(character_node: Node3D) -> void:
Uses _player_loadout (synced from the owning client via sync_loadout RPC)
so all peers render the same skin regardless of their own loadout."""
# Fall back to UserProfileManager for the local player before network sync arrives
var loadout: Dictionary = _player_loadout if not _player_loadout.is_empty() \
else UserProfileManager.loadout
var loadout: Dictionary = {}
if not is_bot and not is_in_group("Bots"):
loadout = _player_loadout if not _player_loadout.is_empty() else UserProfileManager.loadout
# Pass 'self' (the player CharacterBody3D) as character_root because SkinManager
# looks for a CHILD node named e.g. "Oldpop" inside character_root.
# self.$Oldpop, self.$Bob etc. are direct children, matching SKIN_CATALOG "character" keys.
@@ -876,6 +877,18 @@ func _refresh_player_visuals():
# Apply the determined color and alpha
_apply_tint_recursive(self, color_to_apply, alpha_to_apply)
# If returning to normal, _apply_tint_recursive wiped all material_overlays.
# We must re-apply the cosmetics so "overlay" model skins (e.g. pants) return.
if color_to_apply == Color.WHITE and alpha_to_apply == 1.0:
var active_character: Node3D = null
match _selected_character:
"Bob": active_character = character_bob
"Masbro": active_character = character_masbro
"Gatot": active_character = character_gatot
"Oldpop": active_character = character_oldpop
if active_character:
apply_loadout(active_character)
func update_rank_visuals(rank: int):
var pos_label = get_node_or_null("Position")
@@ -1293,7 +1306,7 @@ func _process(delta):
immunity_timer -= delta
if immunity_timer <= 0:
immunity_timer = 0
_apply_tint_recursive(self, Color.WHITE) # Remove immunity tint
_refresh_player_visuals()
# Slow Timer Logic
if slow_timer > 0: