SKREEEEEE (#3706)
* Import bird sprites and define basic mob. * SKREEEEEEEEE * Move hair styles to new sprite accessory prototypes. Basic stuff, no multi-species stuff yet. * Vox hair styles and clothes * Make HumanoidCharacterProfile.Default() a static default to fix tests. Usages that wanted the previous random behavior now call Random(). * Remove names from hair style prototypes. (They're in localization files) * Update Content.Shared/Actions/ActionType.cs (sk)reeee github Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
5ed935f30a
commit
0ac4c0e85c
@@ -1,6 +1,5 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Content.Shared.Preferences.Appearance;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -12,64 +11,64 @@ namespace Content.Shared.Preferences
|
||||
[Serializable, NetSerializable]
|
||||
public class HumanoidCharacterAppearance : ICharacterAppearance
|
||||
{
|
||||
public HumanoidCharacterAppearance(string hairStyleName,
|
||||
public HumanoidCharacterAppearance(string hairStyleId,
|
||||
Color hairColor,
|
||||
string facialHairStyleName,
|
||||
string facialHairStyleId,
|
||||
Color facialHairColor,
|
||||
Color eyeColor,
|
||||
Color skinColor)
|
||||
{
|
||||
HairStyleName = hairStyleName;
|
||||
HairStyleId = hairStyleId;
|
||||
HairColor = ClampColor(hairColor);
|
||||
FacialHairStyleName = facialHairStyleName;
|
||||
FacialHairStyleId = facialHairStyleId;
|
||||
FacialHairColor = ClampColor(facialHairColor);
|
||||
EyeColor = ClampColor(eyeColor);
|
||||
SkinColor = ClampColor(skinColor);
|
||||
}
|
||||
|
||||
public string HairStyleName { get; }
|
||||
public string HairStyleId { get; }
|
||||
public Color HairColor { get; }
|
||||
public string FacialHairStyleName { get; }
|
||||
public string FacialHairStyleId { get; }
|
||||
public Color FacialHairColor { get; }
|
||||
public Color EyeColor { get; }
|
||||
public Color SkinColor { get; }
|
||||
|
||||
public HumanoidCharacterAppearance WithHairStyleName(string newName)
|
||||
{
|
||||
return new(newName, HairColor, FacialHairStyleName, FacialHairColor, EyeColor, SkinColor);
|
||||
return new(newName, HairColor, FacialHairStyleId, FacialHairColor, EyeColor, SkinColor);
|
||||
}
|
||||
|
||||
public HumanoidCharacterAppearance WithHairColor(Color newColor)
|
||||
{
|
||||
return new(HairStyleName, newColor, FacialHairStyleName, FacialHairColor, EyeColor, SkinColor);
|
||||
return new(HairStyleId, newColor, FacialHairStyleId, FacialHairColor, EyeColor, SkinColor);
|
||||
}
|
||||
|
||||
public HumanoidCharacterAppearance WithFacialHairStyleName(string newName)
|
||||
{
|
||||
return new(HairStyleName, HairColor, newName, FacialHairColor, EyeColor, SkinColor);
|
||||
return new(HairStyleId, HairColor, newName, FacialHairColor, EyeColor, SkinColor);
|
||||
}
|
||||
|
||||
public HumanoidCharacterAppearance WithFacialHairColor(Color newColor)
|
||||
{
|
||||
return new(HairStyleName, HairColor, FacialHairStyleName, newColor, EyeColor, SkinColor);
|
||||
return new(HairStyleId, HairColor, FacialHairStyleId, newColor, EyeColor, SkinColor);
|
||||
}
|
||||
|
||||
public HumanoidCharacterAppearance WithEyeColor(Color newColor)
|
||||
{
|
||||
return new(HairStyleName, HairColor, FacialHairStyleName, FacialHairColor, newColor, SkinColor);
|
||||
return new(HairStyleId, HairColor, FacialHairStyleId, FacialHairColor, newColor, SkinColor);
|
||||
}
|
||||
|
||||
public HumanoidCharacterAppearance WithSkinColor(Color newColor)
|
||||
{
|
||||
return new(HairStyleName, HairColor, FacialHairStyleName, FacialHairColor, EyeColor, newColor);
|
||||
return new(HairStyleId, HairColor, FacialHairStyleId, FacialHairColor, EyeColor, newColor);
|
||||
}
|
||||
|
||||
public static HumanoidCharacterAppearance Default()
|
||||
{
|
||||
return new(
|
||||
"Bald",
|
||||
HairStyles.DefaultHairStyle,
|
||||
Color.Black,
|
||||
"Shaved",
|
||||
HairStyles.DefaultFacialHairStyle,
|
||||
Color.Black,
|
||||
Color.Black,
|
||||
Color.FromHex("#C0967F")
|
||||
@@ -79,12 +78,15 @@ namespace Content.Shared.Preferences
|
||||
public static HumanoidCharacterAppearance Random(Sex sex)
|
||||
{
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
var prototypes = IoCManager.Resolve<SpriteAccessoryManager>();
|
||||
var hairStyles = prototypes.AccessoriesForCategory(SpriteAccessoryCategories.HumanHair);
|
||||
var facialHairStyles = prototypes.AccessoriesForCategory(SpriteAccessoryCategories.HumanHair);
|
||||
|
||||
var newHairStyle = random.Pick(HairStyles.HairStylesMap.Keys.ToList());
|
||||
var newHairStyle = random.Pick(hairStyles).ID;
|
||||
|
||||
var newFacialHairStyle = sex == Sex.Female
|
||||
? HairStyles.DefaultFacialHairStyle
|
||||
: random.Pick(HairStyles.FacialHairStylesMap.Keys.ToList());
|
||||
: random.Pick(facialHairStyles).ID;
|
||||
|
||||
var newHairColor = random.Pick(HairStyles.RealisticHairColors);
|
||||
newHairColor = newHairColor
|
||||
@@ -108,24 +110,17 @@ namespace Content.Shared.Preferences
|
||||
|
||||
public static HumanoidCharacterAppearance EnsureValid(HumanoidCharacterAppearance appearance)
|
||||
{
|
||||
string hairStyleName;
|
||||
if (!HairStyles.HairStylesMap.ContainsKey(appearance.HairStyleName))
|
||||
var mgr = IoCManager.Resolve<SpriteAccessoryManager>();
|
||||
var hairStyleId = appearance.HairStyleId;
|
||||
if (!mgr.IsValidAccessoryInCategory(hairStyleId, SpriteAccessoryCategories.HumanHair))
|
||||
{
|
||||
hairStyleName = HairStyles.DefaultHairStyle;
|
||||
}
|
||||
else
|
||||
{
|
||||
hairStyleName = appearance.HairStyleName;
|
||||
hairStyleId = HairStyles.DefaultHairStyle;
|
||||
}
|
||||
|
||||
string facialHairStyleName;
|
||||
if (!HairStyles.FacialHairStylesMap.ContainsKey(appearance.FacialHairStyleName))
|
||||
var facialHairStyleId = appearance.HairStyleId;
|
||||
if (!mgr.IsValidAccessoryInCategory(hairStyleId, SpriteAccessoryCategories.HumanFacialHair))
|
||||
{
|
||||
facialHairStyleName = HairStyles.DefaultFacialHairStyle;
|
||||
}
|
||||
else
|
||||
{
|
||||
facialHairStyleName = appearance.FacialHairStyleName;
|
||||
facialHairStyleId = HairStyles.DefaultFacialHairStyle;
|
||||
}
|
||||
|
||||
var hairColor = ClampColor(appearance.HairColor);
|
||||
@@ -134,9 +129,9 @@ namespace Content.Shared.Preferences
|
||||
var skinColor = ClampColor(appearance.SkinColor);
|
||||
|
||||
return new HumanoidCharacterAppearance(
|
||||
hairStyleName,
|
||||
hairStyleId,
|
||||
hairColor,
|
||||
facialHairStyleName,
|
||||
facialHairStyleId,
|
||||
facialHairColor,
|
||||
eyeColor,
|
||||
skinColor);
|
||||
@@ -145,9 +140,9 @@ namespace Content.Shared.Preferences
|
||||
public bool MemberwiseEquals(ICharacterAppearance maybeOther)
|
||||
{
|
||||
if (maybeOther is not HumanoidCharacterAppearance other) return false;
|
||||
if (HairStyleName != other.HairStyleName) return false;
|
||||
if (HairStyleId != other.HairStyleId) return false;
|
||||
if (!HairColor.Equals(other.HairColor)) return false;
|
||||
if (FacialHairStyleName != other.FacialHairStyleName) return false;
|
||||
if (FacialHairStyleId != other.FacialHairStyleId) return false;
|
||||
if (!FacialHairColor.Equals(other.FacialHairColor)) return false;
|
||||
if (!EyeColor.Equals(other.EyeColor)) return false;
|
||||
if (!SkinColor.Equals(other.SkinColor)) return false;
|
||||
|
||||
Reference in New Issue
Block a user