Melee refactor (#10897)
Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -1,13 +1,6 @@
|
||||
using Content.Server.Weapon.Melee;
|
||||
using Content.Server.Stunnable;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Server.Weapon.Melee.Components;
|
||||
using Content.Server.Clothing.Components;
|
||||
using Content.Server.Damage.Components;
|
||||
using Content.Server.Damage.Events;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using Content.Server.Weapons.Melee.Events;
|
||||
using Content.Shared.Weapons.Melee;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Server.Abilities.Boxer
|
||||
@@ -24,25 +17,22 @@ namespace Content.Server.Abilities.Boxer
|
||||
SubscribeLocalEvent<BoxingGlovesComponent, StaminaMeleeHitEvent>(OnStamHit);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, BoxerComponent boxer, ComponentInit args)
|
||||
private void OnInit(EntityUid uid, BoxerComponent component, ComponentInit args)
|
||||
{
|
||||
if (TryComp<MeleeWeaponComponent>(uid, out var meleeComp))
|
||||
meleeComp.Range *= boxer.RangeBonus;
|
||||
meleeComp.Range *= component.RangeBonus;
|
||||
}
|
||||
private void GetDamageModifiers(EntityUid uid, BoxerComponent component, ItemMeleeDamageEvent args)
|
||||
{
|
||||
if (component.UnarmedModifiers == default!)
|
||||
{
|
||||
Logger.Warning("BoxerComponent on " + uid + " couldn't get damage modifiers. Know that adding components with damage modifiers through VV or similar is unsupported.");
|
||||
return;
|
||||
}
|
||||
|
||||
args.ModifiersList.Add(component.UnarmedModifiers);
|
||||
}
|
||||
|
||||
private void OnStamHit(EntityUid uid, BoxingGlovesComponent component, StaminaMeleeHitEvent args)
|
||||
{
|
||||
_containerSystem.TryGetContainingContainer(uid, out var equipee);
|
||||
if (TryComp<BoxerComponent>(equipee?.Owner, out var boxer))
|
||||
if (!_containerSystem.TryGetContainingContainer(uid, out var equipee))
|
||||
return;
|
||||
|
||||
if (TryComp<BoxerComponent>(equipee.Owner, out var boxer))
|
||||
args.Multiplier *= boxer.BoxingGlovesModifier;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user