From e28c12d742e8a27e02b51ba6bf1397d7ba496e28 Mon Sep 17 00:00:00 2001 From: Kirus59 <145689588+Kirus59@users.noreply.github.com> Date: Thu, 9 Jan 2025 19:50:47 +0300 Subject: [PATCH 1/4] Cult markings fix --- Content.Client/Humanoid/MarkingPicker.xaml.cs | 4 +- .../SS220/CultYogg/Cultists/CultYoggSystem.cs | 50 ++++++++++--------- .../Humanoid/Markings/MarkingPrototype.cs | 8 +++ .../Entities/Objects/CultYogg/cultstages.yml | 2 + 4 files changed, 39 insertions(+), 25 deletions(-) diff --git a/Content.Client/Humanoid/MarkingPicker.xaml.cs b/Content.Client/Humanoid/MarkingPicker.xaml.cs index 8e331bed02d7..19bb9a64819c 100644 --- a/Content.Client/Humanoid/MarkingPicker.xaml.cs +++ b/Content.Client/Humanoid/MarkingPicker.xaml.cs @@ -215,7 +215,9 @@ public void Populate(string filter) var sortedMarkings = GetMarkings(_selectedMarkingCategory).Values.Where(m => m.ID.ToLower().Contains(filter.ToLower()) || GetMarkingName(m).ToLower().Contains(filter.ToLower()) - ).OrderBy(p => Loc.GetString(GetMarkingName(p))); + ) + .Where(m => !m.Hidden) // SS220 cult markings fix + .OrderBy(p => Loc.GetString(GetMarkingName(p))); foreach (var marking in sortedMarkings) { diff --git a/Content.Server/SS220/CultYogg/Cultists/CultYoggSystem.cs b/Content.Server/SS220/CultYogg/Cultists/CultYoggSystem.cs index 468356894289..8cc16ee32c1f 100644 --- a/Content.Server/SS220/CultYogg/Cultists/CultYoggSystem.cs +++ b/Content.Server/SS220/CultYogg/Cultists/CultYoggSystem.cs @@ -43,6 +43,8 @@ public sealed class CultYoggSystem : SharedCultYoggSystem [Dependency] private readonly ThirstSystem _thirstSystem = default!; [Dependency] private readonly VomitSystem _vomitSystem = default!; + private const string CultDefaultMarking = "CultStage-Halo"; + public override void Initialize() { base.Initialize(); @@ -78,41 +80,41 @@ private void UpdateStage(Entity entity, ref ChangeCultYoggSta huAp.EyeColor = Color.Green; break; case 2: - if (!_prototype.HasIndex("CultStage-Halo")) - { - Log.Error("CultStage-Halo marking doesn't exist"); - return; - } - - if (!huAp.MarkingSet.Markings.ContainsKey(MarkingCategories.Special)) + if (_prototype.HasIndex(CultDefaultMarking)) { - huAp.MarkingSet.Markings.Add(MarkingCategories.Special, new List([new Marking("CultStage-Halo", colorCount: 1)])); + if (!huAp.MarkingSet.Markings.ContainsKey(MarkingCategories.Special)) + { + huAp.MarkingSet.Markings.Add(MarkingCategories.Special, new List([new Marking("CultStage-Halo", colorCount: 1)])); + } + else + { + _humanoidAppearance.SetMarkingId(entity.Owner, + MarkingCategories.Special, + 0, + "CultStage-Halo", + huAp); + } } else { - _humanoidAppearance.SetMarkingId(entity.Owner, - MarkingCategories.Special, - 0, - "CultStage-Halo", - huAp); + Log.Error($"{CultDefaultMarking} marking doesn't exist"); } - Dirty(entity.Owner, huAp); - var newMarkingId = $"CultStage-{huAp.Species}"; - if (!_prototype.HasIndex(newMarkingId)) + if (_prototype.HasIndex(newMarkingId)) { - Log.Error($"{newMarkingId} marking doesn't exist"); - return; + if (huAp.MarkingSet.Markings.TryGetValue(MarkingCategories.Tail, out var value)) + { + entity.Comp.PreviousTail = value.FirstOrDefault(); + value.Clear(); + huAp.MarkingSet.Markings[MarkingCategories.Special].Add(new Marking(newMarkingId, colorCount: 1)); + } } - - if (huAp.MarkingSet.Markings.TryGetValue(MarkingCategories.Tail, out var value)) + else { - entity.Comp.PreviousTail = value.FirstOrDefault(); - value.Clear(); - huAp.MarkingSet.Markings[MarkingCategories.Special].Add(new Marking(newMarkingId, colorCount: 1)); - Dirty(entity.Owner, huAp); + // We have species-marking only for the Nians, so this log only leads to unnecessary errors. + //Log.Error($"{newMarkingId} marking doesn't exist"); } break; case 3: diff --git a/Content.Shared/Humanoid/Markings/MarkingPrototype.cs b/Content.Shared/Humanoid/Markings/MarkingPrototype.cs index 28bfd71c0da4..35ac859b88af 100644 --- a/Content.Shared/Humanoid/Markings/MarkingPrototype.cs +++ b/Content.Shared/Humanoid/Markings/MarkingPrototype.cs @@ -34,6 +34,14 @@ public sealed partial class MarkingPrototype : IPrototype [DataField("forcedColoring")] public bool ForcedColoring { get; private set; } = false; + // SS220 cult markings fix begin + /// + /// Is the marking hidden from the marking picker + /// + [DataField] + public bool Hidden = false; + // SS220 cult markings fix end + [DataField("coloring")] public MarkingColors Coloring { get; private set; } = new(); diff --git a/Resources/Prototypes/SS220/Entities/Objects/CultYogg/cultstages.yml b/Resources/Prototypes/SS220/Entities/Objects/CultYogg/cultstages.yml index 324f3f3ba76e..6e307d6b94e1 100644 --- a/Resources/Prototypes/SS220/Entities/Objects/CultYogg/cultstages.yml +++ b/Resources/Prototypes/SS220/Entities/Objects/CultYogg/cultstages.yml @@ -4,6 +4,7 @@ id: CultStage-Halo bodyPart: Special markingCategory: Special + hidden: true sprites: - sprite: SS220/Objects/CultYogg/cultstages.rsi state: halo @@ -12,6 +13,7 @@ id: CultStage-Moth bodyPart: Special markingCategory: Special + hidden: true sprites: - sprite: SS220/Objects/CultYogg/cultstages.rsi state: moth From 33abc91c6f3bb1af20d77b750b67013b4b28170e Mon Sep 17 00:00:00 2001 From: Kirus59 <145689588+Kirus59@users.noreply.github.com> Date: Thu, 9 Jan 2025 19:53:59 +0300 Subject: [PATCH 2/4] fix fix --- Content.Client/Humanoid/MarkingPicker.xaml.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Content.Client/Humanoid/MarkingPicker.xaml.cs b/Content.Client/Humanoid/MarkingPicker.xaml.cs index 19bb9a64819c..bffb1e3b0aef 100644 --- a/Content.Client/Humanoid/MarkingPicker.xaml.cs +++ b/Content.Client/Humanoid/MarkingPicker.xaml.cs @@ -215,8 +215,7 @@ public void Populate(string filter) var sortedMarkings = GetMarkings(_selectedMarkingCategory).Values.Where(m => m.ID.ToLower().Contains(filter.ToLower()) || GetMarkingName(m).ToLower().Contains(filter.ToLower()) - ) - .Where(m => !m.Hidden) // SS220 cult markings fix + ).Where(m => !m.Hidden) // SS220 cult markings fix .OrderBy(p => Loc.GetString(GetMarkingName(p))); foreach (var marking in sortedMarkings) From 70d2fcf6d2dc693a5e23512bfcdff36eed05d13b Mon Sep 17 00:00:00 2001 From: Kirus59 <145689588+Kirus59@users.noreply.github.com> Date: Thu, 9 Jan 2025 22:24:35 +0300 Subject: [PATCH 3/4] forgot about const --- Content.Server/SS220/CultYogg/Cultists/CultYoggSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Server/SS220/CultYogg/Cultists/CultYoggSystem.cs b/Content.Server/SS220/CultYogg/Cultists/CultYoggSystem.cs index 8cc16ee32c1f..450511979386 100644 --- a/Content.Server/SS220/CultYogg/Cultists/CultYoggSystem.cs +++ b/Content.Server/SS220/CultYogg/Cultists/CultYoggSystem.cs @@ -84,14 +84,14 @@ private void UpdateStage(Entity entity, ref ChangeCultYoggSta { if (!huAp.MarkingSet.Markings.ContainsKey(MarkingCategories.Special)) { - huAp.MarkingSet.Markings.Add(MarkingCategories.Special, new List([new Marking("CultStage-Halo", colorCount: 1)])); + huAp.MarkingSet.Markings.Add(MarkingCategories.Special, new List([new Marking(CultDefaultMarking, colorCount: 1)])); } else { _humanoidAppearance.SetMarkingId(entity.Owner, MarkingCategories.Special, 0, - "CultStage-Halo", + CultDefaultMarking, huAp); } } From cf64ec3f62ac5cb35a1f229f3c48956f26feffd4 Mon Sep 17 00:00:00 2001 From: Kirus59 <145689588+Kirus59@users.noreply.github.com> Date: Sat, 11 Jan 2025 19:31:06 +0300 Subject: [PATCH 4/4] move check to MarkingManager --- Content.Client/Humanoid/MarkingPicker.xaml.cs | 3 +-- .../Humanoid/Markings/MarkingManager.cs | 24 ++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Content.Client/Humanoid/MarkingPicker.xaml.cs b/Content.Client/Humanoid/MarkingPicker.xaml.cs index bffb1e3b0aef..8e331bed02d7 100644 --- a/Content.Client/Humanoid/MarkingPicker.xaml.cs +++ b/Content.Client/Humanoid/MarkingPicker.xaml.cs @@ -215,8 +215,7 @@ public void Populate(string filter) var sortedMarkings = GetMarkings(_selectedMarkingCategory).Values.Where(m => m.ID.ToLower().Contains(filter.ToLower()) || GetMarkingName(m).ToLower().Contains(filter.ToLower()) - ).Where(m => !m.Hidden) // SS220 cult markings fix - .OrderBy(p => Loc.GetString(GetMarkingName(p))); + ).OrderBy(p => Loc.GetString(GetMarkingName(p))); foreach (var marking in sortedMarkings) { diff --git a/Content.Shared/Humanoid/Markings/MarkingManager.cs b/Content.Shared/Humanoid/Markings/MarkingManager.cs index 7bf0be998b69..ac035de2e72a 100644 --- a/Content.Shared/Humanoid/Markings/MarkingManager.cs +++ b/Content.Shared/Humanoid/Markings/MarkingManager.cs @@ -59,7 +59,8 @@ public FrozenDictionary MarkingsByCategory(MarkingCate /// /// public IReadOnlyDictionary MarkingsByCategoryAndSpecies(MarkingCategories category, - string species) + string species, + bool showHidden = false) // SS220 cult markings fix { var speciesProto = _prototypeManager.Index(species); var onlyWhitelisted = _prototypeManager.Index(speciesProto.MarkingPoints).OnlyWhitelisted; @@ -67,6 +68,11 @@ public IReadOnlyDictionary MarkingsByCategoryAndSpecie foreach (var (key, marking) in MarkingsByCategory(category)) { + // SS220 cult markings fix begin + if (!showHidden && marking.Hidden) + continue; + // SS220 cult markings fix end + if (onlyWhitelisted && marking.SpeciesRestrictions == null) { continue; @@ -93,12 +99,18 @@ public IReadOnlyDictionary MarkingsByCategoryAndSpecie /// /// public IReadOnlyDictionary MarkingsByCategoryAndSex(MarkingCategories category, - Sex sex) + Sex sex, + bool showHidden = false) // SS220 cult markings fix { var res = new Dictionary(); foreach (var (key, marking) in MarkingsByCategory(category)) { + // SS220 cult markings fix begin + if (!showHidden && marking.Hidden) + continue; + // SS220 cult markings fix end + if (marking.SexRestriction != null && marking.SexRestriction != sex) { continue; @@ -122,7 +134,8 @@ public IReadOnlyDictionary MarkingsByCategoryAndSex(Ma /// /// public IReadOnlyDictionary MarkingsByCategoryAndSpeciesAndSex(MarkingCategories category, - string species, Sex sex) + string species, Sex sex, + bool showHidden = false) // SS220 cult markings fix { var speciesProto = _prototypeManager.Index(species); var onlyWhitelisted = _prototypeManager.Index(speciesProto.MarkingPoints).OnlyWhitelisted; @@ -130,6 +143,11 @@ public IReadOnlyDictionary MarkingsByCategoryAndSpecie foreach (var (key, marking) in MarkingsByCategory(category)) { + // SS220 cult markings fix begin + if (!showHidden && marking.Hidden) + continue; + // SS220 cult markings fix end + if (onlyWhitelisted && marking.SpeciesRestrictions == null) { continue;