8426 {
8427
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 {
8438 {
8439 Print(
"[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 +
" to parent wpn=" + parentWpn +
" of mag1=" + swapmag1);
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 {
8452 {
8453 Print(
"[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 +
" to parent wpn=" + parentWpn +
" of mag2=" + swapmag2);
8455 }
8456 else
8457 {
8458 Print(
"[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
8459 return false;
8460 }
8461 }
8462 }
8463
8467 {
8468 ActionManagerClient mngr_client;
8470
8472 if (mngr_client.GetAction(ActionSwapItemToHands).Can(
this,atrg,
ItemBase.Cast(item_hands)))
8473 {
8475 return true;
8476 }
8477 return super.PredictiveSwapEntities(item1, item2);
8478 }
8479 else
8480 return super.PredictiveSwapEntities(item1, item2);
8481 }
class ActionTargets ActionTarget
class GP5GasMask extends MaskBase ItemBase
void PerformActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data=NULL)
bool IsSwapBetweenHandsAndGroundLargeItem(notnull EntityAI item1, notnull EntityAI item2, out EntityAI item_hands, out EntityAI item_ground)
override WeaponManager GetWeaponManager()
ActionManagerBase m_ActionManager
bool SwapMagazine(Magazine mag, ActionBase control_action=NULL)
proto void Print(void var)
Prints content of variable to console/log.