Skip to content

Commit

Permalink
Cult markings fix (#2471)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirus59 authored Jan 13, 2025
1 parent d00f9a0 commit 8f37700
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 27 deletions.
50 changes: 26 additions & 24 deletions Content.Server/SS220/CultYogg/Cultists/CultYoggSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -78,41 +80,41 @@ private void UpdateStage(Entity<CultYoggComponent> entity, ref ChangeCultYoggSta
huAp.EyeColor = Color.Green;
break;
case 2:
if (!_prototype.HasIndex<MarkingPrototype>("CultStage-Halo"))
{
Log.Error("CultStage-Halo marking doesn't exist");
return;
}

if (!huAp.MarkingSet.Markings.ContainsKey(MarkingCategories.Special))
if (_prototype.HasIndex<MarkingPrototype>(CultDefaultMarking))
{
huAp.MarkingSet.Markings.Add(MarkingCategories.Special, new List<Marking>([new Marking("CultStage-Halo", colorCount: 1)]));
if (!huAp.MarkingSet.Markings.ContainsKey(MarkingCategories.Special))
{
huAp.MarkingSet.Markings.Add(MarkingCategories.Special, new List<Marking>([new Marking(CultDefaultMarking, colorCount: 1)]));
}
else
{
_humanoidAppearance.SetMarkingId(entity.Owner,
MarkingCategories.Special,
0,
CultDefaultMarking,
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<MarkingPrototype>(newMarkingId))
if (_prototype.HasIndex<MarkingPrototype>(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:
Expand Down
24 changes: 21 additions & 3 deletions Content.Shared/Humanoid/Markings/MarkingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,20 @@ public FrozenDictionary<string, MarkingPrototype> MarkingsByCategory(MarkingCate
/// </remarks>
/// <returns></returns>
public IReadOnlyDictionary<string, MarkingPrototype> MarkingsByCategoryAndSpecies(MarkingCategories category,
string species)
string species,
bool showHidden = false) // SS220 cult markings fix
{
var speciesProto = _prototypeManager.Index<SpeciesPrototype>(species);
var onlyWhitelisted = _prototypeManager.Index<MarkingPointsPrototype>(speciesProto.MarkingPoints).OnlyWhitelisted;
var res = new Dictionary<string, MarkingPrototype>();

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;
Expand All @@ -93,12 +99,18 @@ public IReadOnlyDictionary<string, MarkingPrototype> MarkingsByCategoryAndSpecie
/// </remarks>
/// <returns></returns>
public IReadOnlyDictionary<string, MarkingPrototype> MarkingsByCategoryAndSex(MarkingCategories category,
Sex sex)
Sex sex,
bool showHidden = false) // SS220 cult markings fix
{
var res = new Dictionary<string, MarkingPrototype>();

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;
Expand All @@ -122,14 +134,20 @@ public IReadOnlyDictionary<string, MarkingPrototype> MarkingsByCategoryAndSex(Ma
/// </remarks>
/// <returns></returns>
public IReadOnlyDictionary<string, MarkingPrototype> MarkingsByCategoryAndSpeciesAndSex(MarkingCategories category,
string species, Sex sex)
string species, Sex sex,
bool showHidden = false) // SS220 cult markings fix
{
var speciesProto = _prototypeManager.Index<SpeciesPrototype>(species);
var onlyWhitelisted = _prototypeManager.Index<MarkingPointsPrototype>(speciesProto.MarkingPoints).OnlyWhitelisted;
var res = new Dictionary<string, MarkingPrototype>();

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;
Expand Down
8 changes: 8 additions & 0 deletions Content.Shared/Humanoid/Markings/MarkingPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ public sealed partial class MarkingPrototype : IPrototype
[DataField("forcedColoring")]
public bool ForcedColoring { get; private set; } = false;

// SS220 cult markings fix begin
/// <summary>
/// Is the marking hidden from the marking picker
/// </summary>
[DataField]
public bool Hidden = false;
// SS220 cult markings fix end

[DataField("coloring")]
public MarkingColors Coloring { get; private set; } = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
id: CultStage-Halo
bodyPart: Special
markingCategory: Special
hidden: true
sprites:
- sprite: SS220/Objects/CultYogg/cultstages.rsi
state: halo
Expand All @@ -12,6 +13,7 @@
id: CultStage-Moth
bodyPart: Special
markingCategory: Special
hidden: true
sprites:
- sprite: SS220/Objects/CultYogg/cultstages.rsi
state: moth

0 comments on commit 8f37700

Please sign in to comment.