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

◆ CanSwapMagazine()

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

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

133 {
134 if ( !wpn || !mag )
135 return false;
136
137 if ( m_player.GetHumanInventory().GetEntityInHands() != wpn )
138 return false;
139
140 if ( mag.IsDamageDestroyed() || wpn.IsDamageDestroyed())
141 return false;
142
143 //if ( mag.GetHierarchyRootPlayer() && mag.GetHierarchyRootPlayer() != m_player )
144 //return false;
145
146 if( m_player.IsItemsToDelete())
147 return false;
148
149 if ( reservationCheck && (m_player.GetInventory().HasInventoryReservation(wpn, null) || m_player.GetInventory().HasInventoryReservation(mag, null)))
150 return false;
151
152
153 InventoryLocation invLoc;
154 invLoc = new InventoryLocation();
155
156 mag.GetInventory().GetCurrentInventoryLocation(invLoc);
157 Weapon_Base wnp2;
158
159 //second magazine is already in weapon
160 if( Class.CastTo(wnp2, invLoc.GetParent()) )
161 return false;
162
163 int muzzleIndex = wpn.GetCurrentMuzzle();
164
165 Magazine mag2;
166 if( !Class.CastTo(mag2, wpn.GetMagazine(muzzleIndex)) )
167 return false;
168
169 if( GameInventory.CanSwapEntitiesEx( mag, mag2 ) )
170 return true;
171
172 InventoryLocation il = new InventoryLocation();
173
174 if( GameInventory.CanForceSwapEntitiesEx( mag, null, mag2, il ) )
175 return true;
176
177 return false;
178 }
proto native EntityAI GetParent()
returns parent of current inventory location
PlayerBase m_player
Определения WeaponManager.c:5

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

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