Fix access wires emagging machines (#14471)

* Fix access wires emagging machines

* comment

* le fix
This commit is contained in:
Nemanja
2023-03-13 22:55:18 -04:00
committed by GitHub
parent 73efa95662
commit 89d3875cde
3 changed files with 33 additions and 17 deletions

View File

@@ -32,7 +32,7 @@ namespace Content.Shared.Access.Systems
private void OnGetState(EntityUid uid, AccessReaderComponent component, ref ComponentGetState args)
{
args.State = new AccessReaderComponentState(component.DenyTags, component.AccessLists,
args.State = new AccessReaderComponentState(component.Enabled, component.DenyTags, component.AccessLists,
component.AccessKeys);
}
@@ -40,6 +40,7 @@ namespace Content.Shared.Access.Systems
{
if (args.Current is not AccessReaderComponentState state)
return;
component.Enabled = state.Enabled;
component.AccessKeys = new (state.AccessKeys);
component.AccessLists = new (state.AccessLists);
component.DenyTags = new (state.DenyTags);
@@ -67,8 +68,9 @@ namespace Content.Shared.Access.Systems
private void OnEmagged(EntityUid uid, AccessReaderComponent reader, ref GotEmaggedEvent args)
{
// no fancy conditions
args.Handled = true;
reader.Enabled = false;
Dirty(reader);
}
/// <summary>
@@ -95,6 +97,10 @@ namespace Content.Shared.Access.Systems
{
var allEnts = FindPotentialAccessItems(entity);
// Access reader is totally disabled, so access is always allowed.
if (!reader.Enabled)
return true;
if (AreAccessTagsAllowed(FindAccessTags(entity, allEnts), reader))
return true;
@@ -111,12 +117,6 @@ namespace Content.Shared.Access.Systems
/// <param name="reader">An access reader to check against</param>
public bool AreAccessTagsAllowed(ICollection<string> accessTags, AccessReaderComponent reader)
{
if (HasComp<EmaggedComponent>(reader.Owner))
{
// Access reader is totally disabled, so access is always allowed.
return true;
}
if (reader.DenyTags.Overlaps(accessTags))
{
// Sec owned by cargo.