Melee refactor (#10897)
Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.CombatMode;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Inventory.Events;
|
||||
@@ -9,8 +10,9 @@ namespace Content.Shared.Item;
|
||||
|
||||
public abstract class SharedItemSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly SharedCombatModeSystem _combatMode = default!;
|
||||
[Dependency] protected readonly SharedContainerSystem Container = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -69,7 +71,7 @@ public abstract class SharedItemSystem : EntitySystem
|
||||
|
||||
private void OnHandInteract(EntityUid uid, ItemComponent component, InteractHandEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
if (args.Handled || _combatMode.IsInCombatMode(args.User))
|
||||
return;
|
||||
|
||||
args.Handled = _handsSystem.TryPickup(args.User, uid, animateUser: false);
|
||||
@@ -121,8 +123,8 @@ public abstract class SharedItemSystem : EntitySystem
|
||||
|
||||
// if the item already in a container (that is not the same as the user's), then change the text.
|
||||
// this occurs when the item is in their inventory or in an open backpack
|
||||
_container.TryGetContainingContainer(args.User, out var userContainer);
|
||||
if (_container.TryGetContainingContainer(args.Target, out var container) && container != userContainer)
|
||||
Container.TryGetContainingContainer(args.User, out var userContainer);
|
||||
if (Container.TryGetContainingContainer(args.Target, out var container) && container != userContainer)
|
||||
verb.Text = Loc.GetString("pick-up-verb-get-data-text-inventory");
|
||||
else
|
||||
verb.Text = Loc.GetString("pick-up-verb-get-data-text");
|
||||
|
||||
Reference in New Issue
Block a user