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:
@@ -254,6 +254,31 @@ namespace Content.Server.Hands.Systems
|
|||||||
if (!_inventorySystem.TryGetSlotEntity(plyEnt, equipmentSlot, out var slotEntity) ||
|
if (!_inventorySystem.TryGetSlotEntity(plyEnt, equipmentSlot, out var slotEntity) ||
|
||||||
!TryComp(slotEntity, out ServerStorageComponent? storageComponent))
|
!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);
|
_popupSystem.PopupEntity(Loc.GetString("hands-system-missing-equipment-slot", ("slotName", equipmentSlot)), plyEnt, session);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user