From ab645fb77b749f3971ca601ab382e7fc4046768f Mon Sep 17 00:00:00 2001
From: deltanedas <39013340+deltanedas@users.noreply.github.com>
Date: Mon, 27 Nov 2023 21:39:29 +0000
Subject: [PATCH] revenant emag whitelist (#21849)
* add MalfunctionWhitelist
* whitelist a few things
* locutus of borg
* support blacklist
---------
Co-authored-by: deltanedas <@deltanedas:kde.org>
---
.../EntitySystems/RevenantSystem.Abilities.cs | 6 ++++++
.../Revenant/Components/RevenantComponent.cs | 14 ++++++++++++++
.../Prototypes/Entities/Mobs/NPCs/revenant.yml | 11 +++++++++++
3 files changed, 31 insertions(+)
diff --git a/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs b/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs
index cb20a1b868..eb6eb5a426 100644
--- a/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs
+++ b/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs
@@ -321,6 +321,12 @@ public sealed partial class RevenantSystem
foreach (var ent in _lookup.GetEntitiesInRange(uid, component.MalfunctionRadius))
{
+ if (component.MalfunctionWhitelist?.IsValid(ent, EntityManager) == false)
+ continue;
+
+ if (component.MalfunctionBlacklist?.IsValid(ent, EntityManager) == true)
+ continue;
+
_emag.DoEmagEffect(uid, ent); //it does not emag itself. adorable.
}
}
diff --git a/Content.Shared/Revenant/Components/RevenantComponent.cs b/Content.Shared/Revenant/Components/RevenantComponent.cs
index 9e92762b18..b3d47e22f9 100644
--- a/Content.Shared/Revenant/Components/RevenantComponent.cs
+++ b/Content.Shared/Revenant/Components/RevenantComponent.cs
@@ -1,6 +1,7 @@
using System.Numerics;
using Content.Shared.FixedPoint;
using Content.Shared.Store;
+using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
@@ -182,6 +183,19 @@ public sealed partial class RevenantComponent : Component
///
[ViewVariables(VVAccess.ReadWrite), DataField("malfunctionRadius")]
public float MalfunctionRadius = 3.5f;
+
+ ///
+ /// Whitelist for entities that can be emagged by malfunction.
+ /// Used to prevent ultra gamer things like ghost emagging chem or instantly launching the shuttle.
+ ///
+ [DataField]
+ public EntityWhitelist? MalfunctionWhitelist;
+
+ ///
+ /// Whitelist for entities that can never be emagged by malfunction.
+ ///
+ [DataField]
+ public EntityWhitelist? MalfunctionBlacklist;
#endregion
#region Visualizer
diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml b/Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml
index 866e15735f..68ebf52dc0 100644
--- a/Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml
+++ b/Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml
@@ -58,6 +58,17 @@
rules: ghost-role-information-revenant-rules
- type: GhostTakeoverAvailable
- type: Revenant
+ malfunctionWhitelist:
+ components:
+ # emag lockers open
+ - EntityStorage
+ # emag doors open
+ - Airlock
+ # troll medical to help get kills
+ - StasisBed
+ - EmaggableMedibot
+ # borg become killer
+ - EmagSiliconLaw
- type: PointLight
color: MediumPurple
radius: 2