2021-12-16 23:42:02 +13:00
|
|
|
using Content.Shared.Access.Components;
|
2021-11-24 20:03:07 +13:00
|
|
|
using Content.Shared.Containers.ItemSlots;
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
2021-12-16 23:42:02 +13:00
|
|
|
namespace Content.Shared.Access.Systems
|
2021-11-24 20:03:07 +13:00
|
|
|
{
|
|
|
|
|
[UsedImplicitly]
|
|
|
|
|
public abstract class SharedIdCardConsoleSystem : EntitySystem
|
|
|
|
|
{
|
|
|
|
|
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
|
|
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
|
|
|
|
SubscribeLocalEvent<SharedIdCardConsoleComponent, ComponentInit>(OnComponentInit);
|
|
|
|
|
SubscribeLocalEvent<SharedIdCardConsoleComponent, ComponentRemove>(OnComponentRemove);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnComponentInit(EntityUid uid, SharedIdCardConsoleComponent component, ComponentInit args)
|
|
|
|
|
{
|
|
|
|
|
_itemSlotsSystem.AddItemSlot(uid, $"{component.Name}-privilegedId", component.PrivilegedIdSlot);
|
|
|
|
|
_itemSlotsSystem.AddItemSlot(uid, $"{component.Name}-targetId", component.TargetIdSlot);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnComponentRemove(EntityUid uid, SharedIdCardConsoleComponent component, ComponentRemove args)
|
|
|
|
|
{
|
|
|
|
|
_itemSlotsSystem.RemoveItemSlot(uid, component.PrivilegedIdSlot);
|
|
|
|
|
_itemSlotsSystem.RemoveItemSlot(uid, component.TargetIdSlot);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|