Generic and decoupled code is the way
I use an info container system where code keeps up with items its storing only when its part of it.
The next level up the chain has no record that the items below it exists until it has to store them.
So the mag acquires bullets that hold data that the gun collects from as many mags as it holds to make Projectiles. But doesn’t need the inventory to do it. Nor do attachments affect it if they aren’t present.
And mags do there own calculation without the gun for add & remove.
The struct arrays get a bit big and sort of a pain. but they really keep it organized
I think every item should stand on its own and call events to interacting items. In my personal guncode i have rewritten it so deeply and isolated from the plugin and character, that i could rip it out of the vr plugin and use it anywhere there is a way to pick it up. I could even ditch mags and spawn and attach it to be like a tank cannon. Interface commands are a beautiful thing.