closet skeleton event (#19802)

This commit is contained in:
Nemanja
2023-09-19 01:05:17 -04:00
committed by GitHub
parent 283a90bf9f
commit fdbadbe579
7 changed files with 105 additions and 3 deletions

View File

@@ -2,6 +2,9 @@ namespace Content.Shared.Humanoid;
public static class SkinColor
{
public const float MaxTintedHuesSaturation = 0.1f;
public const float MinTintedHuesLightness = 0.85f;
public static Color ValidHumanSkinTone => Color.FromHsv(new Vector4(0.07f, 0.2f, 1f, 1f));
/// <summary>
@@ -117,8 +120,9 @@ public static class SkinColor
/// <returns>Tinted hue color</returns>
public static Color TintedHues(Color color)
{
var newColor = Color.ToHsv(color);
newColor.Y *= 0.1f;
var newColor = Color.ToHsl(color);
newColor.Y *= MaxTintedHuesSaturation;
newColor.Z = MathHelper.Lerp(MinTintedHuesLightness, 1f, newColor.Z);
return Color.FromHsv(newColor);
}
@@ -131,7 +135,7 @@ public static class SkinColor
public static bool VerifyTintedHues(Color color)
{
// tinted hues just ensures saturation is always .1, or 10% saturation at all times
return Color.ToHsv(color).Y != .1f;
return Color.ToHsl(color).Y <= MaxTintedHuesSaturation && Color.ToHsl(color).Z >= MinTintedHuesLightness;
}
public static bool VerifySkinColor(HumanoidSkinColor type, Color color)