using Content.Shared.StationRecords;
namespace Content.Server.StationRecords.Systems;
public sealed class StationRecordKeyStorageSystem : EntitySystem
{
///
/// Assigns a station record key to an entity.
///
///
///
///
public void AssignKey(EntityUid uid, StationRecordKey key, StationRecordKeyStorageComponent? keyStorage = null)
{
if (!Resolve(uid, ref keyStorage))
{
return;
}
keyStorage.Key = key;
}
///
/// Removes a station record key from an entity.
///
///
///
///
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;
}
///
/// Checks if an entity currently contains a station record key.
///
///
///
///
public bool CheckKey(EntityUid uid, StationRecordKeyStorageComponent? keyStorage = null)
{
if (!Resolve(uid, ref keyStorage))
{
return false;
}
return keyStorage.Key != null;
}
}