In SCR_GadgetManagerComponent https://enfusionengine.com/api/redirect?to=enfusion://ResourceManager/~ArmaReforger:scripts/Game/Components/Gadgets/SCR_GadgetManagerComponent.c there are multiple 'preventive' ifs which check if the ID that will be used to access the component, stored in m_aInventoryGadgetTypes, is not equal to -1. However, the problem is that such code does not ensure that we are getting the correct ID for the given EGadgetType. Here is the enum declaration for reference:
Here's an example where the class has a default GetType() method that returns 0. As a result, when m_aGadgetArrayMap is asked to return a value for a key that equals 0, it will return the default value since no such key is defined.
As a result, such a component will be added to position 0, which is reserved for the map gadget.
The simplest solution would be to make the following change (assuming that fe. map and other gadgets use EGadgetType.<type> rahter than numeric value):
enum EGadgetType { NONE= 1, MAP = 2, COMPASS = 4, BINOCULARS = 8, FLASHLIGHT = 16, RADIO = 32, RADIO_BACKPACK = 64, WRISTWATCH = 128, CONSUMABLE = 256, BUILDING_TOOL = 512, SUPPORT_STATION = 1024 };
For the sake of clarity and sanity, it would be wise to change SCR_GadgetComponent.GetType() to return EGadgetType.NONE instead of the current 0.
Other option would be to ensure that the first position in SCR_GadgetManagerComponent both m_aInventoryGadgetTypes and m_aGadgetArrayMap are coresponding to EGadgetType == 0
*OnItemAdded is not the only method that is affected in this class, and because of that, one of the issues that can be seen by the end user could be that pressing [M] would bring a gadget that is not a map.