DayZ 1.27
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 if (Weapon_Base.CastTo(weapon, m_player.GetItemInHands()) )
343 {
344 weapon.GetInventory().GetCurrentInventoryLocation(ilWeapon);
345 if ( m_player.GetInventory().HasInventoryReservation(weapon, ilWeapon) )
346 {
347 return false;
348 }
349 else
350 {
351 m_player.GetInventory().AddInventoryReservationEx(weapon,ilWeapon,GameInventory.c_InventoryReservationTimeoutMS);
352 }
353 }
354
355 if( invLoc )
356 {
357 if ( m_player.GetInventory().HasInventoryReservation(invLoc.GetItem(),invLoc) )
358 {
359 m_player.GetInventory().ClearInventoryReservationEx(weapon, ilWeapon);
360 return false;
361 }
362 else
363 {
364 m_player.GetInventory().AddInventoryReservationEx(invLoc.GetItem(),invLoc,GameInventory.c_InventoryReservationTimeoutMS);
365 }
366 }
367
368 if( mag )
369 {
370 m_TargetInventoryLocation = new InventoryLocation();
371 m_TargetInventoryLocation.SetAttachment( m_WeaponInHand, mag, InventorySlots.MAGAZINE);
372
373 if ( m_player.GetInventory().HasInventoryReservation(mag, m_TargetInventoryLocation) )
374 //if ( !m_player.GetInventory().AddInventoryReservationEx( mag, m_TargetInventoryLocation, GameInventory.c_InventoryReservationTimeoutMS) )
375 {
376 m_player.GetInventory().ClearInventoryReservationEx(weapon, ilWeapon);
377 if (invLoc)
378 {
379 m_player.GetInventory().ClearInventoryReservationEx(invLoc.GetItem(), invLoc);
380 }
381 return false;
382 }
383 else
384 {
385 m_player.GetInventory().AddInventoryReservationEx(mag, m_TargetInventoryLocation, GameInventory.c_InventoryReservationTimeoutMS);
386 }
387 }
390
391 return true;
392 }
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::c_InventoryReservationTimeoutMS, InventoryLocation::GetItem(), m_PendingInventoryLocation, m_PendingTargetMagazine, m_player, m_TargetInventoryLocation и m_WeaponInHand.

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