2020-06-03 11:46:59 +02:00
|
|
|
using System;
|
2020-05-28 06:22:47 -05:00
|
|
|
using System.Collections.Generic;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Access.Components;
|
2020-05-28 06:22:47 -05:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-03-05 01:08:38 +01:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-06-03 11:46:59 +02:00
|
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.PDA
|
2020-05-28 06:22:47 -05:00
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
|
|
|
|
[ComponentReference(typeof(IAccess))]
|
2021-10-03 07:05:52 +03:00
|
|
|
public class PDAComponent : Component, IAccess
|
2020-05-28 06:22:47 -05:00
|
|
|
{
|
2021-10-03 07:05:52 +03:00
|
|
|
public override string Name => "PDA";
|
2020-06-03 11:46:59 +02:00
|
|
|
|
2021-10-06 08:55:45 +11:00
|
|
|
[DataField("idSlot")]
|
|
|
|
|
public string IdSlot = "pdaIdSlot";
|
|
|
|
|
|
|
|
|
|
[DataField("penSlot")]
|
|
|
|
|
public string PenSlot = "pdaPenSlot";
|
2020-11-08 13:43:13 +01:00
|
|
|
|
2021-10-03 07:05:52 +03:00
|
|
|
[ViewVariables] [DataField("idCard")] public string? StartingIdCard;
|
2020-11-08 13:43:13 +01:00
|
|
|
|
2021-10-03 07:05:52 +03:00
|
|
|
[ViewVariables] public IdCardComponent? ContainedID;
|
|
|
|
|
[ViewVariables] public bool PenInserted;
|
|
|
|
|
[ViewVariables] public bool FlashlightOn;
|
2020-11-08 13:43:13 +01:00
|
|
|
|
2021-10-03 07:05:52 +03:00
|
|
|
[ViewVariables] public string? OwnerName;
|
2020-06-03 11:46:59 +02:00
|
|
|
|
2021-10-03 07:05:52 +03:00
|
|
|
// TODO: Move me to ECS after Access refactoring
|
|
|
|
|
#region Acces Logic
|
|
|
|
|
[ViewVariables] private readonly PDAAccessSet _accessSet;
|
2021-07-10 17:35:33 +02:00
|
|
|
|
2020-06-03 11:46:59 +02:00
|
|
|
public PDAComponent()
|
|
|
|
|
{
|
2021-10-03 07:05:52 +03:00
|
|
|
_accessSet = new PDAAccessSet(this);
|
2020-11-08 13:43:13 +01:00
|
|
|
}
|
|
|
|
|
|
2021-10-03 07:05:52 +03:00
|
|
|
public ISet<string>? GetContainedAccess()
|
2020-11-08 13:43:13 +01:00
|
|
|
{
|
2021-10-03 07:05:52 +03:00
|
|
|
return ContainedID?.Owner?.GetComponent<AccessComponent>()?.Tags;
|
2020-05-28 06:22:47 -05:00
|
|
|
}
|
|
|
|
|
|
2021-10-03 07:05:52 +03:00
|
|
|
ISet<string> IAccess.Tags => _accessSet;
|
2020-11-08 13:43:13 +01:00
|
|
|
|
2021-10-03 07:05:52 +03:00
|
|
|
bool IAccess.IsReadOnly => true;
|
2020-11-08 13:43:13 +01:00
|
|
|
|
2021-10-03 07:05:52 +03:00
|
|
|
void IAccess.SetTags(IEnumerable<string> newTags)
|
2020-05-28 06:22:47 -05:00
|
|
|
{
|
2021-10-03 07:05:52 +03:00
|
|
|
throw new NotSupportedException("PDA access list is read-only.");
|
2020-05-28 06:22:47 -05:00
|
|
|
}
|
2021-10-03 07:05:52 +03:00
|
|
|
#endregion
|
2020-05-28 06:22:47 -05:00
|
|
|
}
|
|
|
|
|
}
|