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

◆ OnQuickBarSingleUse()

void ManBase::OnQuickBarSingleUse ( int slotClicked)
inlineprotected

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

4645 {
4646 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
4647 return;
4648
4649 if (m_AreHandsLocked)
4650 return; //Player is in the short window of time after interrupting placement of an item and before getting it back in hands
4651
4652 GameInventory inventory = GetInventory();
4653 if (inventory.IsInventoryLocked() || IsEmotePlaying())
4654 return;
4655
4656 if (GetThrowing().IsThrowingModeEnabled() || GetThrowing().IsThrowingAnimationPlaying())
4657 return;
4658
4659 if (IsRaised() || GetCommand_Melee() || IsSwimming() || IsClimbingLadder() || IsClimbing() || IsRestrained() || IsRestrainPrelocked())
4660 return;
4661
4662 if (GetDayZPlayerInventory().IsProcessing() || IsItemsToDelete())
4663 return;
4664
4665 if (GetActionManager().GetRunningAction() != null)
4666 return;
4667
4669 return;
4670
4671 if (!ScriptInputUserData.CanStoreInputUserData())
4672 return;
4673
4674 //TODO MW change locking method
4675 //if (GetDayZPlayerInventory().HasLockedHands())
4676 // return;
4677
4678 EntityAI quickBarEntity = GetQuickBarEntity(slotClicked - 1);//GetEntityInQuickBar(slotClicked - 1);
4679
4680 if (!quickBarEntity)
4681 return;
4682
4683 Magazine mag;
4684 Weapon_Base wpn;
4685
4686 if (Class.CastTo(mag, quickBarEntity) && Class.CastTo(wpn, mag.GetHierarchyParent()))
4687 return;
4688
4689 EntityAI inHandEntity = GetEntityInHands();
4690
4691 if (!GetDayZPlayerInventory().IsIdle())
4692 return; // player is already performing some animation
4693
4694 InventoryLocation handInventoryLocation = new InventoryLocation;
4695 handInventoryLocation.SetHands(this,quickBarEntity);
4696 if (inventory.HasInventoryReservation(quickBarEntity, handInventoryLocation))
4697 return;
4698
4699 if (inHandEntity == quickBarEntity)
4700 {
4701 if (GetHumanInventory().CanRemoveEntityInHands())
4702 {
4703 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Stash - PredictiveMoveItemFromHandsToInventory HND=" + Object.GetDebugName(inHandEntity));
4704 PredictiveMoveItemFromHandsToInventory();
4705 }
4706 }
4707 else
4708 {
4709 InventoryLocation invLocQBItem = new InventoryLocation;
4710 quickBarEntity.GetInventory().GetCurrentInventoryLocation(invLocQBItem);
4711 if (inventory.HasInventoryReservation(quickBarEntity,invLocQBItem))
4712 return;
4713
4714 if (inHandEntity)
4715 {
4716 InventoryLocation inHandEntityFSwapDst = new InventoryLocation;
4717
4718 int index = GetHumanInventory().FindUserReservedLocationIndex(inHandEntity);
4719 if (index >= 0)
4720 GetHumanInventory().GetUserReservedLocation(index, inHandEntityFSwapDst);
4721
4722
4723 if (index < 0 && GameInventory.CanSwapEntitiesEx(quickBarEntity, inHandEntity))
4724 {
4725 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] PredictiveSwapEntities QB=" + Object.GetDebugName(quickBarEntity) + " HND=" + Object.GetDebugName(inHandEntity));
4726 PredictiveSwapEntities(quickBarEntity, inHandEntity);
4727 }
4728 else if (GameInventory.CanForceSwapEntitiesEx(quickBarEntity, handInventoryLocation, inHandEntity, inHandEntityFSwapDst))
4729 {
4730 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Swap - PredictiveForceSwapEntities HND=" + Object.GetDebugName(inHandEntity) + " QB=" + Object.GetDebugName(quickBarEntity) + " fswap_dst=" + InventoryLocation.DumpToStringNullSafe(inHandEntityFSwapDst));
4731 PredictiveForceSwapEntities(quickBarEntity, inHandEntity, inHandEntityFSwapDst);
4732 }
4733 }
4734 else
4735 {
4736 if (inventory.HasInventoryReservation(quickBarEntity,handInventoryLocation))
4737 return;
4738
4739 if (inventory.CanAddEntityIntoHands(quickBarEntity))
4740 {
4741 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Stash - PredictiveTakeEntityToHands QB=" + Object.GetDebugName(quickBarEntity));
4742 PredictiveTakeEntityToHands(quickBarEntity);
4743 }
4744 }
4745 }
4746 }
void syncDebugPrint(string s)
class LogManager EntityAI
bool IsProcessing()
returns true when FP is heating or cooling
Определения FireplaceBase.c:1647
override bool IsIdle()
Определения WeaponStableState.c:95
bool CanAddEntityIntoHands(notnull EntityAI item)
Test if entity can be put into hands.
proto native bool IsInventoryLocked()
static proto native bool HasInventoryReservation(EntityAI item, InventoryLocation dst)
Internally: HasInventoryReservationEx(item, dst, FindInventoryReservationMode.LEGACY,...
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands
override void PredictiveTakeEntityToHands(EntityAI item)
Определения PlayerBase.c:8851
bool IsClimbing()
Определения PlayerBase.c:5373
bool IsEmotePlaying()
Определения PlayerBase.c:5387
override bool PredictiveSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
Определения PlayerBase.c:8773
override bool IsRestrained()
Определения PlayerBase.c:2040
bool m_AreHandsLocked
Определения PlayerBase.c:164
override WeaponManager GetWeaponManager()
Определения PlayerBase.c:1989
ActionManagerBase GetActionManager()
Определения PlayerBase.c:1829
bool IsRestrainPrelocked()
Определения PlayerBase.c:2029
EntityAI GetQuickBarEntity(int index)
Определения PlayerBase.c:2220
bool IsItemsToDelete()
Определения PlayerBase.c:8209
override bool PredictiveForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
Определения PlayerBase.c:8831
DayZPlayerInstanceType
defined in C++
Определения dayzplayer.c:1071
proto native DayZPlayerInstanceType GetInstanceType()
class LOD Object
bool IsRunning()
Определения 3_Game/DayZ/tools/tools.c:264
proto native int GetRunningAction()
returns -1 when no action is running or RELOAD,MECHANISM, ....
Определения ActionManagerBase.c:91

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

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