35 lines
1.7 KiB
C#
35 lines
1.7 KiB
C#
namespace Sandbox;
|
|
|
|
public class PlayerDresser : Component, Component.INetworkSpawn
|
|
{
|
|
[Property] public SkinnedModelRenderer BodyRenderer { get; set; }
|
|
|
|
[Property] public ClothingContainer currentClothing { get; set; }
|
|
|
|
public void OnNetworkSpawn( Connection owner )
|
|
{
|
|
currentClothing = ClothingContainer.CreateFromJson( owner.GetUserData( "avatar" ) );
|
|
|
|
var allowedCategories = new[]
|
|
{
|
|
Clothing.ClothingCategory.Skin, Clothing.ClothingCategory.Facial, Clothing.ClothingCategory.Eyes,
|
|
Clothing.ClothingCategory.Eyebrows, Clothing.ClothingCategory.Eyelashes,
|
|
Clothing.ClothingCategory.MakeupLips, Clothing.ClothingCategory.MakeupEyeshadow,
|
|
Clothing.ClothingCategory.MakeupEyeliner, Clothing.ClothingCategory.MakeupHighlighter,
|
|
Clothing.ClothingCategory.MakeupBlush, Clothing.ClothingCategory.MakeupSpecial,
|
|
Clothing.ClothingCategory.ComplexionFreckles, Clothing.ClothingCategory.ComplexionScars,
|
|
Clothing.ClothingCategory.ComplexionAcne, Clothing.ClothingCategory.FacialHairMustache,
|
|
Clothing.ClothingCategory.FacialHairBeard, Clothing.ClothingCategory.FacialHairStubble,
|
|
Clothing.ClothingCategory.FacialHairSideburns, Clothing.ClothingCategory.FacialHairGoatee,
|
|
Clothing.ClothingCategory.PierceNose, Clothing.ClothingCategory.PierceEyebrow,
|
|
Clothing.ClothingCategory.PierceSpecial, Clothing.ClothingCategory.Hair,
|
|
Clothing.ClothingCategory.HairShort, Clothing.ClothingCategory.HairMedium,
|
|
Clothing.ClothingCategory.HairLong, Clothing.ClothingCategory.HairUpdo,
|
|
Clothing.ClothingCategory.HairSpecial,
|
|
};
|
|
|
|
currentClothing.Clothing.RemoveAll( entry => !allowedCategories.Contains( entry.Clothing.Category ) );
|
|
currentClothing.Apply( BodyRenderer );
|
|
}
|
|
}
|