GetNativeUiState

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 02:08, 11 October 2026 by QCherry (talk | contribs) (Document native HUD/menu Lua APIs available since 0.1.7; client BUILD202 and save/load protection)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

getNativeUiState

AVAILABLE FROM UPDATE 0.1.7
This function is available in G1R:MP 0.1.7 and later. The contract below includes the compatibility guarantees introduced in that update.

Read the calling resource's requested policy and most recent native UI acknowledgement as a Lua table.

Syntax

state = getNativeUiState()

Parameters

This function does not accept parameters.

Returns

A Lua table. Before a native observation: known=false, fresh=false, pending=false and zero requested masks. Native fields may be absent. After requests, fields include request, requestedHudMask, requestedMenuMask, pending, applied, reason, known and fresh. Native observations add supported, ready, effectiveHudMask, effectiveMenuMask, components, menus and saveLoadBlocked.

Examples

local state = getNativeUiState()
if state.known and state.fresh and state.applied then
    outputDebugString("Latest native UI policy acknowledged")
end

Notes

  • Client-side only; available since 0.1.7. Use client BUILD202 or newer with a compatible Protocol 39 server.
  • See Native HUD and menus for asynchronous acknowledgements, resource ownership, input and restoration.
  • A fresh native snapshot requires an active connection and observation less than 6000 ms old. pending=false alone does not indicate success.
  • components and menus booleans indicate effective permission, not current widget existence or visibility. Effective restrictions combine all resources.
  • HUD mask bits: bars=1, crosshair=2, interaction=4, hotbar=8, notifications=16, combat_markers=32. Menu bits: inventory=1, journal=2, glossary=4, stats=8. Set bits mean restricted.
  • Additional native guard/widget counters are diagnostics, not a replacement for readiness or freshness checks.