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

◆ PredictiveSwapEntities()

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

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

8524 {
8525 //Print("PlayerBase | PredictiveSwapEntities");
8526 Magazine swapmag1 = Magazine.Cast(item1);
8527 Magazine swapmag2 = Magazine.Cast(item2);
8528
8529 if (swapmag1 && swapmag2)
8530 {
8531 Weapon_Base parentWpn;
8532
8533 if (Class.CastTo(parentWpn, swapmag1.GetHierarchyParent()))
8534 {
8535 if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag2))
8536 {
8537 Print("[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 + " to parent wpn=" + parentWpn + " of mag1=" + swapmag1);
8538 return GetWeaponManager().SwapMagazine(swapmag2);
8539 }
8540 else
8541 {
8542 Print("[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
8543 return false;
8544 }
8545 }
8546
8547 if (Class.CastTo(parentWpn, swapmag2.GetHierarchyParent()))
8548 {
8549 if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag1))
8550 {
8551 Print("[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 + " to parent wpn=" + parentWpn + " of mag2=" + swapmag2);
8552 return GetWeaponManager().SwapMagazine(swapmag1);
8553 }
8554 else
8555 {
8556 Print("[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
8557 return false;
8558 }
8559 }
8560 }
8561
8562 EntityAI item_hands;
8563 EntityAI item_ground;
8564 if (IsSwapBetweenHandsAndGroundLargeItem(item1,item2,item_hands,item_ground) && !m_ActionManager.GetRunningAction())
8565 {
8566 ActionManagerClient mngr_client;
8567 CastTo(mngr_client,m_ActionManager);
8568
8569 ActionTarget atrg = new ActionTarget(item_ground,null,-1,vector.Zero,-1.0);
8570 if (mngr_client.GetAction(ActionSwapItemToHands).Can(this,atrg,ItemBase.Cast(item_hands)))
8571 {
8572 mngr_client.PerformActionStart(mngr_client.GetAction(ActionSwapItemToHands),atrg,ItemBase.Cast(item_hands));
8573 return true;
8574 }
8575 return super.PredictiveSwapEntities(item1, item2);
8576 }
8577 else
8578 return super.PredictiveSwapEntities(item1, item2);
8579 }
class LogManager EntityAI
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
Определения ActionTargets.c:121
class GP5GasMask extends MaskBase ItemBase
void PerformActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data=NULL)
Определения ActionManagerClient.c:768
bool IsSwapBetweenHandsAndGroundLargeItem(notnull EntityAI item1, notnull EntityAI item2, out EntityAI item_hands, out EntityAI item_ground)
Определения PlayerBase.c:8643
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().