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

◆ PredictiveSwapEntities()

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

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

8426 {
8427 //Print("PlayerBase | PredictiveSwapEntities");
8428 Magazine swapmag1 = Magazine.Cast(item1);
8429 Magazine swapmag2 = Magazine.Cast(item2);
8430
8431 if (swapmag1 && swapmag2)
8432 {
8433 Weapon_Base parentWpn;
8434
8435 if (Class.CastTo(parentWpn, swapmag1.GetHierarchyParent()))
8436 {
8437 if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag2))
8438 {
8439 Print("[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 + " to parent wpn=" + parentWpn + " of mag1=" + swapmag1);
8440 return GetWeaponManager().SwapMagazine(swapmag2);
8441 }
8442 else
8443 {
8444 Print("[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
8445 return false;
8446 }
8447 }
8448
8449 if (Class.CastTo(parentWpn, swapmag2.GetHierarchyParent()))
8450 {
8451 if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag1))
8452 {
8453 Print("[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 + " to parent wpn=" + parentWpn + " of mag2=" + swapmag2);
8454 return GetWeaponManager().SwapMagazine(swapmag1);
8455 }
8456 else
8457 {
8458 Print("[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
8459 return false;
8460 }
8461 }
8462 }
8463
8464 EntityAI item_hands;
8465 EntityAI item_ground;
8466 if (IsSwapBetweenHandsAndGroundLargeItem(item1,item2,item_hands,item_ground) && !m_ActionManager.GetRunningAction())
8467 {
8468 ActionManagerClient mngr_client;
8469 CastTo(mngr_client,m_ActionManager);
8470
8471 ActionTarget atrg = new ActionTarget(item_ground,null,-1,vector.Zero,-1.0);
8472 if (mngr_client.GetAction(ActionSwapItemToHands).Can(this,atrg,ItemBase.Cast(item_hands)))
8473 {
8474 mngr_client.PerformActionStart(mngr_client.GetAction(ActionSwapItemToHands),atrg,ItemBase.Cast(item_hands));
8475 return true;
8476 }
8477 return super.PredictiveSwapEntities(item1, item2);
8478 }
8479 else
8480 return super.PredictiveSwapEntities(item1, item2);
8481 }
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:8545
override WeaponManager GetWeaponManager()
Определения PlayerBase.c:1859
ActionManagerBase m_ActionManager
Определения PlayerBase.c:43
bool SwapMagazine(Magazine mag, ActionBase control_action=NULL)
Определения WeaponManager.c:407
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().