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

◆ OnQuickBarSingleUse()

void ManBase::OnQuickBarSingleUse ( int slotClicked)
inlineprotected

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

4939 {
4940 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
4941 return;
4942
4943 if (m_AreHandsLocked)
4944 return; //Player is in the short window of time after interrupting placement of an item and before getting it back in hands
4945
4946 GameInventory inventory = GetInventory();
4947 if (inventory.IsInventoryLocked() || IsEmotePlaying())
4948 return;
4949
4950 if (GetThrowing().IsThrowingModeEnabled() || GetThrowing().IsThrowingAnimationPlaying())
4951 return;
4952
4953 if (IsRaised() || GetCommand_Melee() || IsSwimming() || IsClimbingLadder() || IsClimbing() || IsRestrained() || IsRestrainPrelocked())
4954 return;
4955
4956 if (GetDayZPlayerInventory().IsProcessing() || IsItemsToDelete())
4957 return;
4958
4959 if (GetActionManager().GetRunningAction() != null)
4960 return;
4961
4963 return;
4964
4965 if (!ScriptInputUserData.CanStoreInputUserData())
4966 return;
4967
4968 //TODO MW change locking method
4969 //if (GetDayZPlayerInventory().HasLockedHands())
4970 // return;
4971
4972 EntityAI quickBarEntity = GetQuickBarEntity(slotClicked - 1);//GetEntityInQuickBar(slotClicked - 1);
4973
4974 if (!quickBarEntity)
4975 return;
4976
4977 Magazine mag;
4978 Weapon_Base wpn;
4979
4980 if (Class.CastTo(mag, quickBarEntity) && Class.CastTo(wpn, mag.GetHierarchyParent()))
4981 return;
4982
4983 EntityAI inHandEntity = GetEntityInHands();
4984
4985 if (!GetDayZPlayerInventory().IsIdle())
4986 return; // player is already performing some animation
4987
4988 InventoryLocation handInventoryLocation = new InventoryLocation;
4989 handInventoryLocation.SetHands(this,quickBarEntity);
4990 if (inventory.HasInventoryReservation(quickBarEntity, handInventoryLocation))
4991 return;
4992
4993 if (inHandEntity == quickBarEntity)
4994 {
4995 if (GetHumanInventory().CanRemoveEntityInHands())
4996 {
4997 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Stash - PredictiveMoveItemFromHandsToInventory HND=" + Object.GetDebugName(inHandEntity));
4998 PredictiveMoveItemFromHandsToInventory();
4999 }
5000 }
5001 else
5002 {
5003 InventoryLocation invLocQBItem = new InventoryLocation;
5004 quickBarEntity.GetInventory().GetCurrentInventoryLocation(invLocQBItem);
5005 if (inventory.HasInventoryReservation(quickBarEntity,invLocQBItem))
5006 return;
5007
5008 if (inHandEntity)
5009 {
5010 InventoryLocation inHandEntityFSwapDst = new InventoryLocation;
5011
5012 int index = GetHumanInventory().FindUserReservedLocationIndex(inHandEntity);
5013 if (index >= 0)
5014 GetHumanInventory().GetUserReservedLocation(index, inHandEntityFSwapDst);
5015
5016
5017 if (index < 0 && GameInventory.CanSwapEntitiesEx(quickBarEntity, inHandEntity))
5018 {
5019 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] PredictiveSwapEntities QB=" + Object.GetDebugName(quickBarEntity) + " HND=" + Object.GetDebugName(inHandEntity));
5020 PredictiveSwapEntities(quickBarEntity, inHandEntity);
5021 }
5022 else if (GameInventory.CanForceSwapEntitiesEx(quickBarEntity, handInventoryLocation, inHandEntity, inHandEntityFSwapDst))
5023 {
5024 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Swap - PredictiveForceSwapEntities HND=" + Object.GetDebugName(inHandEntity) + " QB=" + Object.GetDebugName(quickBarEntity) + " fswap_dst=" + InventoryLocation.DumpToStringNullSafe(inHandEntityFSwapDst));
5025 PredictiveForceSwapEntities(quickBarEntity, inHandEntity, inHandEntityFSwapDst);
5026 }
5027 }
5028 else
5029 {
5030 if (inventory.HasInventoryReservation(quickBarEntity,handInventoryLocation))
5031 return;
5032
5033 if (inventory.CanAddEntityIntoHands(quickBarEntity))
5034 {
5035 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Stash - PredictiveTakeEntityToHands QB=" + Object.GetDebugName(quickBarEntity));
5036 PredictiveTakeEntityToHands(quickBarEntity);
5037 }
5038 }
5039 }
5040 }
void syncDebugPrint(string s)
class LogManager EntityAI
bool IsProcessing()
returns true when FP is heating or cooling
Определения FireplaceBase.c:1663
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:9203
bool IsClimbing()
Определения PlayerBase.c:5650
bool IsEmotePlaying()
Определения PlayerBase.c:5664
override bool PredictiveSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
Определения PlayerBase.c:9125
override bool IsRestrained()
Определения PlayerBase.c:2219
bool m_AreHandsLocked
Определения PlayerBase.c:163
override WeaponManager GetWeaponManager()
Определения PlayerBase.c:2047
ActionManagerBase GetActionManager()
Определения PlayerBase.c:1887
bool IsRestrainPrelocked()
Определения PlayerBase.c:2201
EntityAI GetQuickBarEntity(int index)
Определения PlayerBase.c:2399
bool IsItemsToDelete()
Определения PlayerBase.c:8563
override bool PredictiveForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
Определения PlayerBase.c:9183
DayZPlayerInstanceType
defined in C++
Определения dayzplayer.c:1084
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().