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

◆ CanAttachMagazine()

bool WeaponManager::CanAttachMagazine ( Weapon_Base wpn,
Magazine mag,
bool reservationCheck = true )
inlineprotected

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

92 {
93 if ( !wpn || !mag )
94 return false;
95
96 if ( m_player.GetHumanInventory().GetEntityInHands() != wpn )
97 return false;
98
99 if ( wpn.IsDamageDestroyed())
100 return false;
101
102 //if ( mag.GetHierarchyRootPlayer() && mag.GetHierarchyRootPlayer() != m_player )
103 //return false;
104
105 if( m_player.IsItemsToDelete())
106 return false;
107
108 if ( reservationCheck && (m_player.GetInventory().HasInventoryReservation(wpn, null) || m_player.GetInventory().HasInventoryReservation(mag, null)))
109 return false;
110
111 InventoryLocation invLoc;
112 invLoc = new InventoryLocation();
113
114 mag.GetInventory().GetCurrentInventoryLocation(invLoc);
115 Weapon_Base wnp2;
116
117
118 //magazine is already in weapon
119 if ( Class.CastTo(wnp2, invLoc.GetParent()) )
120 return false;
121
122 int muzzleIndex = wpn.GetCurrentMuzzle();
123
124 if (wpn.CanAttachMagazine(muzzleIndex, mag))
125 return true;
126
127 return false;
128
129 }
proto native EntityAI GetParent()
returns parent of current inventory location
PlayerBase m_player
Определения WeaponManager.c:5

Перекрестные ссылки Class::CastTo(), InventoryLocation::GetParent() и m_player.

Используется в ManBase::GetMagazineToReload().