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

◆ PredictiveSwapEntities()

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

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

9126 {
9127 //Print("PlayerBase | PredictiveSwapEntities");
9128 Magazine swapmag1 = Magazine.Cast(item1);
9129 Magazine swapmag2 = Magazine.Cast(item2);
9130
9131 if (swapmag1 && swapmag2)
9132 {
9133 Weapon_Base parentWpn;
9134
9135 if (Class.CastTo(parentWpn, swapmag1.GetHierarchyParent()))
9136 {
9137 if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag2))
9138 {
9139 Print("[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 + " to parent wpn=" + parentWpn + " of mag1=" + swapmag1);
9140 return GetWeaponManager().SwapMagazine(swapmag2);
9141 }
9142 else
9143 {
9144 Print("[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
9145 return false;
9146 }
9147 }
9148
9149 if (Class.CastTo(parentWpn, swapmag2.GetHierarchyParent()))
9150 {
9151 if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag1))
9152 {
9153 Print("[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 + " to parent wpn=" + parentWpn + " of mag2=" + swapmag2);
9154 return GetWeaponManager().SwapMagazine(swapmag1);
9155 }
9156 else
9157 {
9158 Print("[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
9159 return false;
9160 }
9161 }
9162 }
9163
9164 EntityAI item_hands;
9165 EntityAI item_ground;
9166 if (IsSwapBetweenHandsAndGroundLargeItem(item1,item2,item_hands,item_ground) && !m_ActionManager.GetRunningAction())
9167 {
9168 ActionManagerClient mngr_client;
9169 CastTo(mngr_client,m_ActionManager);
9170
9171 ActionTarget atrg = new ActionTarget(item_ground,null,-1,vector.Zero,-1.0);
9172 if (mngr_client.GetAction(ActionSwapItemToHands).Can(this,atrg,ItemBase.Cast(item_hands)))
9173 {
9174 mngr_client.PerformActionStart(mngr_client.GetAction(ActionSwapItemToHands),atrg,ItemBase.Cast(item_hands));
9175 return true;
9176 }
9177 return super.PredictiveSwapEntities(item1, item2);
9178 }
9179 else
9180 return super.PredictiveSwapEntities(item1, item2);
9181 }
class LogManager EntityAI
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
Определения ActionTargets.c:125
class GP5GasMask extends MaskBase ItemBase
void PerformActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data=NULL)
Определения ActionManagerClient.c:804
bool IsSwapBetweenHandsAndGroundLargeItem(notnull EntityAI item1, notnull EntityAI item2, out EntityAI item_hands, out EntityAI item_ground)
Определения PlayerBase.c:9245
override WeaponManager GetWeaponManager()
Определения PlayerBase.c:2047
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().