Make melee damage not go through MeleeHitEvent.cs (#16881)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Nemanja
2023-05-28 03:03:25 -04:00
committed by GitHub
parent 0053ddb8f8
commit dd044f4a91
9 changed files with 73 additions and 48 deletions

View File

@@ -40,7 +40,7 @@ public sealed class WieldableSystem : EntitySystem
SubscribeLocalEvent<MeleeRequiresWieldComponent, AttemptMeleeEvent>(OnMeleeAttempt);
SubscribeLocalEvent<GunRequiresWieldComponent, AttemptShootEvent>(OnShootAttempt);
SubscribeLocalEvent<IncreaseDamageOnWieldComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<IncreaseDamageOnWieldComponent, GetMeleeDamageEvent>(OnGetMeleeDamage);
}
private void OnMeleeAttempt(EntityUid uid, MeleeRequiresWieldComponent component, ref AttemptMeleeEvent args)
@@ -243,16 +243,13 @@ public sealed class WieldableSystem : EntitySystem
AttemptUnwield(args.BlockingEntity, component, args.User);
}
private void OnMeleeHit(EntityUid uid, IncreaseDamageOnWieldComponent component, MeleeHitEvent args)
private void OnGetMeleeDamage(EntityUid uid, IncreaseDamageOnWieldComponent component, ref GetMeleeDamageEvent args)
{
if (EntityManager.TryGetComponent<WieldableComponent>(uid, out var wield))
{
if (!wield.Wielded)
return;
}
if (args.Handled)
if (!TryComp<WieldableComponent>(uid, out var wield))
return;
if (!wield.Wielded)
return;
args.BonusDamage += component.BonusDamage;
args.Damage += component.BonusDamage;
}
}