Page MenuHomeFeedback Tracker

"SlotItemChanged" EH running late/broken
Closed, ResolvedPublic

Description

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 issue, 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.

Details

Severity
Major
Resolution
Fixed
Reproducibility
Always
Operating System
Windows 11 x64
Category
General
Steps To Reproduce

I used the code in the GitHub PR:

["loadout", {
    diag_log text format ["TEST %1 loadout EH [%2] %3", diag_frameNo, hmd player];
}, true] call CBA_fnc_addPlayerEventHandler;

player addEventHandler ["SlotItemChanged", {
    diag_log text format ["TEST %1 SlotItemChanged EH [%2] %3", diag_frameNo, hmd player, _this];
}];

Ran a mission, dragged night vision goggles around, used linkItem command.

The code below was used for the editor tests:

_unit = (get3DENSelected "object") param [0, objNull];

_unit addEventHandler ["SlotItemChanged", {
    diag_log text format ["TEST %1 SlotItemChanged EH [%2] %3", diag_frameNo, hmd (_this select 0), _this];
    systemChat format ["TEST %1 SlotItemChanged EH [%2] %3", diag_frameNo, hmd (_this select 0), _this];
}];

Event Timeline

johnb43 created this task.Apr 4 2024, 10:39 AM
johnb43 renamed this task from "SlotItemChanged" EH running late/broken for hmd slot to "SlotItemChanged" EH running late/broken.
johnb43 edited Steps To Reproduce. (Show Details)
johnb43 updated the task description. (Show Details)Apr 4 2024, 10:41 AM
BIS_fnc_KK set Ref Ticket to AIII-56308.Apr 7 2024, 12:39 PM

Revision: 151680

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.Apr 7 2024, 10:32 PM
BIS_fnc_KK changed the task status from New to Feedback.
BIS_fnc_KK added a subscriber: BIS_fnc_KK.

I have tested on the latest profiling branch using both BI and ACE arsenal - seems to have been resolved. Thank you very much!

BIS_fnc_KK closed this task as Resolved.Apr 11 2024, 5:00 PM
BIS_fnc_KK changed Resolution from Open to Fixed.