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

◆ GetCombinationFlags()

static int ItemManager::GetCombinationFlags ( EntityAI entity1,
EntityAI entity2 )
inlinestaticprotected

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

801 {
802 int flags = 0;
803 PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
804
805 if (!entity1 || !entity2)
806 return flags;
807
808 if (entity1.IsInherited( ItemBase ) && entity2.IsInherited( ItemBase ))
809 {
810 ItemBase ent1 = ItemBase.Cast( entity1 );
811 if (ent1.CanBeCombined( ItemBase.Cast( entity2 ) ))
812 flags = flags | InventoryCombinationFlags.COMBINE_QUANTITY2;
813 }
814
815 InventoryLocation il = new InventoryLocation();
816
817 entity1.GetInventory().FindFreeLocationFor( entity2, FindInventoryLocationType.ATTACHMENT, il );
818
819 if (il.IsValid() && !entity1.GetInventory().FindAttachment(il.GetSlot()))
820 {
821 if (!entity1.IsInherited( ZombieBase ) && !entity1.IsInherited( Car ) && !entity2.IsInherited( ZombieBase ) && !entity2.IsInherited( Car ))
822 {
823 flags = flags | InventoryCombinationFlags.ADD_AS_ATTACHMENT;
824 }
825 }
826 if (!entity1.GetInventory().HasEntityInInventory(entity2) && entity1.GetInventory().CanAddEntityInCargo( entity2, entity2.GetInventory().GetFlipCargo() )) flags = flags | InventoryCombinationFlags.ADD_AS_CARGO;
827
828 if (entity1 == player.GetHumanInventory().GetEntityInHands() || entity2 == player.GetHumanInventory().GetEntityInHands())
829 {
830 ActionManagerClient amc;
831 Class.CastTo(amc, player.GetActionManager());
832 if (entity1 == player.GetHumanInventory().GetEntityInHands())
833 {
834 if (amc.CanPerformActionFromInventory( ItemBase.Cast(entity1), ItemBase.Cast(entity2) ))
835 {
836 flags = flags | InventoryCombinationFlags.PERFORM_ACTION;
837 }
838 else if (amc.CanSetActionFromInventory( ItemBase.Cast(entity1), ItemBase.Cast(entity2) ))
839 {
840 flags = flags | InventoryCombinationFlags.SET_ACTION;
841 }
842 }
843 else
844 {
845 if (amc.CanPerformActionFromInventory( ItemBase.Cast(entity2), ItemBase.Cast(entity1) ))
846 {
847 flags = flags | InventoryCombinationFlags.PERFORM_ACTION;
848 }
849 else if (amc.CanSetActionFromInventory( ItemBase.Cast(entity2), ItemBase.Cast(entity1) ))
850 {
851 flags = flags | InventoryCombinationFlags.SET_ACTION;
852 }
853 }
854 }
855 return flags;
856 }
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
PlayerBase GetPlayer()
Определения ModifierBase.c:51
bool CanPerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:1040
bool CanSetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:1138
proto native bool IsValid()
verify current set inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
proto native CGame GetGame()

Перекрестные ссылки InventoryCombinationFlags::ADD_AS_ATTACHMENT, InventoryCombinationFlags::ADD_AS_CARGO, ItemBase::CanBeCombined(), ActionManagerClient::CanPerformActionFromInventory(), ActionManagerClient::CanSetActionFromInventory(), Class::CastTo(), InventoryCombinationFlags::COMBINE_QUANTITY2, GetGame(), GetPlayer(), InventoryLocation::GetSlot(), InventoryLocation::IsValid(), InventoryCombinationFlags::PERFORM_ACTION и InventoryCombinationFlags::SET_ACTION.

Используется в Attachments::CanCombine(), LayoutHolder::CanCombineEx() и Icon::CombineItems().