mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-02-14 19:30:01 +01:00
Make flash prevent handheld light toggle (#9448)
Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Flash.Components;
|
||||
using Content.Server.Light.EntitySystems;
|
||||
using Content.Server.Stunnable;
|
||||
using Content.Server.Weapon.Melee;
|
||||
using Content.Shared.Examine;
|
||||
@@ -31,6 +32,7 @@ namespace Content.Server.Flash
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<FlashComponent, MeleeHitEvent>(OnFlashMeleeHit);
|
||||
SubscribeLocalEvent<FlashComponent, UseInHandEvent>(OnFlashUseInHand, before: new []{ typeof(HandheldLightSystem) });
|
||||
SubscribeLocalEvent<FlashComponent, ExaminedEvent>(OnFlashExamined);
|
||||
|
||||
SubscribeLocalEvent<InventoryComponent, FlashAttemptEvent>(OnInventoryFlashAttempt);
|
||||
@@ -67,9 +69,7 @@ namespace Content.Server.Flash
|
||||
private void OnFlashMeleeHit(EntityUid uid, FlashComponent comp, MeleeHitEvent args)
|
||||
{
|
||||
if (!UseFlash(comp, args.User))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
args.Handled = true;
|
||||
foreach (var e in args.HitEntities)
|
||||
@@ -77,6 +77,15 @@ namespace Content.Server.Flash
|
||||
Flash(e, args.User, uid, comp.FlashDuration, comp.SlowTo);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnFlashUseInHand(EntityUid uid, FlashComponent comp, UseInHandEvent args)
|
||||
{
|
||||
if (args.Handled || !UseFlash(comp, args.User))
|
||||
return;
|
||||
|
||||
args.Handled = true;
|
||||
FlashArea(uid, args.User, comp.Range, comp.AoeFlashDuration, comp.SlowTo, true);
|
||||
}
|
||||
|
||||
private bool UseFlash(FlashComponent comp, EntityUid user)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user