Files
tbd-station-14/Content.Server/PDA/PDAComponent.cs
Leon Friedrich 6f50dd2f7b Make ItemCabinet use ItemSlots (#4771)
* pda slot names

* cabinets use item slots

* fix yaml

* fix tests
2021-10-05 14:55:45 -07:00

55 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using Content.Server.Access.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.PDA
{
[RegisterComponent]
[ComponentReference(typeof(IAccess))]
public class PDAComponent : Component, IAccess
{
public override string Name => "PDA";
[DataField("idSlot")]
public string IdSlot = "pdaIdSlot";
[DataField("penSlot")]
public string PenSlot = "pdaPenSlot";
[ViewVariables] [DataField("idCard")] public string? StartingIdCard;
[ViewVariables] public IdCardComponent? ContainedID;
[ViewVariables] public bool PenInserted;
[ViewVariables] public bool FlashlightOn;
[ViewVariables] public string? OwnerName;
// TODO: Move me to ECS after Access refactoring
#region Acces Logic
[ViewVariables] private readonly PDAAccessSet _accessSet;
public PDAComponent()
{
_accessSet = new PDAAccessSet(this);
}
public ISet<string>? GetContainedAccess()
{
return ContainedID?.Owner?.GetComponent<AccessComponent>()?.Tags;
}
ISet<string> IAccess.Tags => _accessSet;
bool IAccess.IsReadOnly => true;
void IAccess.SetTags(IEnumerable<string> newTags)
{
throw new NotSupportedException("PDA access list is read-only.");
}
#endregion
}
}