-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description This is a simple event remake of the classic Graytide Virus event from SS13. A virus infects "Some of the airlocks" on the station, but more specifically it infects the security airlocks, causing them to emag themselves after a short delay. As the name of the airlock virus implies, this lets the prisoners out, and the greytiders in, until an engineer can get to sec and repair the airlocks. It can be a rare and somewhat very literal "Get Outa Jail/Second Chance" for traitors who are caught and permabrigged earlier in the round. # Changelog :cl: - add: Added the GR4YT1D3 Virus event. --------- Co-authored-by: sleepyyapril <[email protected]>
- Loading branch information
1 parent
0002c8b
commit 2e66dc9
Showing
6 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
Content.Server/StationEvents/Components/AirlockVirusRuleComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Content.Server.StationEvents.Events; | ||
|
||
namespace Content.Server.StationEvents.Components; | ||
|
||
[RegisterComponent] | ||
public sealed partial class AirlockVirusRuleComponent : Component | ||
{ | ||
/// <summary> | ||
/// The minimum amount of time in seconds before each infected door is self-emagged. | ||
/// </summary> | ||
[DataField] | ||
public int MinimumTimeToEmag = 30; | ||
|
||
/// <summary> | ||
/// The maximum amount of time in seconds before each infected door is self-emagged. | ||
/// </summary> | ||
[DataField] | ||
public int MaximumTimeToEmag = 120; | ||
} |
4 changes: 4 additions & 0 deletions
4
Content.Server/StationEvents/Components/AirlockVirusTargetComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace Content.Server.StationEvents.Components; | ||
|
||
[RegisterComponent] | ||
public sealed partial class AirlockVirusTargetComponent : Component { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using Content.Server.StationEvents.Components; | ||
using Content.Shared.GameTicking.Components; | ||
using JetBrains.Annotations; | ||
using Robust.Shared.Player; | ||
using Robust.Shared.Random; | ||
using Content.Server.Announcements.Systems; | ||
using Content.Server.GameTicking; | ||
using Content.Shared.Emag.Systems; | ||
using Robust.Shared.Timing; | ||
using Content.Server.Station.Components; | ||
using Content.Server.Station.Systems; | ||
|
||
namespace Content.Server.StationEvents.Events; | ||
|
||
[UsedImplicitly] | ||
public sealed class AirlockVirusRule : StationEventSystem<AirlockVirusRuleComponent> | ||
{ | ||
[Dependency] private readonly AnnouncerSystem _announcer = default!; | ||
[Dependency] private readonly GameTicker _gameTicker = default!; | ||
[Dependency] private readonly EmagSystem _emag = default!; | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
[Dependency] private readonly StationSystem _station = default!; | ||
|
||
protected override void Started(EntityUid uid, AirlockVirusRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) | ||
{ | ||
base.Started(uid, component, gameRule, args); | ||
|
||
var station = _gameTicker.GetSpawnableStations(); | ||
if (station is null) | ||
return; | ||
var stationGrids = new HashSet<EntityUid>(); | ||
foreach (var stations in station) | ||
{ | ||
if (TryComp<StationDataComponent>(stations, out var data) && _station.GetLargestGrid(data) is { } grid) | ||
stationGrids.Add(grid); | ||
} | ||
|
||
var query = EntityManager.EntityQueryEnumerator<AirlockVirusTargetComponent>(); | ||
while (query.MoveNext(out var airlockUid, out var _)) | ||
{ | ||
var parent = Transform(airlockUid).GridUid; | ||
if (parent is null | ||
|| !stationGrids.Contains(parent!.Value)) | ||
continue; | ||
|
||
Timer.Spawn(TimeSpan.FromSeconds(_random.NextDouble(component.MinimumTimeToEmag, component.MaximumTimeToEmag)), () => | ||
_emag.DoEmagEffect(uid, airlockUid)); | ||
} | ||
|
||
_announcer.SendAnnouncement( | ||
_announcer.GetAnnouncementId(args.RuleId), | ||
Filter.Broadcast(), | ||
"airlock-virus-event-announcement", | ||
null, | ||
Color.FromHex("#18abf5"), | ||
null, null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
airlock-virus-event-announcement = We have detected a GR4YT1D3 virus in the station's systems. Engineering staff are to inspect all station equipment for malfunctions and affect repairs if necessary. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters