feat: implement modular character skinning system with procedural and imported model support
This commit is contained in:
@@ -52,6 +52,7 @@ func _ready() -> void:
|
||||
func _spawn_player(pid: int) -> CharacterBody3D:
|
||||
var player := CharacterBody3D.new()
|
||||
player.name = str(pid)
|
||||
player.add_to_group("players")
|
||||
player.set_multiplayer_authority(pid)
|
||||
|
||||
# Alternate spawn sides (Team A / Team B style)
|
||||
@@ -90,6 +91,7 @@ func _spawn_player(pid: int) -> CharacterBody3D:
|
||||
client_rep_config.add_property(":synced_loadout_ready")
|
||||
client_rep_config.add_property(":synced_is_targeting")
|
||||
client_rep_config.add_property(":synced_homing_target_pos")
|
||||
client_rep_config.add_property(":synced_skin_id")
|
||||
client_sync.replication_config = client_rep_config
|
||||
player.add_child(client_sync)
|
||||
|
||||
@@ -110,7 +112,11 @@ func _spawn_player(pid: int) -> CharacterBody3D:
|
||||
# Humanoid Model for Player (Shadows only locally, visible to others)
|
||||
var humanoid = load("res://characters/humanoid_model.gd").new()
|
||||
humanoid.name = "HumanoidModel"
|
||||
humanoid.color = Color(0.2, 0.4, 0.8) # Blueish for player
|
||||
var skin_mgr = get_node_or_null("/root/SkinManager")
|
||||
if skin_mgr and pid == multiplayer.get_unique_id():
|
||||
humanoid.skin = skin_mgr.get_player_skin()
|
||||
else:
|
||||
humanoid.skin = skin_mgr.get_skin("default") if skin_mgr else null
|
||||
humanoid.shadows_only = (pid == multiplayer.get_unique_id())
|
||||
humanoid.position = Vector3(0, -0.9, 0) # Offset from center to feet
|
||||
player.add_child(humanoid)
|
||||
|
||||
Reference in New Issue
Block a user