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] 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