Cause Anomalies to Go Supercritical [Traitor Objective] (#43505)

* science explosions are projected to go up by 1%

* eof

* huh

* review

* newline

* make it exclusive
This commit is contained in:
Super 2026-04-07 19:44:17 +01:00 • committed by GitHub
parent a07bd251b4
commit 700bcbf28d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 81 additions and 0 deletions

View file

@ -0,0 +1,14 @@
namespace Content.Server.Objectives.Components;
/// <summary>
/// Objective condition that requires a certain number of anomalies (defined by <see cref="NumberObjectiveComponent"/>) to go supercritical while the objective is in play.
/// </summary>
[RegisterComponent]
public sealed partial class SupercriticalAnomaliesConditionComponent : Component
{
/// <summary>
/// The number of anomalies that have gone supercritical since this objective was added.
/// </summary>
[DataField]
public int SupercriticalAnomalies = 0;
}

View file

@ -0,0 +1,41 @@
using Content.Server.Objectives.Components;
using Content.Shared.Anomaly.Components;
using Content.Shared.Objectives.Components;
namespace Content.Server.Objectives.Systems;
public sealed partial class SupercriticalAnomaliesConditionSystem : EntitySystem
{
[Dependency] private readonly NumberObjectiveSystem _numberObjective = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AnomalyShutdownEvent>(OnAnomalySupercrit);
SubscribeLocalEvent<SupercriticalAnomaliesConditionComponent, ObjectiveGetProgressEvent>(OnGetProgress);
}
private void OnAnomalySupercrit(ref AnomalyShutdownEvent args)
{
if (!args.Supercritical)
return;
var query = EntityQueryEnumerator<SupercriticalAnomaliesConditionComponent>();
while (query.MoveNext(out var comp))
{
comp.SupercriticalAnomalies += 1;
}
}
private void OnGetProgress(Entity<SupercriticalAnomaliesConditionComponent> ent, ref ObjectiveGetProgressEvent args)
{
var target = _numberObjective.GetTarget(ent);
if (target == 0)
{
args.Progress = 0f;
return;
}
args.Progress = MathF.Min((float)ent.Comp.SupercriticalAnomalies / target, 1f);
}
}

View file

@ -0,0 +1 @@
objective-condition-supercrit-anomalies-title = Cause {$count} anomalies to go supercritical

View file

@ -6,6 +6,7 @@
TraitorObjectiveGroupKill: 1
TraitorObjectiveGroupState: 1 #As in, something about your character. Alive, dead, arrested, gained an ability...
TraitorObjectiveGroupSocial: 1 #Involves helping/harming others without killing them or stealing their stuff
TraitorObjectiveGroupSabotage: 1
TraitorObjectiveGroupOther: 1
- type: weightedRandom
@ -45,6 +46,11 @@
# RandomTraitorAliveObjective: 1 - Removed because the objective was boring and didn't progress the round.
RandomTraitorProgressObjective: 1
- type: weightedRandom
id: TraitorObjectiveGroupSabotage
weights:
SupercritAnomaliesObjective: 1
#misc objectives that don't fall other another category
- type: weightedRandom
id: TraitorObjectiveGroupOther

View file

@ -378,6 +378,25 @@
stealGroup: NukeDisk
owner: objective-condition-steal-station
# sabotage
- type: entity
parent: BaseTraitorObjective
id: SupercritAnomaliesObjective
description: Nanotrasen is very interested in anomalies with potentially catastrophic consequences. Introduce them to the fire they're playing with.
components:
- type: Objective
difficulty: 2
icon:
sprite: Structures/Specific/anomaly.rsi
state: anom1
- type: SupercriticalAnomaliesCondition
- type: NumberObjective
min: 3
max: 4
title: objective-condition-supercrit-anomalies-title
- type: ObjectiveLimit
limit: 1
# other
- type: entity
parent: BaseTraitorObjective