diff --git a/Content.Server/Backmen/AccessWeaponBlockerSystem/AccessWeaponBlockerComponent.cs b/Content.Server/Backmen/AccessWeaponBlockerSystem/AccessWeaponBlockerComponent.cs deleted file mode 100644 index 49bf7e87044..00000000000 --- a/Content.Server/Backmen/AccessWeaponBlockerSystem/AccessWeaponBlockerComponent.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Content.Shared.Access; -using Content.Shared.Backmen.AccessWeaponBlockerSystem; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; - -namespace Content.Server.Backmen.AccessWeaponBlockerSystem; - -[RegisterComponent] -public sealed partial class AccessWeaponBlockerComponent : SharedAccessWeaponBlockerComponent -{ - [ViewVariables(VVAccess.ReadWrite)] - public bool CanUse; - - [ViewVariables(VVAccess.ReadWrite)] - [DataField("alertText")] - public string AlertText = ""; - - [ViewVariables(VVAccess.ReadWrite), - DataField("access", customTypeSerializer: typeof(PrototypeIdHashSetSerializer))] - public HashSet Access = new(); -} diff --git a/Content.Server/Backmen/AccessWeaponBlockerSystem/AccessWeaponBlockerSystem.cs b/Content.Server/Backmen/AccessWeaponBlockerSystem/AccessWeaponBlockerSystem.cs deleted file mode 100644 index 592a314394b..00000000000 --- a/Content.Server/Backmen/AccessWeaponBlockerSystem/AccessWeaponBlockerSystem.cs +++ /dev/null @@ -1,74 +0,0 @@ -using Content.Shared.Hands; -using Content.Shared.Access.Components; -using Content.Shared.Backmen.AccessWeaponBlockerSystem; -using Content.Shared.Weapons.Melee.Events; -using Content.Shared.Weapons.Ranged.Systems; -using Robust.Shared.GameStates; -using Content.Shared.Inventory; -using Content.Shared.PDA; - -namespace Content.Server.Backmen.AccessWeaponBlockerSystem; - -public sealed class AccessWeaponBlockerSystem : EntitySystem -{ - [Dependency] private readonly InventorySystem _inventorySystem = default!; - public override void Initialize() - { - base.Initialize(); - - SubscribeLocalEvent(OnShootAttempt); - SubscribeLocalEvent(OnMeleeAttempt); - SubscribeLocalEvent(OnGetState); - SubscribeLocalEvent(OnGotEquippedHand); - } - - - private void OnGotEquippedHand(EntityUid uid, AccessWeaponBlockerComponent component, ref GotEquippedHandEvent args) - { - if (!_inventorySystem.TryGetSlotEntity(args.User, "id", out var slotCardUid)) - return; - var accessEntity = TryComp(slotCardUid, out var pda) && pda.ContainedId is { } pdaSlot - ? pdaSlot - : slotCardUid.Value; - component.CanUse = IsAnyAccess(accessEntity, component); - Dirty(uid, component); - } - - private bool IsAnyAccess(EntityUid accessEntity, AccessWeaponBlockerComponent component) - { - if (!TryComp(accessEntity, out var access)) - return false; - foreach (var accessTag in access.Tags) - { - if (component.Access.Contains(accessTag)) - return true; - } - return false; - } - private void OnGetState(EntityUid uid, AccessWeaponBlockerComponent component, ref ComponentGetState args) - { - args.State = new AccessWeaponBlockerComponentState() - { - CanUse = component.CanUse, - AlertText = component.AlertText - }; - } - - private void OnMeleeAttempt(EntityUid uid, AccessWeaponBlockerComponent component, ref AttemptMeleeEvent args) - { - if (component.CanUse) - return; - - args.Cancelled = true; - args.Message = component.AlertText; - } - - private void OnShootAttempt(EntityUid uid, AccessWeaponBlockerComponent component, ref AttemptShootEvent args) - { - if (component.CanUse) - return; - - args.Cancelled = true; - args.Message = component.AlertText; - } -}