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;
|
|
|
|
|
|
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!;
|
2023-05-05 08:56:54 -05:00
|
|
|
[Dependency] private readonly ILogManager _log = default!;
|
2021-11-24 20:03:07 +13:00
|
|
|
|
2022-05-21 14:19:02 +10:00
|
|
|
public const string Sawmill = "idconsole";
|
2023-05-05 08:56:54 -05:00
|
|
|
protected ISawmill _sawmill = default!;
|
2022-05-21 14:19:02 +10:00
|
|
|
|
2021-11-24 20:03:07 +13:00
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
2023-05-05 08:56:54 -05:00
|
|
|
_sawmill = _log.GetSawmill(Sawmill);
|
2021-11-24 20:03:07 +13:00
|
|
|
|
2023-04-08 13:15:52 -07:00
|
|
|
SubscribeLocalEvent<IdCardConsoleComponent, ComponentInit>(OnComponentInit);
|
|
|
|
|
SubscribeLocalEvent<IdCardConsoleComponent, ComponentRemove>(OnComponentRemove);
|
2021-11-24 20:03:07 +13:00
|
|
|
}
|
|
|
|
|
|
2023-04-08 13:15:52 -07:00
|
|
|
private void OnComponentInit(EntityUid uid, IdCardConsoleComponent component, ComponentInit args)
|
2021-11-24 20:03:07 +13:00
|
|
|
{
|
2023-04-08 13:15:52 -07:00
|
|
|
_itemSlotsSystem.AddItemSlot(uid, IdCardConsoleComponent.PrivilegedIdCardSlotId, component.PrivilegedIdSlot);
|
|
|
|
|
_itemSlotsSystem.AddItemSlot(uid, IdCardConsoleComponent.TargetIdCardSlotId, component.TargetIdSlot);
|
2021-11-24 20:03:07 +13:00
|
|
|
}
|
|
|
|
|
|
2023-04-08 13:15:52 -07:00
|
|
|
private void OnComponentRemove(EntityUid uid, IdCardConsoleComponent component, ComponentRemove args)
|
2021-11-24 20:03:07 +13:00
|
|
|
{
|
|
|
|
|
_itemSlotsSystem.RemoveItemSlot(uid, component.PrivilegedIdSlot);
|
|
|
|
|
_itemSlotsSystem.RemoveItemSlot(uid, component.TargetIdSlot);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|