add support for per-id access on AccessReaderComponent (#13659)
* add support for per-id access on AccessReaderComponent * comments!!! * oh yeah we predicting baby * foobar * sloth review * weh
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Server.StationRecords;
|
||||
using Content.Server.StationRecords.Systems;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Access.Systems;
|
||||
using Content.Shared.Administration.Logs;
|
||||
|
||||
@@ -1,22 +1,17 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Server.StationRecords;
|
||||
using Content.Server.StationRecords.Systems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.CrewManifest;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Roles;
|
||||
using Content.Shared.StationRecords;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.CrewManifest;
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
using Content.Server.Access.Systems;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration.Systems;
|
||||
using Content.Server.Cloning;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.PDA;
|
||||
using Content.Server.StationRecords;
|
||||
using Content.Server.StationRecords.Systems;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.PDA;
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using Content.Shared.StationRecords;
|
||||
|
||||
namespace Content.Server.StationRecords;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed class StationRecordKeyStorageComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The key stored in this component.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public StationRecordKey? Key;
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
using Content.Server.StationRecords.Systems;
|
||||
|
||||
namespace Content.Server.StationRecords;
|
||||
|
||||
[Access(typeof(StationRecordsSystem))]
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
using Content.Shared.StationRecords;
|
||||
|
||||
namespace Content.Server.StationRecords.Systems;
|
||||
|
||||
public sealed class StationRecordKeyStorageSystem : EntitySystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Assigns a station record key to an entity.
|
||||
/// </summary>
|
||||
/// <param name="uid"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="keyStorage"></param>
|
||||
public void AssignKey(EntityUid uid, StationRecordKey key, StationRecordKeyStorageComponent? keyStorage = null)
|
||||
{
|
||||
if (!Resolve(uid, ref keyStorage))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
keyStorage.Key = key;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a station record key from an entity.
|
||||
/// </summary>
|
||||
/// <param name="uid"></param>
|
||||
/// <param name="keyStorage"></param>
|
||||
/// <returns></returns>
|
||||
public StationRecordKey? RemoveKey(EntityUid uid, StationRecordKeyStorageComponent? keyStorage = null)
|
||||
{
|
||||
if (!Resolve(uid, ref keyStorage) || keyStorage.Key == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var key = keyStorage.Key;
|
||||
keyStorage.Key = null;
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if an entity currently contains a station record key.
|
||||
/// </summary>
|
||||
/// <param name="uid"></param>
|
||||
/// <param name="keyStorage"></param>
|
||||
/// <returns></returns>
|
||||
public bool CheckKey(EntityUid uid, StationRecordKeyStorageComponent? keyStorage = null)
|
||||
{
|
||||
if (!Resolve(uid, ref keyStorage))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return keyStorage.Key != null;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.Access.Systems;
|
||||
using System.Linq;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Server.StationRecords;
|
||||
using Content.Server.StationRecords.Systems;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.PDA;
|
||||
@@ -13,6 +11,8 @@ using Content.Shared.StationRecords;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.StationRecords.Systems;
|
||||
|
||||
/// <summary>
|
||||
/// Station records.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user