New tiefling hue (#155)

* Добавлен отдельный тип цвета кожи для тифлингов

* Немного чистки

* Автоматом поправил, будет мешать при мердже
This commit is contained in:
Tornado Tech
2024-05-19 00:46:19 +10:00
committed by GitHub
parent 9690077532
commit 0aa0abb949
5 changed files with 85 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ using Content.Client.Lobby.UI.Roles;
using Content.Client.Message;
using Content.Client.Players.PlayTimeTracking;
using Content.Client.UserInterface.Systems.Guidebook;
using Content.Shared._CP14.Humanoid;
using Content.Shared.CCVar;
using Content.Shared.Clothing;
using Content.Shared.GameTicking;
@@ -1015,6 +1016,22 @@ namespace Content.Client.Lobby.UI
Profile = Profile.WithCharacterAppearance(Profile.Appearance.WithSkinColor(color));
break;
}
// CP14 - Custom HumanoidSkinColor - Start
case HumanoidSkinColor.TieflingHues:
{
if (!RgbSkinColorContainer.Visible)
{
Skin.Visible = false;
RgbSkinColorContainer.Visible = true;
}
var color = CP14SkinColor.MakeTieflingHueValid(_rgbSkinColorSelector.Color);
Markings.CurrentSkinColor = color;
Profile = Profile.WithCharacterAppearance(Profile.Appearance.WithSkinColor(color));
break;
}
// CP14 - Custom HumanoidSkinColor - End
}
SetDirty();
@@ -1231,6 +1248,19 @@ namespace Content.Client.Lobby.UI
break;
}
// CP14 - Custom HumanoidSkinColor - Start
case HumanoidSkinColor.TieflingHues:
{
if (!RgbSkinColorContainer.Visible)
{
Skin.Visible = false;
RgbSkinColorContainer.Visible = true;
}
_rgbSkinColorSelector.Color = CP14SkinColor.MakeTieflingHueValid(Profile.Appearance.SkinColor);
break;
}
// CP14 - Custom HumanoidSkinColor - End
}
}

View File

@@ -1,4 +1,5 @@
using System.Linq;
using Content.Shared._CP14.Humanoid;
using Content.Shared.Humanoid.Markings;
using Content.Shared.Humanoid.Prototypes;
using Robust.Shared.Prototypes;
@@ -164,6 +165,11 @@ public sealed partial class HumanoidCharacterAppearance : ICharacterAppearance,
case HumanoidSkinColor.VoxFeathers:
newSkinColor = Humanoid.SkinColor.ProportionalVoxColor(newSkinColor);
break;
// CP14 - Custom HumanoidSkinColor - Start
case HumanoidSkinColor.TieflingHues:
newSkinColor = CP14SkinColor.TieflingHues(newSkinColor);
break;
// CP14 - Custom HumanoidSkinColor - End
}
return new HumanoidCharacterAppearance(newHairStyle, newHairColor, newFacialHairStyle, newHairColor, newEyeColor, newSkinColor, new ());

View File

@@ -1,4 +1,5 @@
using System.Security.Cryptography;
using Content.Shared._CP14.Humanoid;
using Microsoft.VisualBasic.CompilerServices;
namespace Content.Shared.Humanoid;
@@ -234,6 +235,9 @@ public static class SkinColor
HumanoidSkinColor.TintedHues => VerifyTintedHues(color),
HumanoidSkinColor.Hues => VerifyHues(color),
HumanoidSkinColor.VoxFeathers => VerifyVoxFeathers(color),
// CP14 - Custom HumanoidSkinColor - Start
HumanoidSkinColor.TieflingHues => CP14SkinColor.VerifyTieflingHues(color),
// CP14 - Custom HumanoidSkinColor - End
_ => false,
};
}
@@ -246,6 +250,9 @@ public static class SkinColor
HumanoidSkinColor.TintedHues => ValidTintedHuesSkinTone(color),
HumanoidSkinColor.Hues => MakeHueValid(color),
HumanoidSkinColor.VoxFeathers => ClosestVoxColor(color),
// CP14 - Custom HumanoidSkinColor - Start
HumanoidSkinColor.TieflingHues => CP14SkinColor.MakeTieflingHueValid(color),
// CP14 - Custom HumanoidSkinColor - End
_ => color
};
}
@@ -257,4 +264,7 @@ public enum HumanoidSkinColor : byte
Hues,
VoxFeathers, // Vox feathers are limited to a specific color range
TintedHues, //This gives a color tint to a humanoid's skin (10% saturation with full hue range).
// CP14 - Custom HumanoidSkinColor - Start
TieflingHues,
// CP14 - Custom HumanoidSkinColor - End
}

View File

@@ -0,0 +1,38 @@
namespace Content.Shared._CP14.Humanoid;
public static class CP14SkinColor
{
public const float MinTieflingHuesLightness = 10f / 100f;
public const float MaxTieflingHuesLightness = 35f / 100f;
public static Color TieflingHues(Color color)
{
return color;
}
public static Color MakeTieflingHueValid(Color color)
{
color.G = Math.Min(color.G, color.B);
var hsl = Color.ToHsl(color);
hsl.Z = Math.Clamp(hsl.Z, MinTieflingHuesLightness, MaxTieflingHuesLightness);
return Color.FromHsl(hsl);
}
public static bool VerifyTieflingHues(Color color)
{
var hsl = Color.ToHsl(color);
var lightness = hsl.Z;
// Allows you to use shades of green, but not make green tieflings
if (color.G > color.B)
return false;
// No black or white holes instead of tieflings
if (lightness is < MinTieflingHuesLightness or > MaxTieflingHuesLightness)
return false;
return true;
}
}

View File

@@ -6,7 +6,7 @@
sprites: CP14MobTieflingSprites
markingLimits: CP14MobTieflingMarkingLimits
dollPrototype: CP14MobTieflingDummy
skinColoration: Hues
skinColoration: TieflingHues
maleFirstNames: CP14_Names_Tiefling_Male_First
femaleFirstNames: CP14_Names_Tiefling_Female_First
lastNames: CP14_Names_Tiefling_Last