Make wielding automatically drop the item on your other hand (#27975)

* Make wielding automatically drop the item on your other hand

* Fix docs

* Remove redundant parameter

* Fix not deleting virtuals on fail

* Make count freeable hands method

* Add popup when dropping item
This commit is contained in:
DrSmugleaf
2024-05-18 18:35:46 -07:00
committed by GitHub
parent 676fc22eb4
commit 3d41d5f2bc
5 changed files with 79 additions and 9 deletions

View File

@@ -5,7 +5,6 @@ using Content.Shared.Administration.Logs;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction;
using Content.Shared.Inventory.VirtualItem;
using Content.Shared.Item;
using Content.Shared.Storage.EntitySystems;
using Robust.Shared.Containers;
using Robust.Shared.Input.Binding;
@@ -299,4 +298,16 @@ public abstract partial class SharedHandsSystem
return hands.Hands.TryGetValue(handId, out hand);
}
public int CountFreeableHands(Entity<HandsComponent> hands)
{
var freeable = 0;
foreach (var hand in hands.Comp.Hands.Values)
{
if (hand.IsEmpty || CanDropHeld(hands, hand))
freeable++;
}
return freeable;
}
}