using Content.Shared._DV.Clothing.Components; using Content.Shared.Inventory.Events; using Content.Shared.Whitelist; namespace Content.Shared._DV.Clothing.EntitySystems; public sealed class SpecialisedClothingSystem : EntitySystem { [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; private readonly LocId _defaultReason = "specialized-clothing-default-failure"; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnBeingEquipped); } /// /// Handles when a piece of specialized equipment attempts to be equipped, blocking it /// in the case where the equipee is an invalid user. /// /// Clothing being equipped. /// Args for the event, notably the entity equipping the clothing. private void OnBeingEquipped(Entity ent, ref BeingEquippedAttemptEvent args) { if (_whitelistSystem.IsWhitelistPass(ent.Comp.Whitelist, args.EquipTarget)) return; args.Reason = ent.Comp.FailureReason ?? _defaultReason; args.Cancel(); } }