Add JobRequirementOverride prototypes (#28607)
* Add JobRequirementOverride prototypes * a * invert if * Add override that takes in prototypes directly
This commit is contained in:
@@ -623,7 +623,8 @@ namespace Content.Client.Lobby.UI
|
|||||||
selector.Setup(items, title, 250, description, guides: antag.Guides);
|
selector.Setup(items, title, 250, description, guides: antag.Guides);
|
||||||
selector.Select(Profile?.AntagPreferences.Contains(antag.ID) == true ? 0 : 1);
|
selector.Select(Profile?.AntagPreferences.Contains(antag.ID) == true ? 0 : 1);
|
||||||
|
|
||||||
if (!_requirements.CheckRoleTime(antag.Requirements, out var reason))
|
var requirements = _entManager.System<SharedRoleSystem>().GetAntagRequirement(antag);
|
||||||
|
if (!_requirements.CheckRoleTime(requirements, out var reason))
|
||||||
{
|
{
|
||||||
selector.LockRequirements(reason);
|
selector.LockRequirements(reason);
|
||||||
Profile = Profile?.WithAntagPreference(antag.ID, false);
|
Profile = Profile?.WithAntagPreference(antag.ID, false);
|
||||||
|
|||||||
@@ -106,7 +106,13 @@ public sealed class JobRequirementsManager : ISharedPlaytimeManager
|
|||||||
if (player == null)
|
if (player == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return CheckRoleTime(job.Requirements, out reason);
|
return CheckRoleTime(job, out reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CheckRoleTime(JobPrototype job, [NotNullWhen(false)] out FormattedMessage? reason)
|
||||||
|
{
|
||||||
|
var reqs = _entManager.System<SharedRoleSystem>().GetJobRequirement(job);
|
||||||
|
return CheckRoleTime(reqs, out reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CheckRoleTime(HashSet<JobRequirement>? requirements, [NotNullWhen(false)] out FormattedMessage? reason)
|
public bool CheckRoleTime(HashSet<JobRequirement>? requirements, [NotNullWhen(false)] out FormattedMessage? reason)
|
||||||
|
|||||||
@@ -374,6 +374,9 @@ public sealed partial class AntagSelectionSystem : GameRuleSystem<AntagSelection
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsSessionValid(Entity<AntagSelectionComponent> ent, ICommonSession? session, AntagSelectionDefinition def, EntityUid? mind = null)
|
public bool IsSessionValid(Entity<AntagSelectionComponent> ent, ICommonSession? session, AntagSelectionDefinition def, EntityUid? mind = null)
|
||||||
{
|
{
|
||||||
|
// TODO ROLE TIMERS
|
||||||
|
// Check if antag role requirements are met
|
||||||
|
|
||||||
if (session == null)
|
if (session == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ namespace Content.Server.Ghost.Roles.Components
|
|||||||
|
|
||||||
[DataField("rules")] private string _roleRules = "ghost-role-component-default-rules";
|
[DataField("rules")] private string _roleRules = "ghost-role-component-default-rules";
|
||||||
|
|
||||||
|
// TODO ROLE TIMERS
|
||||||
|
// Actually make use of / enforce this requirement?
|
||||||
|
// Why is this even here.
|
||||||
|
// Move to ghost role prototype & respect CCvars.GameRoleTimerOverride
|
||||||
[DataField("requirements")]
|
[DataField("requirements")]
|
||||||
public HashSet<JobRequirement>? Requirements;
|
public HashSet<JobRequirement>? Requirements;
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
|
|||||||
[Dependency] private readonly MindSystem _minds = default!;
|
[Dependency] private readonly MindSystem _minds = default!;
|
||||||
[Dependency] private readonly PlayTimeTrackingManager _tracking = default!;
|
[Dependency] private readonly PlayTimeTrackingManager _tracking = default!;
|
||||||
[Dependency] private readonly IAdminManager _adminManager = default!;
|
[Dependency] private readonly IAdminManager _adminManager = default!;
|
||||||
|
[Dependency] private readonly SharedRoleSystem _role = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -197,7 +198,6 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
|
|||||||
public bool IsAllowed(ICommonSession player, string role)
|
public bool IsAllowed(ICommonSession player, string role)
|
||||||
{
|
{
|
||||||
if (!_prototypes.TryIndex<JobPrototype>(role, out var job) ||
|
if (!_prototypes.TryIndex<JobPrototype>(role, out var job) ||
|
||||||
job.Requirements == null ||
|
|
||||||
!_cfg.GetCVar(CCVars.GameRoleTimers))
|
!_cfg.GetCVar(CCVars.GameRoleTimers))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -224,19 +224,8 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
|
|||||||
|
|
||||||
foreach (var job in _prototypes.EnumeratePrototypes<JobPrototype>())
|
foreach (var job in _prototypes.EnumeratePrototypes<JobPrototype>())
|
||||||
{
|
{
|
||||||
if (job.Requirements != null)
|
if (JobRequirements.TryRequirementsMet(job, playTimes, out _, EntityManager, _prototypes))
|
||||||
{
|
roles.Add(job.ID);
|
||||||
foreach (var requirement in job.Requirements)
|
|
||||||
{
|
|
||||||
if (JobRequirements.TryRequirementMet(requirement, playTimes, out _, EntityManager, _prototypes))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
goto NoRole;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
roles.Add(job.ID);
|
|
||||||
NoRole:;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return roles;
|
return roles;
|
||||||
@@ -257,22 +246,14 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
|
|||||||
|
|
||||||
for (var i = 0; i < jobs.Count; i++)
|
for (var i = 0; i < jobs.Count; i++)
|
||||||
{
|
{
|
||||||
var job = jobs[i];
|
if (_prototypes.TryIndex(jobs[i], out var job)
|
||||||
|
&& JobRequirements.TryRequirementsMet(job, playTimes, out _, EntityManager, _prototypes))
|
||||||
if (!_prototypes.TryIndex(job, out var jobber) ||
|
|
||||||
jobber.Requirements == null ||
|
|
||||||
jobber.Requirements.Count == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
foreach (var requirement in jobber.Requirements)
|
|
||||||
{
|
{
|
||||||
if (JobRequirements.TryRequirementMet(requirement, playTimes, out _, EntityManager, _prototypes))
|
continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
jobs.RemoveSwap(i);
|
|
||||||
i--;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jobs.RemoveSwap(i);
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
|
using Content.Shared.Roles;
|
||||||
using Robust.Shared;
|
using Robust.Shared;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
@@ -219,6 +220,12 @@ namespace Content.Shared.CCVar
|
|||||||
public static readonly CVarDef<bool>
|
public static readonly CVarDef<bool>
|
||||||
GameRoleTimers = CVarDef.Create("game.role_timers", true, CVar.SERVER | CVar.REPLICATED);
|
GameRoleTimers = CVarDef.Create("game.role_timers", true, CVar.SERVER | CVar.REPLICATED);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override default role requirements using a <see cref="JobRequirementOverridePrototype"/>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly CVarDef<string>
|
||||||
|
GameRoleTimerOverride = CVarDef.Create("game.role_timer_override", "", CVar.SERVER | CVar.REPLICATED);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If roles should be restricted based on whether or not they are whitelisted.
|
/// If roles should be restricted based on whether or not they are whitelisted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -15,24 +15,24 @@ public sealed partial class GhostRolePrototype : IPrototype
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The name of the ghostrole.
|
/// The name of the ghostrole.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField]
|
[DataField(required: true)]
|
||||||
public string Name { get; set; } = default!;
|
public string Name { get; set; } = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The description of the ghostrole.
|
/// The description of the ghostrole.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField]
|
[DataField(required: true)]
|
||||||
public string Description { get; set; } = default!;
|
public string Description { get; set; } = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The entity prototype of the ghostrole
|
/// The entity prototype of the ghostrole
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField]
|
[DataField(required: true)]
|
||||||
public string EntityPrototype = default!;
|
public EntProtoId EntityPrototype;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rules of the ghostrole
|
/// Rules of the ghostrole
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField]
|
[DataField(required: true)]
|
||||||
public string Rules = default!;
|
public string Rules = default!;
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,11 @@ namespace Content.Shared.Ghost.Roles
|
|||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public string Rules { get; set; }
|
public string Rules { get; set; }
|
||||||
|
|
||||||
|
// TODO ROLE TIMERS
|
||||||
|
// Actually make use of / enforce this requirement?
|
||||||
|
// Why is this even here.
|
||||||
|
// Move to ghost role prototype & respect CCvars.GameRoleTimerOverride
|
||||||
public HashSet<JobRequirement>? Requirements { get; set; }
|
public HashSet<JobRequirement>? Requirements { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc cref="GhostRoleKind"/>
|
/// <inheritdoc cref="GhostRoleKind"/>
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ public sealed partial class AntagPrototype : IPrototype
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Requirements that must be met to opt in to this antag role.
|
/// Requirements that must be met to opt in to this antag role.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("requirements")]
|
// TODO ROLE TIMERS
|
||||||
|
// Actually check if the requirements are met. Because apparently this is actually unused.
|
||||||
|
[DataField, Access(typeof(SharedRoleSystem), Other = AccessPermissions.None)]
|
||||||
public HashSet<JobRequirement>? Requirements;
|
public HashSet<JobRequirement>? Requirements;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Content.Shared.Roles
|
|||||||
[ViewVariables(VVAccess.ReadOnly)]
|
[ViewVariables(VVAccess.ReadOnly)]
|
||||||
public string? LocalizedDescription => Description is null ? null : Loc.GetString(Description);
|
public string? LocalizedDescription => Description is null ? null : Loc.GetString(Description);
|
||||||
|
|
||||||
[DataField("requirements")]
|
[DataField, Access(typeof(SharedRoleSystem), Other = AccessPermissions.None)]
|
||||||
public HashSet<JobRequirement>? Requirements;
|
public HashSet<JobRequirement>? Requirements;
|
||||||
|
|
||||||
[DataField("joinNotifyCrew")]
|
[DataField("joinNotifyCrew")]
|
||||||
|
|||||||
20
Content.Shared/Roles/JobRequirementOverridePrototype.cs
Normal file
20
Content.Shared/Roles/JobRequirementOverridePrototype.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
|
namespace Content.Shared.Roles;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Collection of job, antag, and ghost-role job requirements for per-server requirement overrides.
|
||||||
|
/// </summary>
|
||||||
|
[Prototype]
|
||||||
|
public sealed partial class JobRequirementOverridePrototype : IPrototype
|
||||||
|
{
|
||||||
|
[ViewVariables]
|
||||||
|
[IdDataField]
|
||||||
|
public string ID { get; private set; } = default!;
|
||||||
|
|
||||||
|
[DataField]
|
||||||
|
public Dictionary<ProtoId<JobPrototype>, HashSet<JobRequirement>> Jobs = new ();
|
||||||
|
|
||||||
|
[DataField]
|
||||||
|
public Dictionary<ProtoId<AntagPrototype>, HashSet<JobRequirement>> Antags = new ();
|
||||||
|
}
|
||||||
@@ -73,16 +73,18 @@ namespace Content.Shared.Roles
|
|||||||
{
|
{
|
||||||
public static bool TryRequirementsMet(
|
public static bool TryRequirementsMet(
|
||||||
JobPrototype job,
|
JobPrototype job,
|
||||||
Dictionary<string, TimeSpan> playTimes,
|
IReadOnlyDictionary<string, TimeSpan> playTimes,
|
||||||
[NotNullWhen(false)] out FormattedMessage? reason,
|
[NotNullWhen(false)] out FormattedMessage? reason,
|
||||||
IEntityManager entManager,
|
IEntityManager entManager,
|
||||||
IPrototypeManager prototypes)
|
IPrototypeManager prototypes)
|
||||||
{
|
{
|
||||||
|
var sys = entManager.System<SharedRoleSystem>();
|
||||||
|
var requirements = sys.GetJobRequirement(job);
|
||||||
reason = null;
|
reason = null;
|
||||||
if (job.Requirements == null)
|
if (requirements == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
foreach (var requirement in job.Requirements)
|
foreach (var requirement in requirements)
|
||||||
{
|
{
|
||||||
if (!TryRequirementMet(requirement, playTimes, out reason, entManager, prototypes))
|
if (!TryRequirementMet(requirement, playTimes, out reason, entManager, prototypes))
|
||||||
return false;
|
return false;
|
||||||
@@ -130,7 +132,7 @@ namespace Content.Shared.Roles
|
|||||||
if (deptDiff <= 0)
|
if (deptDiff <= 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
reason = FormattedMessage.FromMarkup(Loc.GetString(
|
reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
|
||||||
"role-timer-department-insufficient",
|
"role-timer-department-insufficient",
|
||||||
("time", Math.Ceiling(deptDiff)),
|
("time", Math.Ceiling(deptDiff)),
|
||||||
("department", Loc.GetString(deptRequirement.Department)),
|
("department", Loc.GetString(deptRequirement.Department)),
|
||||||
@@ -141,7 +143,7 @@ namespace Content.Shared.Roles
|
|||||||
{
|
{
|
||||||
if (deptDiff <= 0)
|
if (deptDiff <= 0)
|
||||||
{
|
{
|
||||||
reason = FormattedMessage.FromMarkup(Loc.GetString(
|
reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
|
||||||
"role-timer-department-too-high",
|
"role-timer-department-too-high",
|
||||||
("time", -deptDiff),
|
("time", -deptDiff),
|
||||||
("department", Loc.GetString(deptRequirement.Department)),
|
("department", Loc.GetString(deptRequirement.Department)),
|
||||||
@@ -161,7 +163,7 @@ namespace Content.Shared.Roles
|
|||||||
if (overallDiff <= 0 || overallTime >= overallRequirement.Time)
|
if (overallDiff <= 0 || overallTime >= overallRequirement.Time)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
reason = FormattedMessage.FromMarkup(Loc.GetString(
|
reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
|
||||||
"role-timer-overall-insufficient",
|
"role-timer-overall-insufficient",
|
||||||
("time", Math.Ceiling(overallDiff))));
|
("time", Math.Ceiling(overallDiff))));
|
||||||
return false;
|
return false;
|
||||||
@@ -170,7 +172,7 @@ namespace Content.Shared.Roles
|
|||||||
{
|
{
|
||||||
if (overallDiff <= 0 || overallTime >= overallRequirement.Time)
|
if (overallDiff <= 0 || overallTime >= overallRequirement.Time)
|
||||||
{
|
{
|
||||||
reason = FormattedMessage.FromMarkup(Loc.GetString("role-timer-overall-too-high", ("time", -overallDiff)));
|
reason = FormattedMessage.FromMarkupPermissive(Loc.GetString("role-timer-overall-too-high", ("time", -overallDiff)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +199,7 @@ namespace Content.Shared.Roles
|
|||||||
if (roleDiff <= 0)
|
if (roleDiff <= 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
reason = FormattedMessage.FromMarkup(Loc.GetString(
|
reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
|
||||||
"role-timer-role-insufficient",
|
"role-timer-role-insufficient",
|
||||||
("time", Math.Ceiling(roleDiff)),
|
("time", Math.Ceiling(roleDiff)),
|
||||||
("job", Loc.GetString(proto)),
|
("job", Loc.GetString(proto)),
|
||||||
@@ -208,7 +210,7 @@ namespace Content.Shared.Roles
|
|||||||
{
|
{
|
||||||
if (roleDiff <= 0)
|
if (roleDiff <= 0)
|
||||||
{
|
{
|
||||||
reason = FormattedMessage.FromMarkup(Loc.GetString(
|
reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
|
||||||
"role-timer-role-too-high",
|
"role-timer-role-too-high",
|
||||||
("time", -roleDiff),
|
("time", -roleDiff),
|
||||||
("job", Loc.GetString(proto)),
|
("job", Loc.GetString(proto)),
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
using System.Linq;
|
|
||||||
using Content.Shared.Administration.Logs;
|
using Content.Shared.Administration.Logs;
|
||||||
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
|
using Content.Shared.Ghost.Roles;
|
||||||
using Content.Shared.Mind;
|
using Content.Shared.Mind;
|
||||||
using Content.Shared.Roles.Jobs;
|
using Content.Shared.Roles.Jobs;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
@@ -16,14 +18,30 @@ public abstract class SharedRoleSystem : EntitySystem
|
|||||||
[Dependency] private readonly IPrototypeManager _prototypes = default!;
|
[Dependency] private readonly IPrototypeManager _prototypes = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly SharedMindSystem _minds = default!;
|
[Dependency] private readonly SharedMindSystem _minds = default!;
|
||||||
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
|
|
||||||
// TODO please lord make role entities
|
// TODO please lord make role entities
|
||||||
private readonly HashSet<Type> _antagTypes = new();
|
private readonly HashSet<Type> _antagTypes = new();
|
||||||
|
|
||||||
|
private JobRequirementOverridePrototype? _requirementOverride;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
// TODO make roles entities
|
// TODO make roles entities
|
||||||
SubscribeLocalEvent<JobComponent, MindGetAllRolesEvent>(OnJobGetAllRoles);
|
SubscribeLocalEvent<JobComponent, MindGetAllRolesEvent>(OnJobGetAllRoles);
|
||||||
|
Subs.CVar(_cfg, CCVars.GameRoleTimerOverride, SetRequirementOverride, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetRequirementOverride(string value)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(value))
|
||||||
|
{
|
||||||
|
_requirementOverride = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_prototypes.TryIndex(value, out _requirementOverride ))
|
||||||
|
Log.Error($"Unknown JobRequirementOverridePrototype: {value}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnJobGetAllRoles(EntityUid uid, JobComponent component, ref MindGetAllRolesEvent args)
|
private void OnJobGetAllRoles(EntityUid uid, JobComponent component, ref MindGetAllRolesEvent args)
|
||||||
@@ -253,4 +271,36 @@ public abstract class SharedRoleSystem : EntitySystem
|
|||||||
if (Resolve(mindId, ref mind) && mind.Session != null)
|
if (Resolve(mindId, ref mind) && mind.Session != null)
|
||||||
_audio.PlayGlobal(sound, mind.Session);
|
_audio.PlayGlobal(sound, mind.Session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashSet<JobRequirement>? GetJobRequirement(JobPrototype job)
|
||||||
|
{
|
||||||
|
if (_requirementOverride != null && _requirementOverride.Jobs.TryGetValue(job.ID, out var req))
|
||||||
|
return req;
|
||||||
|
|
||||||
|
return job.Requirements;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashSet<JobRequirement>? GetJobRequirement(ProtoId<JobPrototype> job)
|
||||||
|
{
|
||||||
|
if (_requirementOverride != null && _requirementOverride.Jobs.TryGetValue(job, out var req))
|
||||||
|
return req;
|
||||||
|
|
||||||
|
return _prototypes.Index(job).Requirements;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashSet<JobRequirement>? GetAntagRequirement(ProtoId<AntagPrototype> antag)
|
||||||
|
{
|
||||||
|
if (_requirementOverride != null && _requirementOverride.Antags.TryGetValue(antag, out var req))
|
||||||
|
return req;
|
||||||
|
|
||||||
|
return _prototypes.Index(antag).Requirements;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashSet<JobRequirement>? GetAntagRequirement(AntagPrototype antag)
|
||||||
|
{
|
||||||
|
if (_requirementOverride != null && _requirementOverride.Antags.TryGetValue(antag.ID, out var req))
|
||||||
|
return req;
|
||||||
|
|
||||||
|
return antag.Requirements;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
Resources/Prototypes/Roles/requirement_overrides.yml
Normal file
16
Resources/Prototypes/Roles/requirement_overrides.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
- type: jobRequirementOverride
|
||||||
|
id: Reduced
|
||||||
|
jobs:
|
||||||
|
Captain:
|
||||||
|
- !type:DepartmentTimeRequirement
|
||||||
|
department: Engineering
|
||||||
|
time: 3600 # 1 hours
|
||||||
|
- !type:DepartmentTimeRequirement
|
||||||
|
department: Medical
|
||||||
|
time: 3600 # 1 hours
|
||||||
|
- !type:DepartmentTimeRequirement
|
||||||
|
department: Security
|
||||||
|
time: 3600 # 1 hours
|
||||||
|
- !type:DepartmentTimeRequirement
|
||||||
|
department: Command
|
||||||
|
time: 3600 # 1 hour
|
||||||
Reference in New Issue
Block a user