Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cult Yogg cultists count major trigger #2634

Merged
merged 2 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public sealed partial class AdminVerbSystem

//SS200 CultYogg start
[ValidatePrototypeId<EntityPrototype>]
private const string DefaultCultYoggRule = "CultYoggRule";
private const string DefaultCultYoggRule = "CultYoggRuleMidPop";
//SS220 CultYogg end

// All antag verbs have names so invokeverb works.
Expand Down
21 changes: 21 additions & 0 deletions Content.Server/GameTicking/Rules/SecretRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,27 @@ private bool TryPickPreset(ProtoId<WeightedRandomPrototype> weights, [NotNullWhe
var options = _prototypeManager.Index(weights).Weights.ShallowClone();
var players = GameTicker.ReadyPlayerCount();

// SS220 Cult Yogg begin
var optionsToRemove = new HashSet<string>();
foreach ((var presetId, _) in options)
{
if (_prototypeManager.TryIndex<GamePresetPrototype>(presetId, out var presetToCheck)
&& players >= (presetToCheck.MinPlayers ?? 0)
&& players <= (presetToCheck.MaxPlayers ?? int.MaxValue))
{
// Passed
continue;
}

// Will be removed
optionsToRemove.Add(presetId);
}
foreach (var presetId in optionsToRemove)
{
options.Remove(presetId);
}
// SS220 Cult Yogg end

GamePresetPrototype? selectedPreset = null;
var sum = options.Values.Sum();
while (options.Count > 0)
Expand Down
12 changes: 0 additions & 12 deletions Content.Server/SS220/CultYogg/Altar/CultYoggAltarSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,11 @@ private void OnDoAfter(Entity<CultYoggAltarComponent> ent, ref MiGoSacrificeDoAf
RemComp<StrapComponent>(ent);
RemComp<DestructibleComponent>(ent);

int stage = 0;

var query = EntityQueryEnumerator<GameRuleComponent, CultYoggRuleComponent>();
while (query.MoveNext(out var uid, out _, out var cultRule))
{
var ev = new CultYoggSacrificedTargetEvent(ent);
RaiseLocalEvent(uid, ref ev, true);

stage = cultRule.AmountOfSacrifices;
}

//sending all cultists updating stage event
var queryCultists = EntityQueryEnumerator<CultYoggComponent>(); //ToDo ask if this code is ok
while (queryCultists.MoveNext(out var uid, out _))
{
var ev = new ChangeCultYoggStageEvent(stage);
RaiseLocalEvent(uid, ref ev, true);
}

//send cooldown to a MiGo sacrifice action
Expand Down
8 changes: 4 additions & 4 deletions Content.Server/SS220/CultYogg/Cultists/CultYoggSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ private void UpdateStage(Entity<CultYoggComponent> entity, ref ChangeCultYoggSta

switch (args.Stage)
{
case 0:
case CultYoggStage.Initial:
return;
case 1:
case CultYoggStage.Reveal:
entity.Comp.PreviousEyeColor = new Color(huAp.EyeColor.R, huAp.EyeColor.G, huAp.EyeColor.B, huAp.EyeColor.A);
huAp.EyeColor = Color.Green;
break;
case 2:
case CultYoggStage.Alarm:
if (_prototype.HasIndex<MarkingPrototype>(CultDefaultMarking))
{
if (!huAp.MarkingSet.Markings.ContainsKey(MarkingCategories.Special))
Expand Down Expand Up @@ -117,7 +117,7 @@ private void UpdateStage(Entity<CultYoggComponent> entity, ref ChangeCultYoggSta
//Log.Error($"{newMarkingId} marking doesn't exist");
}
break;
case 3:
case CultYoggStage.God:
if (!TryComp<MobStateComponent>(entity, out var mobstate))
return;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt

using Content.Shared.FixedPoint;
using Content.Shared.NPC.Prototypes;
using Content.Shared.SS220.CultYogg.Altar;
using Content.Shared.SS220.CultYogg.Cultists;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
Expand All @@ -11,17 +14,11 @@ namespace Content.Server.SS220.GameTicking.Rules.Components;
[RegisterComponent, Access(typeof(CultYoggRuleSystem))]
public sealed partial class CultYoggRuleComponent : Component
{
/// <summary>
/// General requirements
/// </summary>
[DataField]
public int AmountOfSacrificesToGodSummon = 3;

[DataField]
public int AmountOfSacrificesToWarningAnouncement = 2;
public int ReqAmountOfMiGo = 3;
Copy link

@SkaldetSkaeg SkaldetSkaeg Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

что за необходимое число Ми-Го? Я что забыл это удалить? ебббт...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну типа того, там по крайней мере несколько полей я видел не используется

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну типа того, там по крайней мере несколько полей я видел не используется

ну, это одно из них, которое можно смело удалить

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ну, это одно из них, которое можно смело удалить

Чистку кода лучше провести в отдельном ПРе


[DataField]
public int ReqAmountOfMiGo = 3;
public Dictionary<CultYoggStage, CultYoggStageDefinition> Stages { get; private set; } = new();

/// <summary>
/// General requirements
Expand All @@ -33,6 +30,14 @@ public sealed partial class CultYoggRuleComponent : Component

public bool SacraficialsWerePicked = false;//buffer to prevent multiple generations

/// <summary>
/// Where previous sacrificial were performed
/// </summary>
public Entity<CultYoggAltarComponent>? LastSacrificialAltar = null;

public int InitialCrewCount;
public int TotalCultistsConverted;

/// <summary>
/// Storages for an endgame screen title
/// </summary>
Expand Down Expand Up @@ -90,6 +95,11 @@ public enum SelectionState
/// </summary>
public SelectionState SelectionStatus = SelectionState.WaitingForSpawn;

/// <summary>
/// Current cult gameplay stage
/// </summary>
public CultYoggStage Stage = CultYoggStage.Initial;

/// <summary>
/// When should cultists be selected and the announcement made
/// </summary>
Expand All @@ -102,3 +112,19 @@ public enum SelectionState
[DataField]
public SoundSpecifier GreetSoundNotification = new SoundPathSpecifier("/Audio/SS220/Ambience/Antag/cult_yogg_start.ogg");
}

[DataDefinition]
public sealed partial class CultYoggStageDefinition
{
/// <summary>
/// Amount of sacrifices that will progress cult to this stage.
/// </summary>
[DataField]
public int? SacrificesRequired;
/// <summary>
/// Fraction of total crew converted to cultists that will progress cult to this stage.
/// </summary>
[DataField]
public FixedPoint2? CultistsFractionRequired;
}

Loading
Loading