fix: admins missing UI controls when JIP joining - #125
Conversation
|
Also another weird behaviour: #logout will remove admin controls even if the user is already in the administrator list. Not sure if this is considered a bug or is intentional (maybe an admin wants to hide the controls?), but I'll mention it anyway. |
fank
left a comment
There was a problem hiding this comment.
Root-cause research confirms the overall direction: PlayerConnected exposes the network user before getUserInfo is guaranteed to have a player object, and the existing str owner _x fallback used the wrong identifier namespace (machine owner ID rather than DirectPlay ID). Moving the JIP path to OnUserSelectedPlayer and waiting for Local matches Bohemia's documented recommendation.
hemtt check, hemtt build, and the PR's CI build pass. I am requesting changes for the documented objNull terminal path below, because it still leaves affected JIP admins without controls. I also left one non-blocking documentation correction.
Clients connecting to the server with their steam ID in the administrator list, or logging in during the lobby, don't receive the admin UI controls when joining a mission in progress. Seemingly in this situation, the PlayerConnected mission EH fires before getUserInfo has a player object to return, resulting in the log: > [OCAP] (recorder) WARNING: getUserInfo unit (index 10) is null for PID 1431421350 (UID: 7656...) When backing out to the lobby and rejoining, i.e. not fully disconnecting from the server, the EH receives the player object and adds the controls as normal. To solve this, an OnUserSelectedPlayer EH is added to wait until the player object exists and transfers locality: https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#OnUserSelectedPlayer > This is the earliest the player object is known when player joins the server, > but it is not local to the user yet, so there is a wait time depending on > network connection.
Unlike PlayerConnected EH, OnUserSelectedPlayer does not fire for non-JIP players, so the previous commit ironically broke non-JIP admins. OCAP_recorder_fnc_init documents an edge case where OCAP initialization may occur too late for the PlayerConnected EH to pick up non-JIP players, and so it calls adminUIcontrol there. However, `getUserInfo` expects a DirectPlayer ID from `getPlayerID`, not a machine network ID as would be returned by `str owner _x`. This fixes it to use the correct command.
3cfc130 to
eb54987
Compare
|
Noting that last force push was to rebase main branch into this branch which merged #124. |
fank
left a comment
There was a problem hiding this comment.
Re-reviewed at 624ea2e. Both prior findings are addressed: the documented objNull path now performs a bounded getUserInfo retry with timeout logging, and the non-JIP comment now accurately describes the preInit/postInit timing confirmed by dedicated-server logs. The CBA timeout argument handling matches CBA_fnc_waitUntilAndExecute. hemtt check, hemtt build, and PR CI pass. No further findings.
Clients connecting to the server with their steam ID in the administrator list or logging in during the lobby don't receive the admin UI controls when joining a mission in progress.
Seemingly in this situation, the PlayerConnected mission EH fires before getUserInfo has a player object to return, resulting in the log:
When backing out to the lobby and rejoining, i.e. not fully disconnecting from the server, the EH receives the player object and adds the controls as normal.
To solve this, an OnUserSelectedPlayer EH is added to wait until the player object exists and transfers locality:
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#OnUserSelectedPlayer
Unlike PlayerConnected EH, OnUserSelectedPlayer does not fire for non-JIP players, so this would ironically break non-JIP admins. OCAP_recorder_fnc_init also documented an edge case where OCAP initialization may occur too late for the PlayerConnected EH to pick up non-JIP players, and so it calls adminUIcontrol there.
However, that code passed
str owner _xtogetUserInfowhich expects a DirectPlayer ID, not a machine network ID. This fixes it to use the correct command,getPlayerID, so both JIP and non-JIP admins receive their controls.