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

◆ CanForceSwapEntitiesEx()

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

См. определение в файле 3_Game/DayZ/Systems/Inventory/Inventory.c строка 666

667 {
668 if (!CanForceSwapEntities(item1, item1_dst, item2, item2_dst) )
669 return false;
670
671 int slot;
672 InventoryLocation il = new InventoryLocation;
673
674 if (!item1.CanBeFSwaped())
675 return false;
676
677 if ( item1_dst == null)
678 {
679 item2.GetInventory().GetCurrentInventoryLocation(il);
680 slot = il.GetSlot();
681 }
682 else
683 {
684 slot = item1_dst.GetSlot();
685 }
686
687 if ( item1.GetQuantity() > item1.GetTargetQuantityMax(slot) )
688 return false;
689
690 if ( item2_dst == null)
691 {
692 item1.GetInventory().GetCurrentInventoryLocation(il);
693 slot = il.GetSlot();
694 }
695 else
696 {
697 slot = item2_dst.GetSlot();
698 }
699
700 if (!item1.CanSwapEntities(item2, item2_dst, item1_dst) || !item2.CanSwapEntities(item1, item1_dst, item2_dst))
701 {
702 return false;
703 }
704
705 if ( item2.GetQuantity() > item2.GetTargetQuantityMax(slot) )
706 return false;
707
708 return true;
709 }
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(), ManBase::OnQuickBarSingleUse(), WeaponManager::PrepareInventoryLocationForMagazineSwap(), Icon::Swap() и ValidateSwap().