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,4 +1,5 @@
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared.Access.Systems
|
||||
@@ -56,5 +57,33 @@ namespace Content.Shared.Access.Systems
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the access on an <see cref="AccessComponent"/> to the access for a specific job.
|
||||
/// </summary>
|
||||
/// <param name="uid">The ID of the entity with the access component.</param>
|
||||
/// <param name="prototype">The job prototype to use access from.</param>
|
||||
/// <param name="extended">Whether to apply extended job access.</param>
|
||||
/// <param name="access">The access component.</param>
|
||||
public void SetAccessToJob(
|
||||
EntityUid uid,
|
||||
JobPrototype prototype,
|
||||
bool extended,
|
||||
AccessComponent? access = null)
|
||||
{
|
||||
if (!Resolve(uid, ref access))
|
||||
return;
|
||||
|
||||
access.Tags.Clear();
|
||||
access.Tags.UnionWith(prototype.Access);
|
||||
|
||||
TryAddGroups(uid, prototype.AccessGroups, access);
|
||||
|
||||
if (extended)
|
||||
{
|
||||
access.Tags.UnionWith(prototype.ExtendedAccess);
|
||||
TryAddGroups(uid, prototype.ExtendedAccessGroups, access);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user