541 {
542 bool SwapToPrevious = true;
543 InventoryLocation src1 = new InventoryLocation();
544 InventoryLocation src2 = new InventoryLocation();
545 dst = new InventoryLocation();
546 if (item1.GetInventory().GetCurrentInventoryLocation(src1) && item2.GetInventory().GetCurrentInventoryLocation(src2))
547 {
548 if (item1.m_OldLocation && item1.m_OldLocation.IsValid() && !item1.m_OldLocation.CollidesWith(src2) && item1.m_OldLocation.GetParent() && item1.m_OldLocation.GetParent().GetHierarchyRootPlayer())
549 {
550 dst.Copy(item1.m_OldLocation);
551
552 int count = item1.GetInventory().GetSlotIdCount();
554 {
555 for (int i = 0; i < count; i++)
556 {
557 int slotID = item1.GetInventory().GetSlotId(i);
559 return false;
560 }
561 }
562
563 if (!item1.m_OldLocation.GetParent().GetInventory().LocationCanAddEntity(item1.m_OldLocation))
564 SwapToPrevious = false;
565
567 SwapToPrevious = false;
568
569 if (SwapToPrevious)
570 return true;
571 }
572 }
573
574 return false;
575 }
InventoryLocationType
types of Inventory Location
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetType()
returns type of InventoryLocation