251 {
252 string cfg_path = "cfgVehicles" + " " + target.GetType() + " "+ "GUIInventoryAttachmentsProps";
253
254 if (
g_Game.ConfigIsExisting( cfg_path ) )
255 {
256 int child_count =
g_Game.ConfigGetChildrenCount( cfg_path );
257
258 for ( int i = 0; i < child_count; i++ )
259 {
260 string child_name;
261 g_Game.ConfigGetChildName( cfg_path, i, child_name );
262
263 string child_selection;
264 g_Game.ConfigGetText( cfg_path +
" " + child_name +
" " +
"selection", child_selection );
265
266 if ( selection == child_selection )
267 {
268 ref array<string> attachment_slots = new array<string>;
269 g_Game.ConfigGetTextArray( cfg_path +
" " + child_name +
" " +
"attachmentSlots", attachment_slots );
270
271 for ( int j = 0; j < attachment_slots.Count(); ++j )
272 {
273 int target_slot_id = InventorySlots.GetSlotIdFromString( attachment_slots.Get( j ) );
274 int item_slot_count = item_to_attach.GetInventory().GetSlotIdCount();
275
276 for ( int k = 0; k < item_slot_count; ++k )
277 {
278 int item_slot_id = item_to_attach.GetInventory().GetSlotId( k );
279 ItemBase attachment_item =
ItemBase.Cast( target.GetInventory().FindAttachment( item_slot_id ) );
280
281 if ( target_slot_id == item_slot_id )
282 {
283 if ( target.GetInventory().CanAddAttachmentEx( item_to_attach, item_slot_id ) && target.CanReceiveAttachment( item_to_attach, item_slot_id ) || attachment_item && attachment_item.
CanBeCombined( item_to_attach ) )
284 {
285 if(target.CanDisplayAttachmentSlot(target_slot_id))
286 return item_slot_id;
287 else
288 return -1;
289 }
290 }
291 }
292 }
293 }
294 }
295 }
296
297 return -1;
298 }
class GP5GasMask extends MaskBase ItemBase
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)