301 {
302 attachments.Clear();
303
304 string cfg_path = "cfgVehicles" + " " + target.GetType() + " "+ "GUIInventoryAttachmentsProps";
305 if (
g_Game.ConfigIsExisting( cfg_path ) )
306 {
307 int child_count =
g_Game.ConfigGetChildrenCount( cfg_path );
308
309 for ( int i = 0; i < child_count; i++ )
310 {
311 string child_name;
312 g_Game.ConfigGetChildName( cfg_path, i, child_name );
313
314 string child_selection;
315 g_Game.ConfigGetText( cfg_path +
" " + child_name +
" " +
"selection", child_selection );
316
317 if ( selection == child_selection )
318 {
319 ref array<string> attachment_slots = new array<string>;
320 g_Game.ConfigGetTextArray( cfg_path +
" " + child_name +
" " +
"attachmentSlots", attachment_slots );
321
322 for ( int j = 0; j < attachment_slots.Count(); ++j )
323 {
324 int target_slot_id = InventorySlots.GetSlotIdFromString( attachment_slots.Get( j ) );
325
326
327 EntityAI attachment = target.GetInventory().FindAttachment( target_slot_id );
328 if ( attachment && target.GetInventory().CanRemoveAttachmentEx( attachment, target_slot_id ) && !target.GetInventory().GetSlotLock( target_slot_id ) )
329 {
330 attachments.Insert( attachment );
331 }
332 }
333 }
334 }
335 }
336 }