[feat] donate

# Conflicts:
#	Content.Client/Entry/EntryPoint.cs
#	Content.Client/IoC/ClientContentIoC.cs
#	Content.Server/Chat/Managers/ChatManager.cs
#	Content.Server/Entry/EntryPoint.cs
#	Content.Server/GameTicking/GameTicker.Player.cs
#	Content.Server/GameTicking/GameTicker.StatusShell.cs
#	Content.Server/IoC/ServerContentIoC.cs
#	Content.Shared/Humanoid/HumanoidCharacterAppearance.cs
#	Content.Shared/Humanoid/Markings/MarkingPrototype.cs
#	Content.Shared/Preferences/HumanoidCharacterProfile.cs
This commit is contained in:
rhailrake
2023-04-25 19:46:20 +06:00
committed by Remuchi
parent 0cbb69d0a1
commit 4e85539ec6
29 changed files with 809 additions and 83 deletions

View File

@@ -188,7 +188,7 @@ namespace Content.Shared.Humanoid
return new(color.RByte, color.GByte, color.BByte);
}
public static HumanoidCharacterAppearance EnsureValid(HumanoidCharacterAppearance appearance, string species, Sex sex)
public static HumanoidCharacterAppearance EnsureValid(HumanoidCharacterAppearance appearance, string species, string[] sponsorMarkings) //WD-EDIT
{
var hairStyleId = appearance.HairStyleId;
var facialHairStyleId = appearance.FacialHairStyleId;
@@ -205,27 +205,57 @@ namespace Content.Shared.Humanoid
hairStyleId = HairStyles.DefaultHairStyle;
}
// WD-EDIT
if (proto.TryIndex(hairStyleId, out MarkingPrototype? hairProto) &&
hairProto.SponsorOnly &&
!sponsorMarkings.Contains(hairStyleId))
{
hairStyleId = HairStyles.DefaultHairStyle;
}
// WD-EDIT
if (!markingManager.MarkingsByCategory(MarkingCategories.FacialHair).ContainsKey(facialHairStyleId))
{
facialHairStyleId = HairStyles.DefaultFacialHairStyle;
}
// WD-EDIT
if (proto.TryIndex(facialHairStyleId, out MarkingPrototype? facialHairProto) &&
facialHairProto.SponsorOnly &&
!sponsorMarkings.Contains(facialHairStyleId))
{
facialHairStyleId = HairStyles.DefaultFacialHairStyle;
}
// WD-EDIT
var markingSet = new MarkingSet();
var skinColor = appearance.SkinColor;
if (proto.TryIndex(species, out SpeciesPrototype? speciesProto))
if (!proto.TryIndex(species, out SpeciesPrototype? speciesProto))
{
markingSet = new MarkingSet(appearance.Markings, speciesProto.MarkingPoints, markingManager, proto);
markingSet.EnsureValid(markingManager);
if (!Humanoid.SkinColor.VerifySkinColor(speciesProto.SkinColoration, skinColor))
{
skinColor = Humanoid.SkinColor.ValidSkinTone(speciesProto.SkinColoration, skinColor);
}
markingSet.EnsureSpecies(species, skinColor, markingManager);
markingSet.EnsureSexes(sex, markingManager);
return new HumanoidCharacterAppearance(
hairStyleId,
hairColor,
facialHairStyleId,
facialHairColor,
eyeColor,
skinColor,
markingSet.GetForwardEnumerator().ToList());
}
markingSet = new MarkingSet(appearance.Markings, speciesProto.MarkingPoints, markingManager, proto);
markingSet.EnsureValid(markingManager);
if (!Humanoid.SkinColor.VerifySkinColor(speciesProto.SkinColoration, skinColor))
{
skinColor = Humanoid.SkinColor.ValidSkinTone(speciesProto.SkinColoration, skinColor);
}
markingSet.EnsureSpecies(species, skinColor, markingManager);
// WD-EDIT
markingSet.FilterSponsor(sponsorMarkings, markingManager);
// WD-EDIT
return new HumanoidCharacterAppearance(
hairStyleId,
hairColor,
@@ -238,15 +268,21 @@ namespace Content.Shared.Humanoid
public bool MemberwiseEquals(ICharacterAppearance maybeOther)
{
if (maybeOther is not HumanoidCharacterAppearance other) return false;
if (HairStyleId != other.HairStyleId) return false;
if (!HairColor.Equals(other.HairColor)) return false;
if (FacialHairStyleId != other.FacialHairStyleId) return false;
if (!FacialHairColor.Equals(other.FacialHairColor)) return false;
if (!EyeColor.Equals(other.EyeColor)) return false;
if (!SkinColor.Equals(other.SkinColor)) return false;
if (!Markings.SequenceEqual(other.Markings)) return false;
return true;
if (maybeOther is not HumanoidCharacterAppearance other)
return false;
if (HairStyleId != other.HairStyleId)
return false;
if (!HairColor.Equals(other.HairColor))
return false;
if (FacialHairStyleId != other.FacialHairStyleId)
return false;
if (!FacialHairColor.Equals(other.FacialHairColor))
return false;
if (!EyeColor.Equals(other.EyeColor))
return false;
if (!SkinColor.Equals(other.SkinColor))
return false;
return Markings.SequenceEqual(other.Markings);
}
}
}

View File

@@ -23,6 +23,10 @@ namespace Content.Shared.Humanoid.Markings
[DataField("sexRestriction")]
public Sex? SexRestriction { get; private set; }
// WD-EDIT
[DataField("sponsorOnly")] public bool SponsorOnly;
// WD-EDIT
[DataField("followSkinColor")]
public bool FollowSkinColor { get; private set; } = false;

View File

@@ -4,7 +4,6 @@ using System.Linq;
using Content.Shared.Humanoid.Prototypes;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
namespace Content.Shared.Humanoid.Markings;
@@ -265,6 +264,37 @@ public sealed partial class MarkingSet
}
}
// WD-EDIT
public void FilterSponsor(string[] sponsorMarkings, MarkingManager? markingManager = null, IPrototypeManager? prototypeManager = null)
{
IoCManager.Resolve(ref markingManager);
IoCManager.Resolve(ref prototypeManager);
var toRemove = new List<(MarkingCategories category, string id)>();
foreach (var (category, list) in Markings)
{
foreach (var marking in list)
{
if (prototypeManager.TryIndex<MarkingPrototype>(marking.MarkingId, out var proto) && !proto.SponsorOnly)
{
return;
}
var allowedToHave = sponsorMarkings.Contains(marking.MarkingId);
if (!allowedToHave)
{
toRemove.Add((category, marking.MarkingId));
}
}
}
foreach (var marking in toRemove)
{
Remove(marking.category, marking.id);
}
}
// WD-EDIT
/// <summary>
/// Ensures that the default markings as defined by the marking point set in this marking set are applied.
/// </summary>