174 {
176
177 if ( player && target_entity )
178 {
179 array<string> selections = new array<string>();
180 target_entity.GetActionComponentNameList( target.GetComponentIndex(),selections );
181
182 if ( target_entity && target_entity.GetInventory() && target_entity.GetInventory().AttachmentCount() > 0 )
183 {
184 for(int i = 0; i < selections.Count(); i++ )
185 {
187 {
188 int target_slot_id = InventorySlots.GetSlotIdFromString( selections[i] );
189 EntityAI att = target_entity.GetInventory().FindAttachment(target_slot_id);
190
191 if ( att && player.GetInventory().CanAddEntityIntoHands(att) )
192 {
193 if ( att.CanDetachAttachment( target_entity ) && target_entity.CanReleaseAttachment( att ) )
194 return target_slot_id;
195 }
196 }
197 }
198 }
199 }
200 return InventorySlots.INVALID;
201 }