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

◆ SwappingToPreviousLocation()

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

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

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();
553 if (count > 0 && src2.GetType() == InventoryLocationType.ATTACHMENT) //item2 is currently attached somewhere
554 {
555 for (int i = 0; i < count; i++)
556 {
557 int slotID = item1.GetInventory().GetSlotId(i);
558 if (src2.GetSlot() == slotID) //can be attached into the same slot. And will be.
559 return false;
560 }
561 }
562
563 if (!item1.m_OldLocation.GetParent().GetInventory().LocationCanAddEntity(item1.m_OldLocation))
564 SwapToPrevious = false;
565
566 if (CanSwapEntitiesEx(item1,item2))
567 SwapToPrevious = false;
568
569 if (SwapToPrevious)
570 return true;
571 }
572 }
573
574 return false;
575 }
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Определения Inventory.c:628
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetType()
returns type of InventoryLocation

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

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