Fire MeleeHitEvent on misses. (#12867)

* Fire MeleeHitEvent when there are no targets.

* Prevent certain weapons from activating if they had no hit entities on hit.

* Prevent miss events from firing when target is yourself or was deleted.

* Use .Value as Target is already known not to be null.

* uid changes

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Vordenburg
2023-02-13 07:55:39 -05:00
committed by GitHub
parent 650ade0d4e
commit 4183b5f449
8 changed files with 95 additions and 82 deletions

View File

@@ -1,3 +1,4 @@
using System.Linq;
using Content.Server.Flash.Components;
using Content.Server.Light.EntitySystems;
using Content.Server.Stunnable;
@@ -43,11 +44,12 @@ namespace Content.Server.Flash
private void OnFlashMeleeHit(EntityUid uid, FlashComponent comp, MeleeHitEvent args)
{
if (!args.IsHit)
return;
if (!UseFlash(comp, args.User))
if (!args.IsHit ||
!args.HitEntities.Any() ||
!UseFlash(comp, args.User))
{
return;
}
args.Handled = true;
foreach (var e in args.HitEntities)