Harmbaton rework + remove MeleeInteractEvent (#8157)
This commit is contained in:
@@ -34,7 +34,6 @@ namespace Content.Server.Stunnable
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<StunbatonComponent, MeleeHitEvent>(OnMeleeHit);
|
||||
SubscribeLocalEvent<StunbatonComponent, MeleeInteractEvent>(OnMeleeInteract);
|
||||
SubscribeLocalEvent<StunbatonComponent, UseInHandEvent>(OnUseInHand);
|
||||
SubscribeLocalEvent<StunbatonComponent, ThrowDoHitEvent>(OnThrowCollide);
|
||||
SubscribeLocalEvent<StunbatonComponent, PowerCellChangedEvent>(OnPowerCellChanged);
|
||||
@@ -43,7 +42,7 @@ namespace Content.Server.Stunnable
|
||||
|
||||
private void OnMeleeHit(EntityUid uid, StunbatonComponent comp, MeleeHitEvent args)
|
||||
{
|
||||
if (!comp.Activated || !args.HitEntities.Any())
|
||||
if (!comp.Activated || !args.HitEntities.Any() || args.Handled)
|
||||
return;
|
||||
|
||||
if (!_cellSystem.TryGetBatteryFromSlot(uid, out var battery) || !battery.TryUseCharge(comp.EnergyPerUse))
|
||||
@@ -54,19 +53,9 @@ namespace Content.Server.Stunnable
|
||||
StunEntity(entity, comp);
|
||||
SendPowerPulse(entity, args.User, uid);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMeleeInteract(EntityUid uid, StunbatonComponent comp, MeleeInteractEvent args)
|
||||
{
|
||||
if (!comp.Activated)
|
||||
return;
|
||||
|
||||
if (!_cellSystem.TryGetBatteryFromSlot(uid, out var battery) || !battery.TryUseCharge(comp.EnergyPerUse))
|
||||
return;
|
||||
|
||||
args.CanInteract = true;
|
||||
StunEntity(args.Entity, comp);
|
||||
SendPowerPulse(args.Entity, args.User, uid);
|
||||
// No combat should occur if we successfully stunned.
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private void OnUseInHand(EntityUid uid, StunbatonComponent comp, UseInHandEvent args)
|
||||
|
||||
Reference in New Issue
Block a user