[Feat] Тонкие спрайты снова в строю (#102)
* Revert "Hair Overhaul (#19298)"
This reverts commit 9491f322de.
# Conflicts:
# Resources/Textures/Mobs/Customization/human_hair.rsi/a.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/afro.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/afro2.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/bigafro.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/cornrows2.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/emofringe.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/keanu.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/long.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/long2.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/long3.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/meta.json
# Resources/Textures/Mobs/Customization/human_hair.rsi/modern.png
# Resources/Textures/Mobs/Customization/human_hair.rsi/quiff.png
* add: возврат системы тонкоспрайтов
* fix: небольшие фиксы после реверта причесок
* add: старые текстуры для slim бодитайпа
* fix: фикс причесок после апстрима
This commit is contained in:
@@ -42,9 +42,8 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
component.BaseLayers.Clear();
|
||||
|
||||
// add default species layers
|
||||
var speciesProto = _prototypeManager.Index(component.Species);
|
||||
var baseSprites = _prototypeManager.Index<HumanoidSpeciesBaseSpritesPrototype>(speciesProto.SpriteSet);
|
||||
foreach (var (key, id) in baseSprites.Sprites)
|
||||
var bodyTypeProto = _prototypeManager.Index<BodyTypePrototype>(component.BodyType);
|
||||
foreach (var (key, id) in bodyTypeProto.Sprites)
|
||||
{
|
||||
oldLayers.Remove(key);
|
||||
if (!component.CustomBaseLayers.ContainsKey(key))
|
||||
@@ -108,13 +107,17 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
/// This should not be used if the entity is owned by the server. The server will otherwise
|
||||
/// override this with the appearance data it sends over.
|
||||
/// </remarks>
|
||||
public override void LoadProfile(EntityUid uid, HumanoidCharacterProfile profile, HumanoidAppearanceComponent? humanoid = null)
|
||||
public override void LoadProfile(
|
||||
EntityUid uid,
|
||||
HumanoidCharacterProfile profile,
|
||||
HumanoidAppearanceComponent? humanoid = null)
|
||||
{
|
||||
if (!Resolve(uid, ref humanoid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
humanoid.BodyType = profile.BodyType;
|
||||
var customBaseLayers = new Dictionary<HumanoidVisualLayers, CustomBaseLayerInfo>();
|
||||
|
||||
var speciesPrototype = _prototypeManager.Index<SpeciesPrototype>(profile.Species);
|
||||
@@ -142,15 +145,19 @@ 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, out var hairAlpha, _prototypeManager)
|
||||
var hairColor = _markingManager.MustMatchSkin(profile.BodyType, 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, out var facialHairAlpha, _prototypeManager)
|
||||
var facialHairColor = _markingManager.MustMatchSkin(profile.BodyType, HumanoidVisualLayers.FacialHair,
|
||||
out var facialHairAlpha, _prototypeManager)
|
||||
? profile.Appearance.SkinColor.WithAlpha(facialHairAlpha)
|
||||
: profile.Appearance.FacialHairColor;
|
||||
|
||||
var facialHair = new Marking(profile.Appearance.FacialHairStyleId,
|
||||
new[] { facialHairColor });
|
||||
|
||||
@@ -158,6 +165,7 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
{
|
||||
markings.AddBack(MarkingCategories.Hair, hair);
|
||||
}
|
||||
|
||||
if (_markingManager.CanBeApplied(profile.Species, profile.Sex, facialHair, _prototypeManager))
|
||||
{
|
||||
markings.AddBack(MarkingCategories.FacialHair, facialHair);
|
||||
@@ -172,10 +180,13 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
profile.Appearance.EyeColor,
|
||||
markings
|
||||
);
|
||||
|
||||
markings.AddBack(prototype.MarkingCategory, new Marking(marking.MarkingId, markingColors));
|
||||
}
|
||||
|
||||
markings.EnsureSpecies(profile.Species, profile.Appearance.SkinColor, _markingManager, _prototypeManager);
|
||||
markings.EnsureSpecies(profile.Species, profile.BodyType, profile.Appearance.SkinColor, _markingManager,
|
||||
_prototypeManager);
|
||||
|
||||
markings.EnsureSexes(profile.Sex, _markingManager);
|
||||
markings.EnsureDefault(
|
||||
profile.Appearance.SkinColor,
|
||||
@@ -190,6 +201,7 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
humanoid.CustomBaseLayers = customBaseLayers;
|
||||
humanoid.Sex = profile.Sex;
|
||||
humanoid.Gender = profile.Gender;
|
||||
humanoid.BodyType = profile.BodyType;
|
||||
humanoid.Age = profile.Age;
|
||||
humanoid.Species = profile.Species;
|
||||
humanoid.SkinColor = profile.Appearance.SkinColor;
|
||||
@@ -261,7 +273,9 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
spriteComp.RemoveLayer(index);
|
||||
}
|
||||
}
|
||||
private void ApplyMarking(MarkingPrototype markingPrototype,
|
||||
|
||||
private void ApplyMarking(
|
||||
MarkingPrototype markingPrototype,
|
||||
IReadOnlyList<Color>? colors,
|
||||
bool visible,
|
||||
HumanoidAppearanceComponent humanoid,
|
||||
@@ -274,7 +288,7 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
|
||||
visible &= !IsHidden(humanoid, markingPrototype.BodyPart);
|
||||
visible &= humanoid.BaseLayers.TryGetValue(markingPrototype.BodyPart, out var setting)
|
||||
&& setting.AllowsMarkings;
|
||||
&& setting.AllowsMarkings;
|
||||
|
||||
for (var j = 0; j < markingPrototype.Sprites.Count; j++)
|
||||
{
|
||||
@@ -315,7 +329,12 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetSkinColor(EntityUid uid, Color skinColor, bool sync = true, bool verify = true, HumanoidAppearanceComponent? humanoid = null)
|
||||
public override void SetSkinColor(
|
||||
EntityUid uid,
|
||||
Color skinColor,
|
||||
bool sync = true,
|
||||
bool verify = true,
|
||||
HumanoidAppearanceComponent? humanoid = null)
|
||||
{
|
||||
if (!Resolve(uid, ref humanoid) || humanoid.SkinColor == skinColor)
|
||||
return;
|
||||
@@ -366,7 +385,8 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
{
|
||||
foreach (var marking in markingList)
|
||||
{
|
||||
if (_markingManager.TryGetMarking(marking, out var markingPrototype) && markingPrototype.BodyPart == layer)
|
||||
if (_markingManager.TryGetMarking(marking, out var markingPrototype) &&
|
||||
markingPrototype.BodyPart == layer)
|
||||
ApplyMarking(markingPrototype, marking.MarkingColors, marking.Visible, humanoid, sprite);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public sealed class HumanoidMarkingModifierBoundUserInterface : BoundUserInterfa
|
||||
return;
|
||||
}
|
||||
|
||||
_window.SetState(cast.MarkingSet, cast.Species, cast.Sex, cast.SkinColor, cast.CustomBaseLayers);
|
||||
_window.SetState(cast.MarkingSet, cast.Species, cast.Sex, cast.BodyType, cast.SkinColor, cast.CustomBaseLayers);
|
||||
}
|
||||
|
||||
private void SendMarkingSet(MarkingSet set)
|
||||
|
||||
@@ -59,10 +59,12 @@ public sealed partial class HumanoidMarkingModifierWindow : DefaultWindow
|
||||
string? state = _protoMan.HasIndex<HumanoidSpeciesSpriteLayer>(modifier.Text) ? modifier.Text : null;
|
||||
OnLayerInfoModified?.Invoke(layer, new CustomBaseLayerInfo(state, modifier.Color));
|
||||
}
|
||||
|
||||
public void SetState(
|
||||
MarkingSet markings,
|
||||
string species,
|
||||
Sex sex,
|
||||
string bodyType,
|
||||
Color skinColor,
|
||||
Dictionary<HumanoidVisualLayers, CustomBaseLayerInfo> info
|
||||
)
|
||||
@@ -84,7 +86,7 @@ public sealed partial class HumanoidMarkingModifierWindow : DefaultWindow
|
||||
eyesColor = eyes.Color.Value;
|
||||
}
|
||||
|
||||
MarkingPickerWidget.SetData(markings, species, sex, skinColor, eyesColor);
|
||||
MarkingPickerWidget.SetData(markings, species, sex, bodyType, skinColor, eyesColor);
|
||||
}
|
||||
|
||||
private sealed class HumanoidBaseLayerModifier : BoxContainer
|
||||
@@ -95,7 +97,9 @@ public sealed partial class HumanoidMarkingModifierWindow : DefaultWindow
|
||||
private BoxContainer _infoBox;
|
||||
|
||||
public bool Enabled => _enable.Pressed;
|
||||
|
||||
public string Text => _lineEdit.Text;
|
||||
|
||||
public Color Color => _colorSliders.Color;
|
||||
|
||||
public Action? OnStateChanged;
|
||||
@@ -109,6 +113,7 @@ public sealed partial class HumanoidMarkingModifierWindow : DefaultWindow
|
||||
MinWidth = 250,
|
||||
HorizontalExpand = true
|
||||
};
|
||||
|
||||
AddChild(labelBox);
|
||||
|
||||
labelBox.AddChild(new Label
|
||||
@@ -116,6 +121,7 @@ public sealed partial class HumanoidMarkingModifierWindow : DefaultWindow
|
||||
HorizontalExpand = true,
|
||||
Text = layer.ToString()
|
||||
});
|
||||
|
||||
_enable = new CheckBox
|
||||
{
|
||||
Text = "Enable",
|
||||
@@ -128,6 +134,7 @@ public sealed partial class HumanoidMarkingModifierWindow : DefaultWindow
|
||||
Orientation = LayoutOrientation.Vertical,
|
||||
Visible = false
|
||||
};
|
||||
|
||||
_enable.OnToggled += args =>
|
||||
{
|
||||
_infoBox.Visible = args.Pressed;
|
||||
@@ -135,7 +142,7 @@ public sealed partial class HumanoidMarkingModifierWindow : DefaultWindow
|
||||
};
|
||||
|
||||
var lineEditBox = new BoxContainer();
|
||||
lineEditBox.AddChild(new Label { Text = "Prototype id: "});
|
||||
lineEditBox.AddChild(new Label { Text = "Prototype id: " });
|
||||
|
||||
// TODO: This line edit should really be an options / dropdown selector, not text.
|
||||
_lineEdit = new() { MinWidth = 200 };
|
||||
|
||||
@@ -40,6 +40,7 @@ public sealed partial class MarkingPicker : Control
|
||||
private List<MarkingCategories> _markingCategories = Enum.GetValues<MarkingCategories>().ToList();
|
||||
|
||||
private string _currentSpecies = SharedHumanoidAppearanceSystem.DefaultSpecies;
|
||||
private string _currentBodyType = SharedHumanoidAppearanceSystem.DefaultBodyType;
|
||||
private Sex _currentSex = Sex.Unsexed;
|
||||
public Color CurrentSkinColor = Color.White;
|
||||
public Color CurrentEyeColor = Color.Black;
|
||||
@@ -83,7 +84,7 @@ public sealed partial class MarkingPicker : Control
|
||||
}
|
||||
}
|
||||
|
||||
public void SetData(List<Marking> newMarkings, string species, Sex sex, Color skinColor, Color eyeColor)
|
||||
public void SetData(List<Marking> newMarkings, string species, Sex sex, string bodyType, Color skinColor, Color eyeColor)
|
||||
{
|
||||
var pointsProto = _prototypeManager
|
||||
.Index<SpeciesPrototype>(species).MarkingPoints;
|
||||
@@ -91,7 +92,7 @@ public sealed partial class MarkingPicker : Control
|
||||
|
||||
if (!IgnoreSpecies)
|
||||
{
|
||||
_currentMarkings.EnsureSpecies(species, skinColor, _markingManager); // should be validated server-side but it can't hurt
|
||||
_currentMarkings.EnsureSpecies(species, bodyType, skinColor, _markingManager); // should be validated server-side but it can't hurt
|
||||
}
|
||||
|
||||
_currentSpecies = species;
|
||||
@@ -103,13 +104,13 @@ public sealed partial class MarkingPicker : Control
|
||||
PopulateUsed();
|
||||
}
|
||||
|
||||
public void SetData(MarkingSet set, string species, Sex sex, Color skinColor, Color eyeColor)
|
||||
public void SetData(MarkingSet set, string species, Sex sex, string bodyType, Color skinColor, Color eyeColor)
|
||||
{
|
||||
_currentMarkings = set;
|
||||
|
||||
if (!IgnoreSpecies)
|
||||
{
|
||||
_currentMarkings.EnsureSpecies(species, skinColor, _markingManager); // should be validated server-side but it can't hurt
|
||||
_currentMarkings.EnsureSpecies(species, bodyType, skinColor, _markingManager); // should be validated server-side but it can't hurt
|
||||
}
|
||||
|
||||
_currentSpecies = species;
|
||||
@@ -234,7 +235,7 @@ public sealed partial class MarkingPicker : Control
|
||||
|
||||
if (!IgnoreSpecies)
|
||||
{
|
||||
_currentMarkings.EnsureSpecies(_currentSpecies, null, _markingManager);
|
||||
_currentMarkings.EnsureSpecies(_currentSpecies, _currentBodyType, null, _markingManager);
|
||||
}
|
||||
|
||||
// walk backwards through the list for visual purposes
|
||||
@@ -338,7 +339,7 @@ public sealed partial class MarkingPicker : Control
|
||||
var speciesPrototype = _prototypeManager.Index<SpeciesPrototype>(species);
|
||||
|
||||
_currentMarkings = new(markingList, speciesPrototype.MarkingPoints, _markingManager, _prototypeManager);
|
||||
_currentMarkings.EnsureSpecies(species, null, _markingManager);
|
||||
_currentMarkings.EnsureSpecies(species, _currentBodyType, null, _markingManager);
|
||||
_currentMarkings.EnsureSexes(_currentSex, _markingManager);
|
||||
|
||||
Populate(CMarkingSearch.Text);
|
||||
@@ -353,7 +354,7 @@ public sealed partial class MarkingPicker : Control
|
||||
var speciesPrototype = _prototypeManager.Index<SpeciesPrototype>(_currentSpecies);
|
||||
|
||||
_currentMarkings = new(markingList, speciesPrototype.MarkingPoints, _markingManager, _prototypeManager);
|
||||
_currentMarkings.EnsureSpecies(_currentSpecies, null, _markingManager);
|
||||
_currentMarkings.EnsureSpecies(_currentSpecies, _currentBodyType, null, _markingManager);
|
||||
_currentMarkings.EnsureSexes(_currentSex, _markingManager);
|
||||
|
||||
Populate(CMarkingSearch.Text);
|
||||
|
||||
Reference in New Issue
Block a user