3 override void CreateActionComponent()
21 override void CreateConditionComponents()
27 override bool HasTarget()
38 if ( !item_to_pack.IsTakeable() )
return false;
39 if ( item_to_pack.IsBeingPlaced() )
return false;
41 if ( !item_to_pack.CanPutInCargo(
null) )
return false;
47 if ( item_to_pack.GetInventory().IsAttachment() )
49 if ( !item_to_pack.CanDetachAttachment(tgt_parent) || !tgt_parent.CanReleaseAttachment(item_to_pack) )
54 if ( !item_to_pack.CanRemoveFromCargo(tgt_parent) || !tgt_parent.CanReleaseCargo(item_to_pack) )
59 if ( item_to_pack.GetInventory().GetCargo() && item_to_pack.GetInventory().GetCargo().GetItemCount() > 0)
62 if ( !item_to_pack.IsWeapon() && item_to_pack.GetInventory().AttachmentCount() > 0)
67 GetGame().GetInventoryItemSize( item_to_pack,
x,
y );
75 override void OnFinishProgressClient(
ActionData action_data )
80 player.RemoveQuickBarEntityShortcut(item_to_pack);
84 override void OnFinishProgressServer(
ActionData action_data )
87 ItemBase item = action_data.m_MainItem;
94 GetGame().GetInventoryItemSize( item_to_pack,
x,
y );
95 int rnd =
Math.RandomIntInclusive(1, 4);
99 if(
x <= 2 &&
y <= 2 )
101 typeName =
"GiftBox_Small_" + rnd;
103 else if(
x <= 3 &&
y <= 3 )
105 typeName =
"GiftBox_Medium_" + rnd;
107 else if(
x <= 5 &&
y <= 5 )
109 typeName =
"GiftBox_Large_" + rnd;
114 if(!
GetGame().IsDedicatedServer())
115 player.RemoveQuickBarEntityShortcut(item_to_pack);
118 player.ServerReplaceItemWithNew(lambda);
131 m_ItemToCargo = item_to_cargo;
134 override void OnSuccess(
EntityAI new_item)
136 super.OnSuccess(new_item);
139 m_ItemToCargo.GetInventory().GetCurrentInventoryLocation(src);
142 dst.SetCargo(new_item, m_ItemToCargo, 0,0,0,
false);
146 if(
GetGame().IsDedicatedServer())