9class ActionUnpackBox: ActionContinuousBase
11 void ActionUnpackBox()
36 override void OnFinishProgressServer(
ActionData action_data )
38 if ( action_data.m_MainItem && action_data.m_MainItem.GetHierarchyRootPlayer() == action_data.m_Player )
40 string path =
"CfgVehicles " + action_data.m_MainItem.GetType();
41 string child_name =
"";
48 count =
g_Game.ConfigGetChildrenCount (
path );
49 for (
int i = 0; i < count; i++)
51 g_Game.ConfigGetChildName (
path, i, child_name );
53 if (
g_Game.ConfigGetInt(
path +
" " + child_name +
" value" ) )
55 resources.Insert( child_name );
60 string itemType = resources.Get(0);
61 int itemCount =
g_Game.ConfigGetInt(
path +
" " + itemType +
" value" );
64 action_data.m_Player.ServerReplaceItemInHandsWithNew(lambda);
70class UnboxLambda : ReplaceItemWithNewLambdaBase
73 void UnboxLambda (
EntityAI old_item,
string new_item_type,
PlayerBase player,
int count) { m_ItemCount = count; }
75 override void CopyOldPropertiesToNew (notnull
EntityAI old_item,
EntityAI new_item)
77 super.CopyOldPropertiesToNew(old_item, new_item);
79 if (
g_Game.ConfigIsExisting(
"CfgMagazines " + m_NewItemType ) )
82 Class.CastTo(pile, new_item);
83 pile.ServerSetAmmoCount(m_ItemCount);
88 Class.CastTo(unboxed, new_item);
89 unboxed.SetQuantity(m_ItemCount);
93 override void OnSuccess(
EntityAI new_item)
95 super.OnSuccess(new_item);