Files
Delta-v/Content.Shared/_DV/Projectiles/SharedEmbedImmuneSystem.cs
T
William Lemonandpre-commit-ci[bot] bc8f5a7a20 Even More Skia Tweaks (#4355)
* More Skia tweaks

* Swapped whitelist for EntityWhitelist

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-11 06:02:48 +00:00

30 lines
876 B
C#

using Content.Shared.Projectiles;
using Content.Shared.Whitelist;
namespace Content.Shared._DV.Projectiles;
public sealed partial class SharedEmbedImmuneSystem : EntitySystem
{
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<EmbedImmuneComponent, ProjectileReflectAttemptEvent>(OnProjectileReflectAttempt);
}
private void OnProjectileReflectAttempt(Entity<EmbedImmuneComponent> entity, ref ProjectileReflectAttemptEvent args)
{
if (!TryComp<EmbeddableProjectileComponent>(args.ProjUid, out var embeddable))
return;
// If we're blacklisted, bounce the projectile.
if (_whitelist.IsWhitelistFail(entity.Comp.ImmuneTo, args.ProjUid))
return;
args.Cancelled = true;
}
}