Belt and back slot quick draw (#14828)

* backgunquickequip

* backgunquickequip

* fix build fail

* fix build fail 2

* cleanup

---------

Co-authored-by: BuildTools <unconfigured@null.spigotmc.org>
This commit is contained in:
Tyzemol
2023-03-27 04:01:09 +05:00
committed by GitHub
parent 4d71b1b81e
commit 6476474205

View File

@@ -254,6 +254,31 @@ namespace Content.Server.Hands.Systems
if (!_inventorySystem.TryGetSlotEntity(plyEnt, equipmentSlot, out var slotEntity) ||
!TryComp(slotEntity, out ServerStorageComponent? storageComponent))
{
if (_inventorySystem.HasSlot(plyEnt, equipmentSlot))
{
if (hands.ActiveHand.HeldEntity == null && slotEntity != null)
{
_inventorySystem.TryUnequip(plyEnt, equipmentSlot);
PickupOrDrop(plyEnt, slotEntity.Value);
return;
}
if (hands.ActiveHand.HeldEntity == null)
return;
if (!_inventorySystem.CanEquip(plyEnt, hands.ActiveHand.HeldEntity.Value, equipmentSlot, out var reason))
{
_popupSystem.PopupEntity(Loc.GetString(reason), plyEnt, session);
return;
}
if (slotEntity == null)
{
_inventorySystem.TryEquip(plyEnt, hands.ActiveHand.HeldEntity.Value, equipmentSlot);
return;
}
_inventorySystem.TryUnequip(plyEnt, equipmentSlot);
_inventorySystem.TryEquip(plyEnt, hands.ActiveHand.HeldEntity.Value, equipmentSlot);
PickupOrDrop(plyEnt, slotEntity.Value);
return;
}
_popupSystem.PopupEntity(Loc.GetString("hands-system-missing-equipment-slot", ("slotName", equipmentSlot)), plyEnt, session);
return;
}