I've looked through the source code, wondering how you have 4 gun slots appearing in the bottom-right corner of the screen. Could you shed some light on how this is accomplished in the code?
Sure, it is very simple: each of the weapon options is its own prototype, and any prototype can be given a list of guns. If you give the same gun more than once, then you get multiple of the same gun. I do this in prototypes/spidertron.lua: https://github.com/tburrows13/SpidertronWeaponSwitcher/blob/master/prototypes/spidertron.lua#L8. The guns have to be either part of the base game or created by you. I create 3 custom guns in prototypes/gun.lua.