As of now the only way to add weapon with attachments to weapon holder container is to add a weapon class that already has the attachments, this method does not give full control over weapon attachments and current weapon definitions lack all possible combinations of attachments. Current method in general is very uncomfortable to use since it requires an addon just to be able to have weapon with wanted attachments available in weapon holder container.
I propose to expand weapon holder manipulations scripting commands with following commands:
vehicle addWeaponWithAccessoriesCargo [weaponName, muzzleItem, flashlightItem, opticsItem, count];
vehicle addWeaponWithAccessoriesCargoGlobal [weaponName, muzzleItem, flashlightItem, opticsItem, count];
These two commands should add weapons with specified muzzle, flashlight and optics attachments into weapon holder container, local and global variants. If incompatible attachment is specified, command should do nothing.
weaponWithAccessoriesCargo vehicle
This command should return list of weapons with all their attachments in array format of
[[weaponName1, muzzleItem1, flashlightItem1, opticsItem1], [weaponName2, muzzleItem2, flashlightItem2, opticsItem2], ...]