[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:
Remuchi
2024-02-24 17:06:32 +07:00
committed by GitHub
parent ac2d162c53
commit 3515e87f74
850 changed files with 6170 additions and 675 deletions

View File

@@ -1,5 +1,4 @@
using System.Linq;
using Content.Shared.Decals;
using Content.Shared.Humanoid.Markings;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Preferences;
@@ -26,12 +25,15 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
[ValidatePrototypeId<SpeciesPrototype>]
public const string DefaultSpecies = "Human";
public const string DefaultBodyType = "HumanNormal";
public const string DefaultVoice = "Eugene";
public static readonly Dictionary<Sex, string> DefaultSexVoice = new()
{
{Sex.Male, "Eugene"},
{Sex.Female, "Kseniya"},
{Sex.Unsexed, "Xenia"},
{ Sex.Male, "Eugene" },
{ Sex.Female, "Kseniya" },
{ Sex.Unsexed, "Xenia" },
};
public override void Initialize()
@@ -69,7 +71,8 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
/// <param name="uid">Humanoid mob's UID</param>
/// <param name="layer">Layer to toggle visibility for</param>
/// <param name="humanoid">Humanoid component of the entity</param>
public void SetLayerVisibility(EntityUid uid,
public void SetLayerVisibility(
EntityUid uid,
HumanoidVisualLayers layer,
bool visible,
bool permanent = false,
@@ -92,7 +95,11 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
/// <param name="visible">The visibility state of the layers given</param>
/// <param name="permanent">If this is a permanent change, or temporary. Permanent layers are stored in their own hash set.</param>
/// <param name="humanoid">Humanoid component of the entity</param>
public void SetLayersVisibility(EntityUid uid, IEnumerable<HumanoidVisualLayers> layers, bool visible, bool permanent = false,
public void SetLayersVisibility(
EntityUid uid,
IEnumerable<HumanoidVisualLayers> layers,
bool visible,
bool permanent = false,
HumanoidAppearanceComponent? humanoid = null)
{
if (!Resolve(uid, ref humanoid))
@@ -141,7 +148,11 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
/// <param name="species">The species to set the mob to. Will return if the species prototype was invalid.</param>
/// <param name="sync">Whether to immediately synchronize this to the humanoid mob, or not.</param>
/// <param name="humanoid">Humanoid component of the entity</param>
public void SetSpecies(EntityUid uid, string species, bool sync = true, HumanoidAppearanceComponent? humanoid = null)
public void SetSpecies(
EntityUid uid,
string species,
bool sync = true,
HumanoidAppearanceComponent? humanoid = null)
{
if (!Resolve(uid, ref humanoid) || !_prototypeManager.TryIndex<SpeciesPrototype>(species, out var prototype))
{
@@ -149,12 +160,14 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
}
humanoid.Species = species;
humanoid.MarkingSet.EnsureSpecies(species, humanoid.SkinColor, _markingManager);
humanoid.MarkingSet.EnsureSpecies(species, humanoid.BodyType, humanoid.SkinColor, _markingManager);
var oldMarkings = humanoid.MarkingSet.GetForwardEnumerator().ToList();
humanoid.MarkingSet = new(oldMarkings, prototype.MarkingPoints, _markingManager, _prototypeManager);
humanoid.MarkingSet = new MarkingSet(oldMarkings, prototype.MarkingPoints, _markingManager, _prototypeManager);
if (sync)
Dirty(humanoid);
{
Dirty(uid, humanoid);
}
}
/// <summary>
@@ -166,7 +179,12 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
/// <param name="sync">Whether to synchronize this to the humanoid mob, or not.</param>
/// <param name="verify">Whether to verify the skin color can be set on this humanoid or not</param>
/// <param name="humanoid">Humanoid component of the entity</param>
public virtual void SetSkinColor(EntityUid uid, Color skinColor, bool sync = true, bool verify = true, HumanoidAppearanceComponent? humanoid = null)
public virtual void SetSkinColor(
EntityUid uid,
Color skinColor,
bool sync = true,
bool verify = true,
HumanoidAppearanceComponent? humanoid = null)
{
if (!Resolve(uid, ref humanoid))
return;
@@ -196,7 +214,11 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
/// <param name="id">The ID of the sprite to use. See <see cref="HumanoidSpeciesSpriteLayer"/>.</param>
/// <param name="sync">Whether to synchronize this to the humanoid mob, or not.</param>
/// <param name="humanoid">Humanoid component of the entity</param>
public void SetBaseLayerId(EntityUid uid, HumanoidVisualLayers layer, string? id, bool sync = true,
public void SetBaseLayerId(
EntityUid uid,
HumanoidVisualLayers layer,
string? id,
bool sync = true,
HumanoidAppearanceComponent? humanoid = null)
{
if (!Resolve(uid, ref humanoid))
@@ -218,7 +240,12 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
/// <param name="uid">The humanoid mob's UID.</param>
/// <param name="layer">The layer to target on this humanoid mob.</param>
/// <param name="color">The color to set this base layer to.</param>
public void SetBaseLayerColor(EntityUid uid, HumanoidVisualLayers layer, Color? color, bool sync = true, HumanoidAppearanceComponent? humanoid = null)
public void SetBaseLayerColor(
EntityUid uid,
HumanoidVisualLayers layer,
Color? color,
bool sync = true,
HumanoidAppearanceComponent? humanoid = null)
{
if (!Resolve(uid, ref humanoid))
return;
@@ -255,13 +282,27 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
}
}
public List<BodyTypePrototype> GetValidBodyTypes(SpeciesPrototype species, Sex sex)
{
return species.BodyTypes.Select(protoId => _prototypeManager.Index<BodyTypePrototype>(protoId))
.Where(proto => !proto.SexRestrictions.Contains(sex.ToString())).ToList();
}
public static bool IsBodyTypeValid(BodyTypePrototype bodyType, SpeciesPrototype species, Sex sex)
{
return species.BodyTypes.Contains(bodyType.ID);
}
/// <summary>
/// Loads a humanoid character profile directly onto this humanoid mob.
/// </summary>
/// <param name="uid">The mob's entity UID.</param>
/// <param name="profile">The character profile to load.</param>
/// <param name="humanoid">Humanoid component of the entity</param>
public virtual void LoadProfile(EntityUid uid, HumanoidCharacterProfile profile, HumanoidAppearanceComponent? humanoid = null)
public virtual void LoadProfile(
EntityUid uid,
HumanoidCharacterProfile profile,
HumanoidAppearanceComponent? humanoid = null)
{
if (!Resolve(uid, ref humanoid))
{
@@ -295,10 +336,15 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
// 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, 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;
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, profile.Sex, hairPrototype, _prototypeManager))
@@ -312,7 +358,9 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
AddMarking(uid, profile.Appearance.FacialHairStyleId, facialHairColor, false);
}
humanoid.MarkingSet.EnsureSpecies(profile.Species, profile.Appearance.SkinColor, _markingManager, _prototypeManager);
humanoid.MarkingSet.EnsureSpecies(profile.Species, profile.BodyType, profile.Appearance.SkinColor,
_markingManager,
_prototypeManager);
// Finally adding marking with forced colors
foreach (var (marking, prototype) in markingFColored)
@@ -323,6 +371,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
profile.Appearance.EyeColor,
humanoid.MarkingSet
);
AddMarking(uid, marking.MarkingId, markingColors, false);
}
@@ -348,7 +397,13 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
/// <param name="sync">Whether to immediately sync this marking or not</param>
/// <param name="forced">If this marking was forced (ignores marking points)</param>
/// <param name="humanoid">Humanoid component of the entity</param>
public void AddMarking(EntityUid uid, string marking, Color? color = null, bool sync = true, bool forced = false, HumanoidAppearanceComponent? humanoid = null)
public void AddMarking(
EntityUid uid,
string marking,
Color? color = null,
bool sync = true,
bool forced = false,
HumanoidAppearanceComponent? humanoid = null)
{
if (!Resolve(uid, ref humanoid)
|| !_markingManager.Markings.TryGetValue(marking, out var prototype))
@@ -378,6 +433,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
{
return;
}
humanoid.MarkingSet.EnsureDefault(humanoid.SkinColor, humanoid.EyeColor, _markingManager);
}
@@ -390,7 +446,13 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
/// <param name="sync">Whether to immediately sync this marking or not</param>
/// <param name="forced">If this marking was forced (ignores marking points)</param>
/// <param name="humanoid">Humanoid component of the entity</param>
public void AddMarking(EntityUid uid, string marking, IReadOnlyList<Color> colors, bool sync = true, bool forced = false, HumanoidAppearanceComponent? humanoid = null)
public void AddMarking(
EntityUid uid,
string marking,
IReadOnlyList<Color> colors,
bool sync = true,
bool forced = false,
HumanoidAppearanceComponent? humanoid = null)
{
if (!Resolve(uid, ref humanoid)
|| !_markingManager.Markings.TryGetValue(marking, out var prototype))