Gas tanks and masks (#2409)

Co-authored-by: a.rudenko <creadth@gmail.com>
Co-authored-by: creadth <creadth@users.noreply.github.com>
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
Víctor Aguilera Puerto
2020-10-27 20:53:44 +01:00
committed by GitHub
parent 329926b175
commit 870d052354
77 changed files with 1653 additions and 58 deletions

View File

@@ -156,6 +156,13 @@ namespace Content.Server.GameObjects.Components.GUI
{
return GetSlotItem<ItemComponent>(slot);
}
public IEnumerable<T> LookupItems<T>() where T: Component
{
return _slotContainers.Values.SelectMany(x => x.ContainedEntities.Select(e => e.GetComponentOrNull<T>()))
.Where(x => x != null);
}
public T GetSlotItem<T>(Slots slot) where T : ItemComponent
{
if (!_slotContainers.ContainsKey(slot))
@@ -435,7 +442,7 @@ namespace Content.Server.GameObjects.Components.GUI
var activeHand = hands.GetActiveHand;
if (activeHand != null && activeHand.Owner.TryGetComponent(out ItemComponent clothing))
{
hands.Drop(hands.ActiveHand);
hands.Drop(hands.ActiveHand, doDropInteraction:false);
if (!Equip(msg.Inventoryslot, clothing, true, out var reason))
{
hands.PutInHand(clothing);