Melee refactor (#10897)
Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Content.Server.Chemistry.Components.SolutionManager;
|
||||
using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Server.Interaction.Components;
|
||||
using Content.Server.Weapon.Melee;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
@@ -12,6 +11,7 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.Interaction;
|
||||
using Content.Server.Weapons.Melee;
|
||||
|
||||
namespace Content.Server.Chemistry.Components
|
||||
{
|
||||
@@ -78,7 +78,8 @@ namespace Content.Server.Chemistry.Components
|
||||
target.Value.PopupMessage(Loc.GetString("hypospray-component-feel-prick-message"));
|
||||
var meleeSys = EntitySystem.Get<MeleeWeaponSystem>();
|
||||
var angle = Angle.FromWorldVec(_entMan.GetComponent<TransformComponent>(target.Value).WorldPosition - _entMan.GetComponent<TransformComponent>(user).WorldPosition);
|
||||
meleeSys.SendLunge(angle, user);
|
||||
// TODO: This should just be using melee attacks...
|
||||
// meleeSys.SendLunge(angle, user);
|
||||
}
|
||||
|
||||
SoundSystem.Play(_injectSound.GetSound(), Filter.Pvs(user), user);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Weapons.Melee.Events;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Weapons.Melee;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
|
||||
namespace Content.Server.Chemistry.EntitySystems
|
||||
{
|
||||
@@ -10,7 +13,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
private void InitializeHypospray()
|
||||
{
|
||||
SubscribeLocalEvent<HyposprayComponent, AfterInteractEvent>(OnAfterInteract);
|
||||
SubscribeLocalEvent<HyposprayComponent, ClickAttackEvent>(OnClickAttack);
|
||||
SubscribeLocalEvent<HyposprayComponent, MeleeHitEvent>(OnAttack);
|
||||
SubscribeLocalEvent<HyposprayComponent, SolutionChangedEvent>(OnSolutionChange);
|
||||
SubscribeLocalEvent<HyposprayComponent, UseInHandEvent>(OnUseInHand);
|
||||
}
|
||||
@@ -39,12 +42,12 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
comp.TryDoInject(target, user);
|
||||
}
|
||||
|
||||
public void OnClickAttack(EntityUid uid, HyposprayComponent comp, ClickAttackEvent args)
|
||||
public void OnAttack(EntityUid uid, HyposprayComponent comp, MeleeHitEvent args)
|
||||
{
|
||||
if (args.Target == null)
|
||||
if (!args.HitEntities.Any())
|
||||
return;
|
||||
|
||||
comp.TryDoInject(args.Target.Value, args.User);
|
||||
comp.TryDoInject(args.HitEntities.First(), args.User);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user