Skip to content

Add HUD Hooks - #151

Merged
StarCpt merged 2 commits into
StarCpt:mainfrom
VanirDev:add-hudhooks
Aug 1, 2026
Merged

Add HUD Hooks#151
StarCpt merged 2 commits into
StarCpt:mainfrom
VanirDev:add-hudhooks

Conversation

@VanirDev

Copy link
Copy Markdown
Contributor

Adds HUD Hooks, a small API plugin that lets mods take over parts of the HUD the Mod API does not expose.

What it does: a mod sends a mod message (id 2735914000, payload MyTuple<string, bool, bool> as (token, open, interceptEscape)) to claim a token while its own HUD screen is open, and releases it on close. While any token is held the in-world crosshair is not drawn. Tokens that ask for it also swallow ESC, so the pause menu does not open over the mod's screen. Tokens are tracked per screen so several mods can hold hooks at once, and state is cleared on OnSessionReady.

Patches: two prefixes.

  • MyHudCrosshair.Draw returns false while a token is held.
  • MyGuiSandbox.AddScreen drops the main menu screen when the menu was opened by a new ESC press or the MAIN_MENU control while an intercept token is held, and pops the pause the constructor pushed in single player. It returns true in every other case, so the patch is a no-op unless a mod is actively holding a token.

Failsafe: two ESC presses within 500 ms always let the menu through, so a mod that fails to release its token cannot lock a player out.

Compatibility: client-side only, no world or network state, safe on any server.

@StarCpt
StarCpt merged commit bee6b0a into StarCpt:main Aug 1, 2026
1 check passed
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.

2 participants