Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Night Vision - Use slotItemChanged event #9782

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

LinkIsGrim
Copy link
Contributor

When merged this pull request will:

  • Title.

IMPORTANT

  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
  • Development Guidelines are read, understood and applied.
  • Title of this PR uses our standard template Component - Add|Fix|Improve|Change|Make|Remove {changes}.

@LinkIsGrim LinkIsGrim added the kind/enhancement Release Notes: **IMPROVED:** label Feb 8, 2024
@PabstMirror
Copy link
Contributor

What is the advantage over playerEH?
It's a global EH so it seems like it might run a bit more often

@LinkIsGrim
Copy link
Contributor Author

Running on same frame as the slot item is changed

And I don't like running anything off playerEH if we can avoid it but that's just me being needlessly opinionated

@johnb432
Copy link
Contributor

Can't we add it just for ACE_player via a unit switched EH? It would reduce the amount of calls.

@johnb432
Copy link
Contributor

@LinkIsGrim I changed it so it runs on ACE_player only. I'm not sure about the manually calling of [] call FUNC(refreshGoggleType); and whether CBA_fnc_addPlayerEventHandler should run on existing units (e.g. firing at mission start).

@PabstMirror
Copy link
Contributor

Running on same frame as the slot item is changed

seems to be a frame behind when dragging from inventory,
but first in the same frame when using scripted cmds?

["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];
 }];
// drag to ground
TEST 47708 loadout EH [] 
TEST 47709 SlotItemChanged EH [] [B Alpha 1-1:1 (Pabst Mirror),"NVGoggles",616,false]

// drag back on
TEST 48244 loadout EH [NVGoggles] 
TEST 48245 SlotItemChanged EH [NVGoggles] [B Alpha 1-1:1 (Pabst Mirror),"NVGoggles",616,true]

"scripted add" // diag_log "scripted add"; player linkItem "ACE_NVG_Gen4";
TEST 48967 SlotItemChanged EH [ACE_NVG_Gen4] [B Alpha 1-1:1 (Pabst Mirror),"NVGoggles",616,false]
TEST 48967 SlotItemChanged EH [ACE_NVG_Gen4] [B Alpha 1-1:1 (Pabst Mirror),"ACE_NVG_Gen4",616,true]
TEST 48967 loadout EH [ACE_NVG_Gen4] 

@PabstMirror
Copy link
Contributor

getting very strange results in 3den when using missions with arsenal set

  • place unit, change NVG to something custom (like ACE_NVGoggles_WP)
onSlotItemChanged: _item=ACE_NVGoggles_WP, _slot=616, _assign=true, hmd player=ACE_NVGoggles_WP
onSlotItemChanged: _item=NVGoggles, _slot=616, _assign=true, hmd player=ACE_NVGoggles_WP
onSlotItemChanged: _item=NVGoggles, _slot=616, _assign=false, hmd player=ACE_NVGoggles_WP

Slot EH for the new item happens first
Then it adds and removes the old item?
end result is broken because ace_nightvision_playerHMD = "" because the the unassinemnt was the last thing to happen

@johnb432
Copy link
Contributor

johnb432 commented Mar 13, 2024

getting very strange results in 3den when using missions with arsenal set

* place unit, change NVG to something custom (like `ACE_NVGoggles_WP`)
onSlotItemChanged: _item=ACE_NVGoggles_WP, _slot=616, _assign=true, hmd player=ACE_NVGoggles_WP
onSlotItemChanged: _item=NVGoggles, _slot=616, _assign=true, hmd player=ACE_NVGoggles_WP
onSlotItemChanged: _item=NVGoggles, _slot=616, _assign=false, hmd player=ACE_NVGoggles_WP

Slot EH for the new item happens first Then it adds and removes the old item? end result is broken because ace_nightvision_playerHMD = "" because the the unassinemnt was the last thing to happen

Is this with the latest commit or the older code (or both)?
How bad is it, if ace_nightvision_playerHMD is broken in the editor?

@johnb432
Copy link
Contributor

@PabstMirror Can you make a bug report, if you haven't already?

I guess we'll need to set this PR on ice for now.

@LinkIsGrim LinkIsGrim marked this pull request as draft March 26, 2024 13:01
@johnb432
Copy link
Contributor

johnb432 commented Apr 4, 2024

"SlotItemChanged" doesn't detect changes properly when executing player setUnitLoadout getUnitLoadout player.
Unfortunately, it's unusable atm.

I've made a bug report: https://feedback.bistudio.com/T180338.

@johnb432
Copy link
Contributor

Fix has been pushed to the profiling branch, but it means we'll have to wait until 2.18 to get this.

@johnb432 johnb432 added the 2.18 label Apr 10, 2024
@johnb432 johnb432 marked this pull request as ready for review April 10, 2024 14:49
Copy link
Contributor

@johnb432 johnb432 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, once 2.18 is out. Works on the current profiling branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.18 kind/enhancement Release Notes: **IMPROVED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants