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

◆ OnQuickBarSingleUse()

void ManBase::OnQuickBarSingleUse ( int slotClicked)
inlineprotected

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

4500 {
4501 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
4502 return;
4503
4504 if (m_AreHandsLocked)
4505 return; //Player is in the short window of time after interrupting placement of an item and before getting it back in hands
4506
4507 if (GetInventory().IsInventoryLocked() || IsEmotePlaying())
4508 return;
4509
4510 if (GetThrowing().IsThrowingModeEnabled() || GetThrowing().IsThrowingAnimationPlaying())
4511 return;
4512
4513 if (IsRaised() || GetCommand_Melee() || IsSwimming() || IsClimbingLadder() || IsClimbing() || IsRestrained() || IsRestrainPrelocked())
4514 return;
4515
4516 if (GetDayZPlayerInventory().IsProcessing() || IsItemsToDelete())
4517 return;
4518
4519 if (GetActionManager().GetRunningAction() != null)
4520 return;
4521
4523 return;
4524
4525 if (!ScriptInputUserData.CanStoreInputUserData())
4526 return;
4527
4528 //TODO MW change locking method
4529 //if (GetDayZPlayerInventory().HasLockedHands())
4530 // return;
4531
4532 EntityAI quickBarEntity = GetQuickBarEntity(slotClicked - 1);//GetEntityInQuickBar(slotClicked - 1);
4533
4534 if (!quickBarEntity)
4535 return;
4536
4537 Magazine mag;
4538 Weapon_Base wpn;
4539
4540 if (Class.CastTo(mag, quickBarEntity) && Class.CastTo(wpn, mag.GetHierarchyParent()))
4541 return;
4542
4543 EntityAI inHandEntity = GetHumanInventory().GetEntityInHands();
4544
4545 if (!GetDayZPlayerInventory().IsIdle())
4546 return; // player is already performing some animation
4547
4548 InventoryLocation handInventoryLocation = new InventoryLocation;
4549 handInventoryLocation.SetHands(this,quickBarEntity);
4550 if (this.GetInventory().HasInventoryReservation(quickBarEntity, handInventoryLocation))
4551 return;
4552
4553 if (inHandEntity == quickBarEntity)
4554 {
4555 if (GetHumanInventory().CanRemoveEntityInHands())
4556 {
4557 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Stash - PredictiveMoveItemFromHandsToInventory HND=" + Object.GetDebugName(inHandEntity));
4558 PredictiveMoveItemFromHandsToInventory();
4559 }
4560 }
4561 else
4562 {
4563 InventoryLocation invLocQBItem = new InventoryLocation;
4564 quickBarEntity.GetInventory().GetCurrentInventoryLocation(invLocQBItem);
4565 if (GetInventory().HasInventoryReservation(quickBarEntity,invLocQBItem))
4566 return;
4567
4568 if (inHandEntity)
4569 {
4570 InventoryLocation Reserved_Item_il = new InventoryLocation;
4571
4572 InventoryLocation inHandEntityFSwapDst = new InventoryLocation;
4573 inHandEntity.GetInventory().GetCurrentInventoryLocation(inHandEntityFSwapDst);
4574
4575 int index = GetHumanInventory().FindUserReservedLocationIndex(inHandEntity);
4576 if (index >= 0)
4577 GetHumanInventory().GetUserReservedLocation(index, Reserved_Item_il);
4578
4579 if (Reserved_Item_il)
4580 inHandEntityFSwapDst.CopyLocationFrom(Reserved_Item_il, true);
4581
4582 if (index < 0 && GameInventory.CanSwapEntitiesEx(quickBarEntity, inHandEntity))
4583 {
4584 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] PredictiveSwapEntities QB=" + Object.GetDebugName(quickBarEntity) + " HND=" + Object.GetDebugName(inHandEntity));
4585 PredictiveSwapEntities(quickBarEntity, inHandEntity);
4586 }
4587 else if (GameInventory.CanForceSwapEntitiesEx(quickBarEntity, handInventoryLocation, inHandEntity, inHandEntityFSwapDst))
4588 {
4589 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Swap - PredictiveForceSwapEntities HND=" + Object.GetDebugName(inHandEntity) + " QB=" + Object.GetDebugName(quickBarEntity) + " fswap_dst=" + InventoryLocation.DumpToStringNullSafe(inHandEntityFSwapDst));
4590 PredictiveForceSwapEntities(quickBarEntity, inHandEntity, inHandEntityFSwapDst);
4591 }
4592 }
4593 else
4594 {
4595 if (GetInventory().HasInventoryReservation(quickBarEntity,handInventoryLocation))
4596 return;
4597
4598 if (GetInventory().CanAddEntityIntoHands(quickBarEntity))
4599 {
4600 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Stash - PredictiveTakeEntityToHands QB=" + Object.GetDebugName(quickBarEntity));
4601 PredictiveTakeEntityToHands(quickBarEntity);
4602 }
4603 }
4604 }
4605 }
void syncDebugPrint(string s)
Определения Debug.c:1
class LogManager EntityAI
bool IsProcessing()
Определения DayZPlayerInventory.c:2461
override bool IsIdle()
Определения WeaponStableState.c:91
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands
proto native InventoryLocation CopyLocationFrom(notnull InventoryLocation rhs, bool copyFlip)
copies location to another location without m_item member
override void PredictiveTakeEntityToHands(EntityAI item)
Определения PlayerBase.c:8503
bool IsClimbing()
Определения PlayerBase.c:5226
bool IsEmotePlaying()
Определения PlayerBase.c:5240
override bool PredictiveSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
Определения PlayerBase.c:8425
override bool IsRestrained()
Определения PlayerBase.c:1910
bool m_AreHandsLocked
Определения PlayerBase.c:117
override WeaponManager GetWeaponManager()
Определения PlayerBase.c:1859
ActionManagerBase GetActionManager()
Определения PlayerBase.c:1699
bool IsRestrainPrelocked()
Определения PlayerBase.c:1899
EntityAI GetQuickBarEntity(int index)
Определения PlayerBase.c:2097
bool IsItemsToDelete()
Определения PlayerBase.c:7924
override bool PredictiveForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
Определения PlayerBase.c:8483
DayZPlayerInstanceType
defined in C++
Определения dayzplayer.c:1068
proto native DayZPlayerInstanceType GetInstanceType()
class LOD Object
bool IsRunning()
Определения tools.c:264
proto native int GetRunningAction()
returns -1 when no action is running or RELOAD,MECHANISM, ....
Определения ActionManagerBase.c:91

Перекрестные ссылки GameInventory::CanForceSwapEntitiesEx(), ScriptInputUserData::CanStoreInputUserData(), GameInventory::CanSwapEntitiesEx(), Class::CastTo(), InventoryLocation::CopyLocationFrom(), InventoryLocation::DumpToStringNullSafe(), GetActionManager(), GetInstanceType(), GetQuickBarEntity(), GetRunningAction(), GetWeaponManager(), IsClimbing(), IsEmotePlaying(), IsIdle(), IsItemsToDelete(), IsProcessing(), IsRestrained(), IsRestrainPrelocked(), IsRunning(), LogManager::IsSyncLogEnable(), m_AreHandsLocked, PredictiveForceSwapEntities(), PredictiveSwapEntities(), PredictiveTakeEntityToHands(), InventoryLocation::SetHands() и syncDebugPrint().

Используется в CommandHandler() и RadialQuickBarSingleUse().