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

◆ GetCombinationFlags()

int HandsContainer::GetCombinationFlags ( EntityAI entity1,
EntityAI entity2 )
inlineprotected

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

791 {
792 int flags = 0;
793 PlayerBase m_player = PlayerBase.Cast( GetGame().GetPlayer() );
794 EntityAI entity_in_hands = m_player.GetHumanInventory().GetEntityInHands();
795
796 if (!entity1 || !entity2) return flags;
797
798 Magazine swapmag1;
799 Magazine swapmag2;
800 bool skipSwap = false;
801
802 if (Class.CastTo(swapmag1, entity1) && Class.CastTo(swapmag2, entity2))
803 {
804 Weapon_Base parentWpn;
805
806 if (Class.CastTo(parentWpn, swapmag1.GetHierarchyParent()))
807 {
808 skipSwap = true;
809 if (m_player.GetWeaponManager().CanSwapMagazine(parentWpn,swapmag2))
810 flags = flags | InventoryCombinationFlags.SWAP;
811 }
812
813 if (Class.CastTo(parentWpn, swapmag2.GetHierarchyParent()))
814 {
815 skipSwap = true;
816 if (m_player.GetWeaponManager().CanSwapMagazine(parentWpn,swapmag1))
817 flags = flags | InventoryCombinationFlags.SWAP;
818
819 }
820 }
821
822 if ( !skipSwap )
823 {
824 if (entity1 == m_player.GetHumanInventory().GetEntityInHands() ) flags = flags | InventoryCombinationFlags.TAKE_TO_HANDS;
825 else if (GameInventory.CanSwapEntitiesEx( entity1, entity2 ))
826 {
827 if (!entity1.IsInherited( ZombieBase ) && !entity1.IsInherited( Car ))
828 {
829 flags = flags | InventoryCombinationFlags.SWAP;
830 }
831 }
832 }
833
834 if (entity1.IsInherited( ItemBase) && entity2.IsInherited( ItemBase ))
835 {
836 ItemBase ent1 = ItemBase.Cast( entity1 );
837 if (ent1.CanBeCombined( ItemBase.Cast( entity2 ) )) flags = flags | InventoryCombinationFlags.COMBINE_QUANTITY2;
838 }
839
840 else if (entity1.GetInventory().CanAddAttachment( entity2 ))
841 {
842 if (!entity1.IsInherited( ZombieBase ) && !entity1.IsInherited( Car ) && !entity2.IsInherited( ZombieBase ) && !entity2.IsInherited( Car ))
843 {
844 flags = flags | InventoryCombinationFlags.ADD_AS_ATTACHMENT;
845 }
846 }
847 if (!entity1.GetInventory().HasEntityInInventory(entity2) && entity1.GetInventory().CanAddEntityInCargo( entity2, entity2.GetInventory().GetFlipCargo() )) flags = flags | InventoryCombinationFlags.ADD_AS_CARGO;
848
849 if (entity1 == m_player.GetHumanInventory().GetEntityInHands() || entity2 == m_player.GetHumanInventory().GetEntityInHands())
850 {
851 ActionManagerClient amc;
852 Class.CastTo(amc, m_player.GetActionManager());
853 if (entity1 == m_player.GetHumanInventory().GetEntityInHands())
854 {
855 if (amc.CanSetActionFromInventory( ItemBase.Cast( entity1 ), ItemBase.Cast( entity2 ) ))
856 {
857 flags = flags | InventoryCombinationFlags.SET_ACTION;
858 }
859 }
860 else
861 {
862 if (amc.CanSetActionFromInventory( ItemBase.Cast( entity2 ), ItemBase.Cast( entity1 ) ))
863 {
864 flags = flags | InventoryCombinationFlags.SET_ACTION;
865 }
866 }
867 }
868
869 if (GetRecipeCount( true, entity1, entity2 ) > 0)
870 {
871 flags = flags | InventoryCombinationFlags.RECIPE_ANYWHERE;
872 }
873 return flags;
874 }
class LogManager EntityAI
class GP5GasMask extends MaskBase ItemBase
PlayerBase GetPlayer()
Определения ModifierBase.c:51
DayZPlayer m_player
Определения RandomGeneratorSyncManager.c:16
bool CanSetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:1138
WeaponManager GetWeaponManager()
Определения DayZPlayerImplement.c:970
int GetRecipeCount(bool recipe_anywhere, EntityAI entity1, EntityAI entity2)
Определения HandsContainer.c:876
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
bool CanSwapMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
Определения WeaponManager.c:132
proto native CGame GetGame()

Перекрестные ссылки InventoryCombinationFlags::ADD_AS_ATTACHMENT, InventoryCombinationFlags::ADD_AS_CARGO, ItemBase::CanBeCombined(), ActionManagerClient::CanSetActionFromInventory(), GameInventory::CanSwapEntitiesEx(), Class::CastTo(), InventoryCombinationFlags::COMBINE_QUANTITY2, GetGame(), GetPlayer(), GetRecipeCount(), m_player, InventoryCombinationFlags::RECIPE_ANYWHERE, InventoryCombinationFlags::SET_ACTION, InventoryCombinationFlags::SWAP и InventoryCombinationFlags::TAKE_TO_HANDS.