DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ SwappingToPreviousLocation()

bool HumanInventory::SwappingToPreviousLocation ( EntityAI item1,
EntityAI item2,
out InventoryLocation dst )
inlineprotected

См. определение в файле HumanInventory.c строка 553

554 {
555 bool SwapToPrevious = true;
556 InventoryLocation src1 = new InventoryLocation();
557 InventoryLocation src2 = new InventoryLocation();
558 dst = new InventoryLocation();
559 GameInventory item1Inventory = item1.GetInventory();
560 if (item1Inventory.GetCurrentInventoryLocation(src1) && item2.GetInventory().GetCurrentInventoryLocation(src2))
561 {
562 if (item1.m_OldLocation && item1.m_OldLocation.IsValid() && !item1.m_OldLocation.CollidesWith(src2) && item1.m_OldLocation.GetParent() && item1.m_OldLocation.GetParent().GetHierarchyRootPlayer())
563 {
564 dst.Copy(item1.m_OldLocation);
565
566 if (src2.GetType() == InventoryLocationType.ATTACHMENT) //item2 is currently attached somewhere
567 {
568 int count = item1Inventory.GetSlotIdCount();
569 for (int i = 0; i < count; ++i)
570 {
571 int slotID = item1Inventory.GetSlotId(i);
572 if (src2.GetSlot() == slotID) //can be attached into the same slot. And will be.
573 return false;
574 }
575 }
576
577 if (!item1.m_OldLocation.GetParent().GetInventory().LocationCanAddEntity(item1.m_OldLocation))
578 SwapToPrevious = false;
579
580 if (CanSwapEntitiesEx(item1,item2))
581 SwapToPrevious = false;
582
583 if (SwapToPrevious)
584 return true;
585 }
586 }
587
588 return false;
589 }
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
proto native int GetSlotId(int index)
attachments
proto native int GetSlotIdCount()
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetType()
returns type of InventoryLocation

Перекрестные ссылки GameInventory::CanSwapEntitiesEx(), GameInventory::GetCurrentInventoryLocation(), InventoryLocation::GetSlot(), GameInventory::GetSlotId(), GameInventory::GetSlotIdCount() и InventoryLocation::GetType().

Используется в ForceSwapEntities() и SwapEntities().