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

◆ PredictiveSwapEntities()

override bool ManBase::PredictiveSwapEntities ( notnull EntityAI item1,
notnull EntityAI item2 )
inlineprotected

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

8774 {
8775 //Print("PlayerBase | PredictiveSwapEntities");
8776 Magazine swapmag1 = Magazine.Cast(item1);
8777 Magazine swapmag2 = Magazine.Cast(item2);
8778
8779 if (swapmag1 && swapmag2)
8780 {
8781 Weapon_Base parentWpn;
8782
8783 if (Class.CastTo(parentWpn, swapmag1.GetHierarchyParent()))
8784 {
8785 if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag2))
8786 {
8787 Print("[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 + " to parent wpn=" + parentWpn + " of mag1=" + swapmag1);
8788 return GetWeaponManager().SwapMagazine(swapmag2);
8789 }
8790 else
8791 {
8792 Print("[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
8793 return false;
8794 }
8795 }
8796
8797 if (Class.CastTo(parentWpn, swapmag2.GetHierarchyParent()))
8798 {
8799 if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag1))
8800 {
8801 Print("[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 + " to parent wpn=" + parentWpn + " of mag2=" + swapmag2);
8802 return GetWeaponManager().SwapMagazine(swapmag1);
8803 }
8804 else
8805 {
8806 Print("[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
8807 return false;
8808 }
8809 }
8810 }
8811
8812 EntityAI item_hands;
8813 EntityAI item_ground;
8814 if (IsSwapBetweenHandsAndGroundLargeItem(item1,item2,item_hands,item_ground) && !m_ActionManager.GetRunningAction())
8815 {
8816 ActionManagerClient mngr_client;
8817 CastTo(mngr_client,m_ActionManager);
8818
8819 ActionTarget atrg = new ActionTarget(item_ground,null,-1,vector.Zero,-1.0);
8820 if (mngr_client.GetAction(ActionSwapItemToHands).Can(this,atrg,ItemBase.Cast(item_hands)))
8821 {
8822 mngr_client.PerformActionStart(mngr_client.GetAction(ActionSwapItemToHands),atrg,ItemBase.Cast(item_hands));
8823 return true;
8824 }
8825 return super.PredictiveSwapEntities(item1, item2);
8826 }
8827 else
8828 return super.PredictiveSwapEntities(item1, item2);
8829 }
class LogManager EntityAI
class ActionTargets ActionTarget
class GP5GasMask extends MaskBase ItemBase
void PerformActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data=NULL)
Определения ActionManagerClient.c:762
bool IsSwapBetweenHandsAndGroundLargeItem(notnull EntityAI item1, notnull EntityAI item2, out EntityAI item_hands, out EntityAI item_ground)
Определения PlayerBase.c:8893
override WeaponManager GetWeaponManager()
Определения PlayerBase.c:1989
ActionManagerBase m_ActionManager
Определения PlayerBase.c:90
bool SwapMagazine(Magazine mag, ActionBase control_action=NULL)
Определения WeaponManager.c:408
proto void Print(void var)
Prints content of variable to console/log.

Перекрестные ссылки ActionTarget, Class::CastTo(), GetWeaponManager(), IsSwapBetweenHandsAndGroundLargeItem(), m_ActionManager, ActionManagerClient::PerformActionStart(), EntityAI::PredictiveSwapEntities(), Print() и vector::Zero.

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