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:
@@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.CombatMode;
|
||||
@@ -139,10 +140,12 @@ public sealed class StaminaSystem : EntitySystem
|
||||
|
||||
private void OnHit(EntityUid uid, StaminaDamageOnHitComponent component, MeleeHitEvent args)
|
||||
{
|
||||
if (!args.IsHit)
|
||||
if (!args.IsHit ||
|
||||
!args.HitEntities.Any() ||
|
||||
component.Damage <= 0f)
|
||||
{
|
||||
return;
|
||||
|
||||
if (component.Damage <= 0f) return;
|
||||
}
|
||||
|
||||
var ev = new StaminaDamageOnHitAttemptEvent();
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
|
||||
Reference in New Issue
Block a user