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

◆ CanForceSwapEntitiesEx()

static bool GameInventory::CanForceSwapEntitiesEx ( notnull EntityAI item1,
InventoryLocation item1_dst,
notnull EntityAI item2,
out InventoryLocation item2_dst )
inlinestaticprotected

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

665 {
666 if (!CanForceSwapEntities(item1, item1_dst, item2, item2_dst) )
667 return false;
668
669 int slot;
670 InventoryLocation il = new InventoryLocation;
671
672 if (!item1.CanBeFSwaped())
673 return false;
674
675 if ( item1_dst == null)
676 {
677 item2.GetInventory().GetCurrentInventoryLocation(il);
678 slot = il.GetSlot();
679 }
680 else
681 {
682 slot = item1_dst.GetSlot();
683 }
684
685 if ( item1.GetQuantity() > item1.GetTargetQuantityMax(slot) )
686 return false;
687
688 if ( item2_dst == null)
689 {
690 item1.GetInventory().GetCurrentInventoryLocation(il);
691 slot = il.GetSlot();
692 }
693 else
694 {
695 slot = item2_dst.GetSlot();
696 }
697
698 if (!item1.CanSwapEntities(item2, item2_dst, item1_dst) || !item2.CanSwapEntities(item1, item1_dst, item2_dst))
699 {
700 return false;
701 }
702
703 if ( item2.GetQuantity() > item2.GetTargetQuantityMax(slot) )
704 return false;
705
706 return true;
707 }
static proto native bool CanForceSwapEntities(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
test if forced swap can be performed.
proto native int GetSlot()
returns slot id if current type is Attachment

Перекрестные ссылки CanForceSwapEntities() и InventoryLocation::GetSlot().

Используется в HandEventBase::CanPerformEvent(), HandEventSwap::CanPerformEvent(), WeaponManager::CanSwapMagazine(), LayoutHolder::CanSwapOrTakeToHandsEx(), Icon::DraggingOverSwap(), ItemManager::GetChosenCombinationFlag(), HandGuardBase::GuardCondition(), HandStartAction::OnEntry(), ManBase::OnQuickBarSingleUse(), WeaponManager::PrepareInventoryLocationForMagazineSwap(), Icon::Swap() и ValidateSwap().