Panel
cinnabar:extension/panel@0.1.0
An opt-in retained settings panel, rendered and hit-tested by the host.
Grants: controls.
Types
event
One numeric control event routed to its owning mod by control ID.
record event {
id: string,
value: f32,
}
| Member | Type | Description |
|---|---|---|
id | string | |
value | f32 |
panel-layout
Where this mod’s panel lies over the HUD root as last laid out: the panel root’s
width and height in panel units, scale, the HUD GUI units one panel unit spans,
which follows the GUI scale and a reference_size fitted to a small window, and
offset, the panel root’s top left in HUD GUI units from the HUD root’s top left. The
pointer of input.read-controls at p lies at (p - offset) / scale in panel units.
record panel-layout {
width: f32,
height: f32,
scale: f32,
offset: tuple<f32, f32>,
}
| Member | Type | Description |
|---|---|---|
width | f32 | |
height | f32 | |
scale | f32 | |
offset | tuple<f32, f32> |
Functions
set-open
set-open: func(open: bool) -> result<_, string>;
Changes this instance’s panel input ownership on successful callback return. Requires controls authority and a retained or pending panel when opening.
set-content
set-content: func(json: string) -> result<_, string>;
Bounded panel JSON; empty text removes the panel and releases its input. A
cinnabar_hud_control node draws a named control of this mod’s HUD surface, centred:
its laid-out box fitted to the node, or at scale times its HUD size, or with fit,
its painted ink filling that fraction of the node, at most max_scale times its HUD
size.
update-content
update-content: func(json: string) -> result<_, string>;
Applies a bounded sparse control patch and registered surface route atomically. Omitting controls preserves them; bindings, when present, replace custom scalars. The JSON record optionally accepts collection_reveal: {collection: string, item: u32}. The item is its immutable published index, resolved through the accepted collection_order. Each request is consumed once; a filtered-out item is ignored. Optional show_gameplay_hud: bool changes whether the gameplay HUD and mods’ HUD surfaces stay drawn under the open panel; it lasts until changed again or until set-content replaces the panel.
read-layout
read-layout: func() -> option<panel-layout>;
Requires controls authority; none without it and while this mod’s panel is not open.
Types: panel-layout.