diff --git a/Content.Server/StationEvents/Components/StationEventComponent.cs b/Content.Server/StationEvents/Components/StationEventComponent.cs
index 8d879161a34..3980cdbca79 100644
--- a/Content.Server/StationEvents/Components/StationEventComponent.cs
+++ b/Content.Server/StationEvents/Components/StationEventComponent.cs
@@ -1,4 +1,6 @@
+using Content.Shared.Roles; // Frontier
using Robust.Shared.Audio;
+using Robust.Shared.Prototypes; // Frontier
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.StationEvents.Components;
@@ -70,8 +72,8 @@ public sealed partial class StationEventComponent : Component
public int MinimumPlayers;
///
- /// Frontier - How many players need to be present on station for the event to not run, to avoid running safe events with high-pop
- ///
+ /// Frontier: How many players need to be present on station for the event to not run, to avoid running safe events with high-pop
+ ///
[DataField]
public int MaximumPlayers = 999;
@@ -93,4 +95,10 @@ public sealed partial class StationEventComponent : Component
///
[DataField]
public bool OccursDuringRoundEnd = true;
+
+ ///
+ /// Frontier: Require active job to run the event.
+ ///
+ [DataField]
+ public Dictionary, int> RequiredJobs = new();
}
diff --git a/Content.Server/StationEvents/EventManagerSystem.cs b/Content.Server/StationEvents/EventManagerSystem.cs
index b7bdd898d74..fdd357f4e24 100644
--- a/Content.Server/StationEvents/EventManagerSystem.cs
+++ b/Content.Server/StationEvents/EventManagerSystem.cs
@@ -9,6 +9,8 @@
using Robust.Shared.Random;
using Content.Shared.EntityTable.EntitySelectors;
using Content.Shared.EntityTable;
+using Content.Server.Station.Systems; // Frontier
+using Content.Server.Station.Components; // Frontier
namespace Content.Server.StationEvents;
@@ -21,6 +23,7 @@ public sealed class EventManagerSystem : EntitySystem
[Dependency] private readonly EntityTableSystem _entityTable = default!;
[Dependency] public readonly GameTicker GameTicker = default!;
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
+ [Dependency] private readonly StationJobsSystem _stationJobs = default!; // Frontier
public bool EventsEnabled { get; private set; }
private void SetEnabled(bool value) => EventsEnabled = value;
@@ -267,11 +270,24 @@ private bool CanRun(EntityPrototype prototype, StationEventComponent stationEven
return false;
}
- // Frontier: max players
+ // Frontier: Check max players
if (playerCount > stationEvent.MaximumPlayers)
{
return false;
}
+
+ // Frontier: require jobs to run event - TODO: actually count jobs, compare vs. numJobs
+ foreach (var (jobProtoId, numJobs) in stationEvent.RequiredJobs)
+ {
+ var jobPrototype = _prototype.Index(jobProtoId);
+ var query = EntityQueryEnumerator();
+ while (query.MoveNext(out var station, out var comp))
+ {
+ // If a job slot is open, nobody has the job, or the player with the job should be leaving.
+ if (_stationJobs.TryGetJobSlot(station, jobPrototype, out var slots, comp) && slots >= 1)
+ return false;
+ }
+ }
// End Frontier
if (_roundEnd.IsRoundEndRequested() && !stationEvent.OccursDuringRoundEnd)
diff --git a/Content.Server/Station/Components/StationRenameFaxesComponent.cs b/Content.Server/_NF/Station/Components/StationRenameFaxesComponent.cs
similarity index 100%
rename from Content.Server/Station/Components/StationRenameFaxesComponent.cs
rename to Content.Server/_NF/Station/Components/StationRenameFaxesComponent.cs
diff --git a/Content.Server/Station/Components/StationRenameWarpsComponent.cs b/Content.Server/_NF/Station/Components/StationRenameWarpsComponent.cs
similarity index 100%
rename from Content.Server/Station/Components/StationRenameWarpsComponent.cs
rename to Content.Server/_NF/Station/Components/StationRenameWarpsComponent.cs
diff --git a/Resources/Prototypes/_NF/Events/nf_events_bluespace.yml b/Resources/Prototypes/_NF/Events/nf_events_bluespace.yml
index 8f59bde652d..ee1360ead50 100644
--- a/Resources/Prototypes/_NF/Events/nf_events_bluespace.yml
+++ b/Resources/Prototypes/_NF/Events/nf_events_bluespace.yml
@@ -13,6 +13,8 @@
duration: 1350
maxDuration: 1560
reoccurrenceDelay: 480 # 8 hours
+ requiredJobs:
+ Sheriff: 1
- type: BluespaceErrorRule
gridPaths:
- /Maps/_NF/Bluespace/cache.yml
@@ -33,6 +35,8 @@
duration: 1020
maxDuration: 1350
reoccurrenceDelay: 480 # 8 hours
+ requiredJobs:
+ Sheriff: 1
- type: BluespaceErrorRule
gridPaths:
- /Maps/_NF/Bluespace/vault.yml
@@ -54,6 +58,8 @@
duration: 590
maxDuration: 780
reoccurrenceDelay: 480 # 8 hours
+ requiredJobs:
+ Sheriff: 1
- type: BluespaceErrorRule
gridPaths:
- /Maps/_NF/Bluespace/vaultsmall.yml