Antag Rolebans (#35966)
Co-authored-by: beck-thompson <beck314159@hotmail.com> Co-authored-by: Hannah Giovanna Dawson <karakkaraz@gmail.com>
This commit is contained in:
@@ -667,10 +667,13 @@ public abstract class SharedRoleSystem : EntitySystem
|
||||
_audio.PlayGlobal(sound, session);
|
||||
}
|
||||
|
||||
// TODO ROLES Change to readonly.
|
||||
// TODO ROLES Change to readonly?
|
||||
// Passing around a reference to a prototype's hashset makes me uncomfortable because it might be accidentally
|
||||
// mutated.
|
||||
public HashSet<JobRequirement>? GetJobRequirement(JobPrototype job)
|
||||
/// <summary>
|
||||
/// Returns the list of requirements for a role, or null. May be altered by requirement overrides.
|
||||
/// </summary>
|
||||
public HashSet<JobRequirement>? GetRoleRequirements(JobPrototype job)
|
||||
{
|
||||
if (_requirementOverride != null && _requirementOverride.Jobs.TryGetValue(job.ID, out var req))
|
||||
return req;
|
||||
@@ -678,33 +681,30 @@ public abstract class SharedRoleSystem : EntitySystem
|
||||
return job.Requirements;
|
||||
}
|
||||
|
||||
// TODO ROLES Change to readonly.
|
||||
public HashSet<JobRequirement>? GetJobRequirement(ProtoId<JobPrototype> job)
|
||||
// TODO ROLES Change to readonly?
|
||||
/// <inheritdoc cref="GetRoleRequirements(JobPrototype)"/>
|
||||
public HashSet<JobRequirement>? GetRoleRequirements(AntagPrototype antag)
|
||||
{
|
||||
if (_requirementOverride != null && _requirementOverride.Jobs.TryGetValue(job, out var req))
|
||||
return req;
|
||||
|
||||
return _prototypes.Index(job).Requirements;
|
||||
}
|
||||
|
||||
// TODO ROLES Change to readonly.
|
||||
public HashSet<JobRequirement>? GetAntagRequirement(ProtoId<AntagPrototype> antag)
|
||||
{
|
||||
if (_requirementOverride != null && _requirementOverride.Antags.TryGetValue(antag, out var req))
|
||||
return req;
|
||||
|
||||
return _prototypes.Index(antag).Requirements;
|
||||
}
|
||||
|
||||
// TODO ROLES Change to readonly.
|
||||
public HashSet<JobRequirement>? GetAntagRequirement(AntagPrototype antag)
|
||||
{
|
||||
if (_requirementOverride != null && _requirementOverride.Antags.TryGetValue(antag.ID, out var req))
|
||||
if (_requirementOverride != null && _requirementOverride.Jobs.TryGetValue(antag.ID, out var req))
|
||||
return req;
|
||||
|
||||
return antag.Requirements;
|
||||
}
|
||||
|
||||
// TODO ROLES Change to readonly?
|
||||
/// <inheritdoc cref="GetRoleRequirements(JobPrototype)"/>
|
||||
public HashSet<JobRequirement>? GetRoleRequirements(ProtoId<JobPrototype> jobId)
|
||||
{
|
||||
return _prototypes.TryIndex(jobId, out var job) ? GetRoleRequirements(job) : null;
|
||||
}
|
||||
|
||||
// TODO ROLES Change to readonly?
|
||||
/// <inheritdoc cref="GetRoleRequirements(JobPrototype)"/>
|
||||
public HashSet<JobRequirement>? GetRoleRequirements(ProtoId<AntagPrototype> antagId)
|
||||
{
|
||||
return _prototypes.TryIndex(antagId, out var antag) ? GetRoleRequirements(antag) : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the localized name of a role type's subtype. If the provided subtype parameter turns out to be empty, it returns the localized name of the role type instead.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user