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

◆ InventoryReservation()

bool WeaponManager::InventoryReservation ( Magazine mag,
InventoryLocation invLoc )
inlineprotected

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

339 {
340 Weapon_Base weapon;
341 InventoryLocation ilWeapon = new InventoryLocation();
342 GameInventory playerInventory = m_player.GetInventory();
343 if (Weapon_Base.CastTo(weapon, m_player.GetItemInHands()) )
344 {
345 weapon.GetInventory().GetCurrentInventoryLocation(ilWeapon);
346 if ( playerInventory.HasInventoryReservation(weapon, ilWeapon) )
347 {
348 return false;
349 }
350 else
351 {
352 playerInventory.AddInventoryReservationEx(weapon,ilWeapon,GameInventory.c_InventoryReservationTimeoutMS);
353 }
354 }
355
356 if( invLoc )
357 {
358 if ( playerInventory.HasInventoryReservation(invLoc.GetItem(),invLoc) )
359 {
360 playerInventory.ClearInventoryReservationEx(weapon, ilWeapon);
361 return false;
362 }
363 else
364 {
365 playerInventory.AddInventoryReservationEx(invLoc.GetItem(),invLoc,GameInventory.c_InventoryReservationTimeoutMS);
366 }
367 }
368
369 if( mag )
370 {
371 m_TargetInventoryLocation = new InventoryLocation();
372 m_TargetInventoryLocation.SetAttachment( m_WeaponInHand, mag, InventorySlots.MAGAZINE);
373
374 if ( playerInventory.HasInventoryReservation(mag, m_TargetInventoryLocation) )
375 //if ( !m_player.GetInventory().AddInventoryReservationEx( mag, m_TargetInventoryLocation, GameInventory.c_InventoryReservationTimeoutMS) )
376 {
377 playerInventory.ClearInventoryReservationEx(weapon, ilWeapon);
378 if (invLoc)
379 {
380 playerInventory.ClearInventoryReservationEx(invLoc.GetItem(), invLoc);
381 }
382 return false;
383 }
384 else
385 {
386 playerInventory.AddInventoryReservationEx(mag, m_TargetInventoryLocation, GameInventory.c_InventoryReservationTimeoutMS);
387 }
388 }
391
392 return true;
393 }
bool ClearInventoryReservationEx(EntityAI item, InventoryLocation dst)
static proto native bool HasInventoryReservation(EntityAI item, InventoryLocation dst)
Internally: HasInventoryReservationEx(item, dst, FindInventoryReservationMode.LEGACY,...
bool AddInventoryReservationEx(EntityAI item, InventoryLocation dst, int timeout_ms)
proto native EntityAI GetItem()
returns item of current inventory location
PlayerBase m_player
Определения WeaponManager.c:5
Magazine m_PendingTargetMagazine
Определения WeaponManager.c:10
Weapon_Base m_WeaponInHand
Определения WeaponManager.c:23
ref InventoryLocation m_PendingInventoryLocation
Определения WeaponManager.c:13
ref InventoryLocation m_TargetInventoryLocation
Определения WeaponManager.c:11

Перекрестные ссылки GameInventory::AddInventoryReservationEx(), GameInventory::c_InventoryReservationTimeoutMS, GameInventory::ClearInventoryReservationEx(), InventoryLocation::GetItem(), GameInventory::HasInventoryReservation(), m_PendingInventoryLocation, m_PendingTargetMagazine, m_player, m_TargetInventoryLocation и m_WeaponInHand.

Используется в StartAction().