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

◆ OnQuickBarSingleUse()

void ManBase::OnQuickBarSingleUse ( int slotClicked)
inlineprotected

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

4490 {
4491 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
4492 return;
4493
4494 if (m_AreHandsLocked)
4495 return; //Player is in the short window of time after interrupting placement of an item and before getting it back in hands
4496
4497 if (GetInventory().IsInventoryLocked() || IsEmotePlaying())
4498 return;
4499
4500 if (GetThrowing().IsThrowingModeEnabled() || GetThrowing().IsThrowingAnimationPlaying())
4501 return;
4502
4503 if (IsRaised() || GetCommand_Melee() || IsSwimming() || IsClimbingLadder() || IsClimbing() || IsRestrained() || IsRestrainPrelocked())
4504 return;
4505
4506 if (GetDayZPlayerInventory().IsProcessing() || IsItemsToDelete())
4507 return;
4508
4509 if (GetActionManager().GetRunningAction() != null)
4510 return;
4511
4513 return;
4514
4515 if (!ScriptInputUserData.CanStoreInputUserData())
4516 return;
4517
4518 //TODO MW change locking method
4519 //if (GetDayZPlayerInventory().HasLockedHands())
4520 // return;
4521
4522 EntityAI quickBarEntity = GetQuickBarEntity(slotClicked - 1);//GetEntityInQuickBar(slotClicked - 1);
4523
4524 if (!quickBarEntity)
4525 return;
4526
4527 Magazine mag;
4528 Weapon_Base wpn;
4529
4530 if (Class.CastTo(mag, quickBarEntity) && Class.CastTo(wpn, mag.GetHierarchyParent()))
4531 return;
4532
4533 EntityAI inHandEntity = GetHumanInventory().GetEntityInHands();
4534
4535 if (!GetDayZPlayerInventory().IsIdle())
4536 return; // player is already performing some animation
4537
4538 InventoryLocation handInventoryLocation = new InventoryLocation;
4539 handInventoryLocation.SetHands(this,quickBarEntity);
4540 if (this.GetInventory().HasInventoryReservation(quickBarEntity, handInventoryLocation))
4541 return;
4542
4543 if (inHandEntity == quickBarEntity)
4544 {
4545 if (GetHumanInventory().CanRemoveEntityInHands())
4546 {
4547 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Stash - PredictiveMoveItemFromHandsToInventory HND=" + Object.GetDebugName(inHandEntity));
4548 PredictiveMoveItemFromHandsToInventory();
4549 }
4550 }
4551 else
4552 {
4553 InventoryLocation invLocQBItem = new InventoryLocation;
4554 quickBarEntity.GetInventory().GetCurrentInventoryLocation(invLocQBItem);
4555 if (GetInventory().HasInventoryReservation(quickBarEntity,invLocQBItem))
4556 return;
4557
4558 if (inHandEntity)
4559 {
4560 InventoryLocation Reserved_Item_il = new InventoryLocation;
4561
4562 InventoryLocation inHandEntityFSwapDst = new InventoryLocation;
4563 inHandEntity.GetInventory().GetCurrentInventoryLocation(inHandEntityFSwapDst);
4564
4565 int index = GetHumanInventory().FindUserReservedLocationIndex(inHandEntity);
4566 if (index >= 0)
4567 GetHumanInventory().GetUserReservedLocation(index, Reserved_Item_il);
4568
4569 if (Reserved_Item_il)
4570 inHandEntityFSwapDst.CopyLocationFrom(Reserved_Item_il, true);
4571
4572 if (index < 0 && GameInventory.CanSwapEntitiesEx(quickBarEntity, inHandEntity))
4573 {
4574 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] PredictiveSwapEntities QB=" + Object.GetDebugName(quickBarEntity) + " HND=" + Object.GetDebugName(inHandEntity));
4575 PredictiveSwapEntities(quickBarEntity, inHandEntity);
4576 }
4577 else if (GameInventory.CanForceSwapEntitiesEx(quickBarEntity, handInventoryLocation, inHandEntity, inHandEntityFSwapDst))
4578 {
4579 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Swap - PredictiveForceSwapEntities HND=" + Object.GetDebugName(inHandEntity) + " QB=" + Object.GetDebugName(quickBarEntity) + " fswap_dst=" + InventoryLocation.DumpToStringNullSafe(inHandEntityFSwapDst));
4580 PredictiveForceSwapEntities(quickBarEntity, inHandEntity, inHandEntityFSwapDst);
4581 }
4582 }
4583 else
4584 {
4585 if (GetInventory().HasInventoryReservation(quickBarEntity,handInventoryLocation))
4586 return;
4587
4588 if (GetInventory().CanAddEntityIntoHands(quickBarEntity))
4589 {
4590 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Stash - PredictiveTakeEntityToHands QB=" + Object.GetDebugName(quickBarEntity));
4591 PredictiveTakeEntityToHands(quickBarEntity);
4592 }
4593 }
4594 }
4595 }
void syncDebugPrint(string s)
Определения 3_Game/Systems/Inventory/Debug.c:1
class LogManager EntityAI
bool IsProcessing()
returns true when FP is heating or cooling
Определения FireplaceBase.c:1645
override bool IsIdle()
Определения WeaponStableState.c:95
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:8601
bool IsClimbing()
Определения PlayerBase.c:5216
bool IsEmotePlaying()
Определения PlayerBase.c:5230
override bool PredictiveSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
Определения PlayerBase.c:8523
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:2088
bool IsItemsToDelete()
Определения PlayerBase.c:7959
override bool PredictiveForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
Определения PlayerBase.c:8581
DayZPlayerInstanceType
defined in C++
Определения dayzplayer.c:1068
proto native DayZPlayerInstanceType GetInstanceType()
class LOD Object
bool IsRunning()
Определения 3_Game/tools/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().