markingSet = new MarkingSet(appearance.Markings, speciesProto.MarkingPoints, markingManager, proto);
markingSet.EnsureValid(markingManager);
- switch (speciesProto.SkinColoration)
+ if (!Humanoid.SkinColor.VerifySkinColor(speciesProto.SkinColoration, skinColor))
{
- case HumanoidSkinColor.HumanToned:
- if (!Humanoid.SkinColor.VerifyHumanSkinTone(skinColor))
- {
- skinColor = Humanoid.SkinColor.ValidHumanSkinTone;
- }
-
- break;
- case HumanoidSkinColor.TintedHues:
- if (!Humanoid.SkinColor.VerifyTintedHues(skinColor))
- {
- skinColor = Humanoid.SkinColor.ValidTintedHuesSkinTone(skinColor);
- }
-
- break;
+ skinColor = Humanoid.SkinColor.ValidSkinTone(speciesProto.SkinColoration, skinColor);
}
+
markingSet.EnsureSpecies(species, skinColor, markingManager);
}
if (!Resolve(uid, ref humanoid))
return;
+ if (!_prototypeManager.TryIndex<SpeciesPrototype>(humanoid.Species, out var species))
+ {
+ return;
+ }
+
+ if (!SkinColor.VerifySkinColor(species.SkinColoration, skinColor))
+ {
+ skinColor = SkinColor.ValidSkinTone(species.SkinColoration, skinColor);
+ }
+
humanoid.SkinColor = skinColor;
if (sync)
// tinted hues just ensures saturation is always .1, or 10% saturation at all times
return Color.ToHsv(color).Y != .1f;
}
+
+ public static bool VerifySkinColor(HumanoidSkinColor type, Color color)
+ {
+ return type switch
+ {
+ HumanoidSkinColor.HumanToned => VerifyHumanSkinTone(color),
+ HumanoidSkinColor.TintedHues => VerifyTintedHues(color),
+ HumanoidSkinColor.Hues => true,
+ _ => false,
+ };
+ }
+
+ public static Color ValidSkinTone(HumanoidSkinColor type, Color color)
+ {
+ return type switch
+ {
+ HumanoidSkinColor.HumanToned => ValidHumanSkinTone,
+ HumanoidSkinColor.TintedHues => ValidTintedHuesSkinTone(color),
+ _ => color
+ };
+ }
}
public enum HumanoidSkinColor : byte