diff --git a/Content.Client/Humanoid/HumanoidAppearanceSystem.cs b/Content.Client/Humanoid/HumanoidAppearanceSystem.cs index 47ef6a0607..cf37d730e5 100644 --- a/Content.Client/Humanoid/HumanoidAppearanceSystem.cs +++ b/Content.Client/Humanoid/HumanoidAppearanceSystem.cs @@ -160,13 +160,13 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem //markings.RemoveCategory(MarkingCategories.FacialHair); // We need to ensure hair before applying it or coloring can try depend on markings that can be invalid - var hairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.Hair, _prototypeManager) - ? profile.Appearance.SkinColor : profile.Appearance.HairColor; + var hairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.Hair, out var hairAlpha, _prototypeManager) + ? profile.Appearance.SkinColor.WithAlpha(hairAlpha) : profile.Appearance.HairColor; var hair = new Marking(profile.Appearance.HairStyleId, new[] { hairColor }); - var facialHairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.FacialHair, _prototypeManager) - ? profile.Appearance.SkinColor : profile.Appearance.FacialHairColor; + var facialHairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.FacialHair, out var facialHairAlpha, _prototypeManager) + ? profile.Appearance.SkinColor.WithAlpha(facialHairAlpha) : profile.Appearance.FacialHairColor; var facialHair = new Marking(profile.Appearance.FacialHairStyleId, new[] { facialHairColor }); diff --git a/Content.Client/Humanoid/MarkingPicker.xaml.cs b/Content.Client/Humanoid/MarkingPicker.xaml.cs index f284b84cd2..0f314783e2 100644 --- a/Content.Client/Humanoid/MarkingPicker.xaml.cs +++ b/Content.Client/Humanoid/MarkingPicker.xaml.cs @@ -431,7 +431,7 @@ public sealed partial class MarkingPicker : Control markingSet.AddBack(MarkingCategories.FacialHair, FacialHairMarking); } - if (!_markingManager.MustMatchSkin(_currentSpecies, marking.BodyPart, _prototypeManager)) + if (!_markingManager.MustMatchSkin(_currentSpecies, marking.BodyPart, out var _, _prototypeManager)) { // Do default coloring var colors = MarkingColoring.GetMarkingLayerColors( diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs index 4330a87945..d95d72b937 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs @@ -1034,7 +1034,7 @@ namespace Content.Client.Preferences.UI { if (_markingManager.CanBeApplied(Profile.Species, hairProto, _prototypeManager)) { - if (_markingManager.MustMatchSkin(Profile.Species, HumanoidVisualLayers.Hair, _prototypeManager)) + if (_markingManager.MustMatchSkin(Profile.Species, HumanoidVisualLayers.Hair, out var _, _prototypeManager)) { hairColor = Profile.Appearance.SkinColor; } @@ -1069,7 +1069,7 @@ namespace Content.Client.Preferences.UI { if (_markingManager.CanBeApplied(Profile.Species, facialHairProto, _prototypeManager)) { - if (_markingManager.MustMatchSkin(Profile.Species, HumanoidVisualLayers.Hair, _prototypeManager)) + if (_markingManager.MustMatchSkin(Profile.Species, HumanoidVisualLayers.Hair, out var _, _prototypeManager)) { facialHairColor = Profile.Appearance.SkinColor; } diff --git a/Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.cs b/Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.cs index 669c1cb1b4..5cf3999d8e 100644 --- a/Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.cs +++ b/Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.cs @@ -99,10 +99,10 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS // Hair/facial hair - this may eventually be deprecated. // We need to ensure hair before applying it or coloring can try depend on markings that can be invalid - var hairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.Hair, _prototypeManager) - ? profile.Appearance.SkinColor : profile.Appearance.HairColor; - var facialHairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.FacialHair, _prototypeManager) - ? profile.Appearance.SkinColor : profile.Appearance.FacialHairColor; + var hairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.Hair, out var hairAlpha, _prototypeManager) + ? profile.Appearance.SkinColor.WithAlpha(hairAlpha) : profile.Appearance.HairColor; + var facialHairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.FacialHair, out var facialHairAlpha, _prototypeManager) + ? profile.Appearance.SkinColor.WithAlpha(facialHairAlpha) : profile.Appearance.FacialHairColor; if (_markingManager.Markings.TryGetValue(profile.Appearance.HairStyleId, out var hairPrototype) && _markingManager.CanBeApplied(profile.Species, hairPrototype, _prototypeManager)) diff --git a/Content.Shared/Humanoid/Markings/MarkingManager.cs b/Content.Shared/Humanoid/Markings/MarkingManager.cs index 08a721d345..9a72f5eebc 100644 --- a/Content.Shared/Humanoid/Markings/MarkingManager.cs +++ b/Content.Shared/Humanoid/Markings/MarkingManager.cs @@ -166,10 +166,9 @@ namespace Content.Shared.Humanoid.Markings return true; } - public bool MustMatchSkin(string species, HumanoidVisualLayers layer, IPrototypeManager? prototypeManager = null) + public bool MustMatchSkin(string species, HumanoidVisualLayers layer, out float alpha, IPrototypeManager? prototypeManager = null) { IoCManager.Resolve(ref prototypeManager); - var speciesProto = prototypeManager.Index(species); if ( !prototypeManager.TryIndex(speciesProto.SpriteSet, out HumanoidSpeciesBaseSpritesPrototype? baseSprites) || @@ -179,9 +178,11 @@ namespace Content.Shared.Humanoid.Markings !sprite.MarkingsMatchSkin ) { + alpha = 1f; return false; } + alpha = sprite.LayerAlpha; return true; } } diff --git a/Content.Shared/Humanoid/Markings/MarkingsSet.cs b/Content.Shared/Humanoid/Markings/MarkingsSet.cs index 9535e28e1a..393ca6e135 100644 --- a/Content.Shared/Humanoid/Markings/MarkingsSet.cs +++ b/Content.Shared/Humanoid/Markings/MarkingsSet.cs @@ -190,9 +190,9 @@ public sealed class MarkingSet foreach (var marking in list) { if (markingManager.TryGetMarking(marking, out var prototype) && - markingManager.MustMatchSkin(species, prototype.BodyPart, prototypeManager)) + markingManager.MustMatchSkin(species, prototype.BodyPart, out var alpha, prototypeManager)) { - marking.SetColor(skinColor.Value); + marking.SetColor(skinColor.Value.WithAlpha(alpha)); } } }