27 {
29
30 if ( player && target_entity )
31 {
32 array<string> selections = new array<string>();
33 target_entity.GetActionComponentNameList( target.GetComponentIndex(),selections );
34
35 if ( target_entity && target_entity.GetInventory() && target_entity.GetInventory().AttachmentCount() > 0 )
36 {
37 for(int i = 0; i < selections.Count(); i++ )
38 {
39 int target_slot_id = InventorySlots.GetSlotIdFromString( selections[i] );
40 EntityAI att = target_entity.GetInventory().FindAttachment(target_slot_id);
41
42 if ( att && player.GetInventory().CanAddEntityIntoHands(att) )
43 {
44 if ( att.CanDetachAttachment( target_entity ) && target_entity.CanReleaseAttachment( att ) )
45 return target_slot_id;
46 }
47 }
48 }
49 }
50 return InventorySlots.INVALID;
51 }