mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
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:
parent
a07bd251b4
commit
700bcbf28d
5 changed files with 81 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
objective-condition-supercrit-anomalies-title = Cause {$count} anomalies to go supercritical
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue