mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 23:57:29 +00:00
* 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>
30 lines
876 B
C#
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;
|
|
}
|
|
}
|