https://github.com/acemod/ACE3/pull/9782#issuecomment-1992900402
The `"SlotItemChanged"` EH runs comparatively early/late to CBA's `"loadout"` EH in some instances:
- `"SlotItemChanged"` is earlier (though on the same frame) when dragging within the inventory. That's fine imo.
- Same when using `player setUnitLoadout getUnitLoadout player`, although it doesn't detect a bunch of items, see further below.
- `"SlotItemChanged"` is late (a frame later) when you drag items from/to the ground on/from your inventory.
- Same when you use `player linkItem _classname`. In the GitHub PR the linked comment shows that it happens on the same frame, but I didn't get the same behaviour.
The expected behaviour, imo, is that is should run either earlier than the CBA EH or later, but still in the same frame.
I did not check any other inventory slots, so I'm not sure if other slots are affected.
---
Unfortunately, `"SlotItemChanged"` does not work with the ACE arsenal (this was tested in the editor, but given the finding further below, it's also in mission) as it is.
The ACE arsenal places down a dummy in the editor and does the loadout changing on said dummy. When you leave the arsenal, it transfers the dummy loadout onto the target. For that, we use a CBA function, which boils down to `setUnitLoadout`. I was able to confirm that essentially `player setUnitLoadout getUnitLoadout player` is the source of the ACE arsenal's issues, as `"SlotItemChanged"` does not detect the changes properly.
`"SlotItemChanged"` detects the removal of the uniform, vest, backpack, map, compass, watch, radio and hmd, but only detects the addition of the uniform and vest. This means if you were to track the units loadout via `"SlotItemChanged"`, you'd get the impression the unit has lost backpack, map, compass, watch, radio and hmd.
In contrast, the Vanilla arsenal triggers the removal of not only uniform, vest, backpack, map, compass, watch, radio and hmd, but also helmet and backpack (ACE arsenal didn't trigger those last 2 removals). It detects the addition of all the aforementioned except the backpack.