OnClientNativeUiResult: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Document native HUD/menu Lua APIs available since 0.1.7; client BUILD202 and save/load protection
 
Complete upcoming 0.1.9 documentation: weather, crafting UI, world removal, doors and ladders; preserve release status
Line 38: Line 38:


== Notes ==
== Notes ==
* Client-side only; available since 0.1.7. Use client BUILD202 or newer with a compatible Protocol 39 server.
* Client-side only; the original API exists since 0.1.7. Crafting extensions require 0.1.9; use matching updated client/server versions.
* See [[Native HUD and menus]] for asynchronous acknowledgements, resource ownership, input and restoration.
* See [[Native HUD and menus]] for asynchronous acknowledgements, resource ownership, input and restoration.
* Register before submitting. Multiple changes can coalesce; intermediate request IDs are not guaranteed a result.
* Register before submitting. Multiple changes can coalesce; intermediate request IDs are not guaranteed a result.
Line 47: Line 47:
[[Category:Lua Events]]
[[Category:Lua Events]]
[[Category:Client Events]]
[[Category:Client Events]]
<!-- crafting019:start -->
== Crafting presentation from 0.1.9 ==
'''Available from 0.1.9 (upcoming; not yet publicly released). Not included in public 0.1.8. Use matching updated clients and server.'''
[[Native crafting UI]] documents the new crafting component, recipe/progress windows, preserved station entry/exit and prevention of invisible recipe starts. It is not a setNativeMenuEnabled key or a custom recipe API. getNativeUiState gains components.crafting, craftingReady, craftingGuardReady, craftingWidgets and craftingObserved; HUD bit 64 is appended, older bits unchanged. Existing resource ownership, asynchronous result handling and restoration still apply. Full station-by-station in-game qualification remains pending.
<!-- crafting019:end -->

Revision as of 20:56, 19 October 2026

onClientNativeUiResult

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

Delivers a native HUD/menu policy acknowledgement to the owning resource's resourceRoot. A result concerns policy readiness, not a screenshot or guarantee that every widget currently exists.

Availability

This event is available in client scripts.

Callback signature

function(requestId, ok, reason, stateJson)

Parameters

Name Type Description
requestId number Request ID returned by a native UI mutator.
ok boolean Whether the requested native policy is currently applied and ready.
reason string Typically applied or waiting-for-native-ui.
stateJson string JSON-encoded native snapshot. Use fromJSON to decode, or getNativeUiState for the full resource state table.

Examples

addEventHandler("onClientNativeUiResult", resourceRoot,
    function(requestId, ok, reason, stateJson)
        outputDebugString("Native UI " .. tostring(requestId) .. ": " .. reason)
    end)
local latestRequest = showNativeHud(false)

Notes

  • Client-side only; the original API exists since 0.1.7. Crafting extensions require 0.1.9; use matching updated client/server versions.
  • See Native HUD and menus for asynchronous acknowledgements, resource ownership, input and restoration.
  • Register before submitting. Multiple changes can coalesce; intermediate request IDs are not guaranteed a result.
  • A waiting result may later be followed by applied for the same ID. Do not assume exactly one result per request.
  • Rejected requests returning false do not produce a native acknowledgement. Compare the event ID with your latest accepted request.
  • The stateJson snapshot differs from the full getNativeUiState table; requested masks and local pending/fresh fields belong to the latter.

Crafting presentation from 0.1.9

Available from 0.1.9 (upcoming; not yet publicly released). Not included in public 0.1.8. Use matching updated clients and server.

Native crafting UI documents the new crafting component, recipe/progress windows, preserved station entry/exit and prevention of invisible recipe starts. It is not a setNativeMenuEnabled key or a custom recipe API. getNativeUiState gains components.crafting, craftingReady, craftingGuardReady, craftingWidgets and craftingObserved; HUD bit 64 is appended, older bits unchanged. Existing resource ownership, asynchronous result handling and restoration still apply. Full station-by-station in-game qualification remains pending.