Фиксы светошумовых гранат (#470)

* add full headset to security lockers and vendors

* wd

* fix range

* - fix: Night vision.

* - fix: Fixes.

---------

Co-authored-by: Aviu00 <aviu00@protonmail.com>
This commit is contained in:
ThereDrD0
2024-07-20 18:28:44 +03:00
committed by GitHub
parent d556318b61
commit 89d1c95cbf
17 changed files with 60 additions and 37 deletions

View File

@@ -1,4 +1,4 @@
using Content.Shared.Inventory.Events;
using Content.Shared.Inventory;
using Content.Shared.Stunnable;
namespace Content.Shared._White.BuffedFlashGrenade;
@@ -7,11 +7,37 @@ public sealed class FlashSoundSuppressionSystem : EntitySystem
{
[Dependency] private readonly SharedStunSystem _stunSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<FlashSoundSuppressionComponent, InventoryRelayedEvent<GetFlashbangedEvent>>(
OnGetFlashbanged);
}
private void OnGetFlashbanged(Entity<FlashSoundSuppressionComponent> ent,
ref InventoryRelayedEvent<GetFlashbangedEvent> args)
{
args.Args.Protected = true;
}
public void Stun(EntityUid target, float duration)
{
if (HasComp<FlashSoundSuppressionComponent>(target))
return;
var ev = new GetFlashbangedEvent();
RaiseLocalEvent(target, ev);
if (ev.Protected)
return;
_stunSystem.TryParalyze(target, TimeSpan.FromSeconds(duration / 1000f), true);
}
}
public sealed class GetFlashbangedEvent : EntityEventArgs, IInventoryRelayEvent
{
public bool Protected;
public SlotFlags TargetSlots => SlotFlags.EARS | SlotFlags.HEAD;
}