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

◆ GetCombinationFlags()

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

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

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