Skip to content

HUD component visibility state handling#5028

Open
HeresHavi wants to merge 1 commit into
multitheftauto:masterfrom
HeresHavi:hud-component-visibility-state
Open

HUD component visibility state handling#5028
HeresHavi wants to merge 1 commit into
multitheftauto:masterfrom
HeresHavi:hud-component-visibility-state

Conversation

@HeresHavi

@HeresHavi HeresHavi commented Jul 11, 2026

Copy link
Copy Markdown

Summary

Updated isPlayerHudComponentVisible to report whether a HUD component can actually be drawn, including the global showhud state and fullscreen map suppression.

Radar child components now follow the parent radar state without losing their own visibility settings.

Motivation

Previously, isPlayerHudComponentVisible only checked the state of the requested component. This meant the radar could be hidden by showhud while the function still returned true.

The fullscreen player map also used the same global HUD state. Closing the map could re-enable a HUD that the player had already hidden with showhud.

For example, a resource might display a custom minimap only while the GTA radar is hidden. If the API incorrectly reports that the radar is still visible, the resource cannot reliably decide when to show its replacement.

Fixes #5026.

Test plan

Runtime

  • Before Fix: Running showhud hid the radar, but isPlayerHudComponentVisible("radar") still returned true.
  • After Fix: The function returned false while the HUD was hidden and returned true after restoring it.
  • Valid Case: Hiding the radar directly, toggling showhud, and restoring the HUD kept the radar hidden until it was explicitly restored.
  • Player Map: Opening the fullscreen map temporarily hid the HUD without replacing the state requested through showhud.
  • Radar Children: radar_map, radar_blips, and radar_altimeter followed the parent radar state while keeping their own visibility settings.
  • Reset: Reconnecting restored the global HUD and component visibility defaults.

Builds and Tests

  • Debug | Win32: Client build passed.
  • Release | Win32: Client build passed.
  • Client tests: 304 tests passed.
  • Ran clang-format.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

Implemented owner-aware HUD visibility:

- `showhud` and the full-screen map no longer overwrite each other’s state.
- `isPlayerHudComponentVisible` now respects global HUD visibility.
- Radar child components respect the main radar’s state.
- Reset behavior clears stale map/HUD state.
- No migration, network, or component-ID changes.
- Formatting, project generation, and source-level checks passed.
- Nothing was staged, committed, or pushed; runtime testing remains.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

isPlayerHudComponentVisible("radar") does not reflect showhud state

1 participant