Extended access system (#8469)
* Extended access system Allows jobs to specify "extended" access levels, which will be granted if the round-start crew count is below a certain threshold. * Extended accesses for jobs * Spook
This commit is contained in:
committed by
GitHub
parent
c5982e0b10
commit
a4685bab4c
@@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Server.Station.Components;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Shared.Network;
|
||||
@@ -304,6 +305,24 @@ public sealed partial class StationJobsSystem
|
||||
}
|
||||
}
|
||||
|
||||
public void CalcExtendedAccess(Dictionary<EntityUid, int> jobsCount)
|
||||
{
|
||||
// Calculate whether stations need to be on extended access or not.
|
||||
foreach (var (station, count) in jobsCount)
|
||||
{
|
||||
var jobs = Comp<StationJobsComponent>(station);
|
||||
var data = Comp<StationDataComponent>(station);
|
||||
|
||||
var thresh = data.StationConfig?.ExtendedAccessThreshold ?? -1;
|
||||
|
||||
jobs.ExtendedAccess = count <= thresh;
|
||||
|
||||
Logger.DebugS(
|
||||
"station", "Station {Station} on extended access: {ExtendedAccess}",
|
||||
Name(station), jobs.ExtendedAccess);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all jobs that the input players have that match the given weight and priority.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user