Skip to content

Conversation

@Lpsd
Copy link
Member

@Lpsd Lpsd commented May 23, 2023

Resolves #2944

  • Don't allow setCursorAlpha executed via Lua script(s) to affect the cursor alpha if the main menu or console is visible

Additional issues resolved (not mentioned in #2944):

  • Server cursor alpha not correctly restored if console is hidden using the escape key (instead of the console key bind)
  • Closing the console with the main menu visible would restore the server's cursor alpha

A basic clientside script can be found below to perform all the tests necessary

function setCursorAlphaCommand(cmd, amount)
    amount = tonumber(amount) and math.max(0, math.min(255, amount)) or 0
    setCursorAlpha(amount)
    iprint("cursor alpha", amount, "@" .. getTickCount())
end
addCommandHandler("cursor", setCursorAlphaCommand)

bindKey("F2", "down", function()
    showCursor(not isCursorShowing())
end)

Usage:

  • /cursor <alpha> to set the cursor alpha
  • F2 toggles (on/off) the cursor visiblity

Test cases:

  • When calling setCursorAlpha with the main menu or console visible, it will not be applied
  • When closing the main menu or console, the server's last set cursor alpha value (via setCursorAlpha) will be applied
    • Note: Not applicable if the console is closed whilst the main menu is visible. In this case, the main menu must also be closed for the server's cursor alpha to be applied.
    • Improvement: When closing the console (without the main menu visible) using the escape key, the server's cursor alpha will now be applied.

@lopezloo lopezloo added the bug Something isn't working label May 24, 2023
@patrikjuvonen patrikjuvonen added this to the 1.6.0 milestone May 24, 2023
@patrikjuvonen patrikjuvonen changed the title Fix cursor alpha issues Fix #2944: Fix cursor alpha issues May 25, 2023
@patrikjuvonen
Copy link
Contributor

Thank you, tested lightly and seems to be working as expected.

@patrikjuvonen patrikjuvonen merged commit 87e3dce into multitheftauto:master Jun 12, 2023
@Daemant Daemant mentioned this pull request Jun 27, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setCursorAlpha can change the cursor transparency when the main menu or console is visible

3 participants