Fix slime hair translucent (#14478)

* fix

* move
This commit is contained in:
csqrb
2023-03-12 03:04:58 +06:00
committed by GitHub
parent 71272a81f7
commit b3a327988f
6 changed files with 16 additions and 15 deletions

View File

@@ -160,13 +160,13 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
//markings.RemoveCategory(MarkingCategories.FacialHair); //markings.RemoveCategory(MarkingCategories.FacialHair);
// We need to ensure hair before applying it or coloring can try depend on markings that can be invalid // 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) var hairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.Hair, out var hairAlpha, _prototypeManager)
? profile.Appearance.SkinColor : profile.Appearance.HairColor; ? profile.Appearance.SkinColor.WithAlpha(hairAlpha) : profile.Appearance.HairColor;
var hair = new Marking(profile.Appearance.HairStyleId, var hair = new Marking(profile.Appearance.HairStyleId,
new[] { hairColor }); new[] { hairColor });
var facialHairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.FacialHair, _prototypeManager) var facialHairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.FacialHair, out var facialHairAlpha, _prototypeManager)
? profile.Appearance.SkinColor : profile.Appearance.FacialHairColor; ? profile.Appearance.SkinColor.WithAlpha(facialHairAlpha) : profile.Appearance.FacialHairColor;
var facialHair = new Marking(profile.Appearance.FacialHairStyleId, var facialHair = new Marking(profile.Appearance.FacialHairStyleId,
new[] { facialHairColor }); new[] { facialHairColor });

View File

@@ -431,7 +431,7 @@ public sealed partial class MarkingPicker : Control
markingSet.AddBack(MarkingCategories.FacialHair, FacialHairMarking); markingSet.AddBack(MarkingCategories.FacialHair, FacialHairMarking);
} }
if (!_markingManager.MustMatchSkin(_currentSpecies, marking.BodyPart, _prototypeManager)) if (!_markingManager.MustMatchSkin(_currentSpecies, marking.BodyPart, out var _, _prototypeManager))
{ {
// Do default coloring // Do default coloring
var colors = MarkingColoring.GetMarkingLayerColors( var colors = MarkingColoring.GetMarkingLayerColors(

View File

@@ -1034,7 +1034,7 @@ namespace Content.Client.Preferences.UI
{ {
if (_markingManager.CanBeApplied(Profile.Species, hairProto, _prototypeManager)) 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; hairColor = Profile.Appearance.SkinColor;
} }
@@ -1069,7 +1069,7 @@ namespace Content.Client.Preferences.UI
{ {
if (_markingManager.CanBeApplied(Profile.Species, facialHairProto, _prototypeManager)) 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; facialHairColor = Profile.Appearance.SkinColor;
} }

View File

@@ -99,10 +99,10 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
// Hair/facial hair - this may eventually be deprecated. // 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 // 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) var hairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.Hair, out var hairAlpha, _prototypeManager)
? profile.Appearance.SkinColor : profile.Appearance.HairColor; ? profile.Appearance.SkinColor.WithAlpha(hairAlpha) : profile.Appearance.HairColor;
var facialHairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.FacialHair, _prototypeManager) var facialHairColor = _markingManager.MustMatchSkin(profile.Species, HumanoidVisualLayers.FacialHair, out var facialHairAlpha, _prototypeManager)
? profile.Appearance.SkinColor : profile.Appearance.FacialHairColor; ? profile.Appearance.SkinColor.WithAlpha(facialHairAlpha) : profile.Appearance.FacialHairColor;
if (_markingManager.Markings.TryGetValue(profile.Appearance.HairStyleId, out var hairPrototype) && if (_markingManager.Markings.TryGetValue(profile.Appearance.HairStyleId, out var hairPrototype) &&
_markingManager.CanBeApplied(profile.Species, hairPrototype, _prototypeManager)) _markingManager.CanBeApplied(profile.Species, hairPrototype, _prototypeManager))

View File

@@ -166,10 +166,9 @@ namespace Content.Shared.Humanoid.Markings
return true; 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); IoCManager.Resolve(ref prototypeManager);
var speciesProto = prototypeManager.Index<SpeciesPrototype>(species); var speciesProto = prototypeManager.Index<SpeciesPrototype>(species);
if ( if (
!prototypeManager.TryIndex(speciesProto.SpriteSet, out HumanoidSpeciesBaseSpritesPrototype? baseSprites) || !prototypeManager.TryIndex(speciesProto.SpriteSet, out HumanoidSpeciesBaseSpritesPrototype? baseSprites) ||
@@ -179,9 +178,11 @@ namespace Content.Shared.Humanoid.Markings
!sprite.MarkingsMatchSkin !sprite.MarkingsMatchSkin
) )
{ {
alpha = 1f;
return false; return false;
} }
alpha = sprite.LayerAlpha;
return true; return true;
} }
} }

View File

@@ -190,9 +190,9 @@ public sealed class MarkingSet
foreach (var marking in list) foreach (var marking in list)
{ {
if (markingManager.TryGetMarking(marking, out var prototype) && 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));
} }
} }
} }