diff --git a/Content.Shared/Emag/Components/EmagComponent.cs b/Content.Shared/Emag/Components/EmagComponent.cs index 23d3b90eed..ecfdf0ceb9 100644 --- a/Content.Shared/Emag/Components/EmagComponent.cs +++ b/Content.Shared/Emag/Components/EmagComponent.cs @@ -1,5 +1,6 @@ using Content.Shared.Emag.Systems; using Content.Shared.Tag; +using Content.Shared.Whitelist; // DeltaV using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; @@ -20,6 +21,12 @@ public sealed partial class EmagComponent : Component [AutoNetworkedField] public ProtoId EmagImmuneTag = "EmagImmune"; + /// + /// DeltaV: Blacklist for entities that cannot be emagged with this. + /// + [DataField] + public EntityWhitelist? Blacklist; + /// /// What type of emag effect this device will do /// diff --git a/Content.Shared/Emag/Systems/EmagSystem.cs b/Content.Shared/Emag/Systems/EmagSystem.cs index 9626f17719..11fbc42693 100644 --- a/Content.Shared/Emag/Systems/EmagSystem.cs +++ b/Content.Shared/Emag/Systems/EmagSystem.cs @@ -7,6 +7,7 @@ using Content.Shared.IdentityManagement; using Content.Shared.Interaction; using Content.Shared.Popups; using Content.Shared.Tag; +using Content.Shared.Whitelist; // DeltaV using Robust.Shared.Audio.Systems; using Robust.Shared.Serialization; @@ -20,6 +21,7 @@ namespace Content.Shared.Emag.Systems; /// 5. Optionally, set Repeatable on the event to true if you don't want the emagged component to be added public sealed class EmagSystem : EntitySystem { + [Dependency] private readonly EntityWhitelistSystem _whitelist = default!; // DeltaV [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly SharedChargesSystem _charges = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; @@ -61,6 +63,11 @@ public sealed class EmagSystem : EntitySystem if (_tag.HasTag(target, ent.Comp.EmagImmuneTag)) return false; + // Begin DeltaV Additions + if (_whitelist.IsBlacklistPass(ent.Comp.Blacklist, target)) + return false; + // End DeltaV Additions + TryComp(ent, out var charges); if (_charges.IsEmpty(ent, charges)) { diff --git a/Resources/Prototypes/Entities/Objects/Tools/emag.yml b/Resources/Prototypes/Entities/Objects/Tools/emag.yml index 616772a4fc..980bdd8d71 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/emag.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/emag.yml @@ -6,6 +6,9 @@ description: The all-in-one hacking solution. Friend of any syndicate. The iconic EMAG. components: - type: Emag + blacklist: # DeltaV - prevent emag removing access from doors + components: + - Airlock - type: Sprite sprite: Objects/Tools/emag.rsi state: icon diff --git a/Resources/Prototypes/_DV/Entities/Objects/Tools/emag.yml b/Resources/Prototypes/_DV/Entities/Objects/Tools/emag.yml index f76dffd76f..49e4bf146b 100644 --- a/Resources/Prototypes/_DV/Entities/Objects/Tools/emag.yml +++ b/Resources/Prototypes/_DV/Entities/Objects/Tools/emag.yml @@ -6,6 +6,7 @@ components: - type: Emag emagType: Access # LockSystem has its type changed so this only affects airlocks + blacklist: null # allow airlocks - type: Sprite sprite: _DV/Objects/Tools/doorjack.rsi - type: Item