Skip to content

Commit

Permalink
revenant emag whitelist (#21849)
Browse files Browse the repository at this point in the history
* add MalfunctionWhitelist

* whitelist a few things

* locutus of borg

* support blacklist

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
  • Loading branch information
deltanedas committed Nov 27, 2023
1 parent f09b5f3 commit ab645fb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@ private void OnMalfunctionAction(EntityUid uid, RevenantComponent component, Rev

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.
}
}
Expand Down
14 changes: 14 additions & 0 deletions Content.Shared/Revenant/Components/RevenantComponent.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -182,6 +183,19 @@ public sealed partial class RevenantComponent : Component
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("malfunctionRadius")]
public float MalfunctionRadius = 3.5f;

/// <summary>
/// Whitelist for entities that can be emagged by malfunction.
/// Used to prevent ultra gamer things like ghost emagging chem or instantly launching the shuttle.
/// </summary>
[DataField]
public EntityWhitelist? MalfunctionWhitelist;

/// <summary>
/// Whitelist for entities that can never be emagged by malfunction.
/// </summary>
[DataField]
public EntityWhitelist? MalfunctionBlacklist;
#endregion

#region Visualizer
Expand Down
11 changes: 11 additions & 0 deletions Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ab645fb

Please sign in to comment.