Files
EscapistsReintroduced/docs/inventory-layout.md
T

28 lines
5.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Inventory storage-list compatibility
The adapter changes only the storage-list hierarchy in an active successor game mode. The [180423 ordinary Chat run](evidence/game-2026-09-19-180423-inventory-ready/runner.json.txt) demonstrates native compilation, first-open slot compatibility, completed stock initialization and a bounded real-keyboard open/close cycle with no captured native errors. This establishes the first-open path only; repeated opening, storage-list refresh, item transfer and multiplayer remain unqualified. The stock handler and error reporting remain in use. The [independent stock control](inventory-slot-diagnosis.md) reproduces the target pair but remains failed because it also records seven other vanilla errors.
The installed `SCR_InventoryMenuUI.ShowStoragesList` creates `{FC579324F5E4B3A4}UI/layouts/Menus/Inventory/InventoryCharacterGrid.layout` under `StoragesListSlot` and attaches `SCR_InventoryStoragesListUI` (installed script lines 1694–1708). `InventoryMain.layout` gives that parent the type `GridLayoutWidget`; the child layout's root is `OverlayWidget Frame0`. The stock handler calls `LayoutSlot.SetSizeMode` and `LayoutSlot.SetFillWeight` at lines 301–302. These are the two incompatible calls identified by the ordinary inventory-opening error. No stock script or layout is copied into the addon.
`ERR_InventoryLayout.c` creates a native `VerticalLayoutWidget` between that grid and `Frame0` before delegating to the complete stock `HandlerAttached` exactly once. It requires the current active `ERR_GameMode` and world, the exact native current inventory menu, the handler's matching menu owner, and `Frame0` directly under that menu's `GridLayoutWidget StoragesListSlot`. Other modes, menus, roots, or parents retain stock behavior.
The wrapper receives the original child's grid row, column, row/column spans, horizontal/vertical alignment, and all four padding values. Its sole inner child stretches with zero padding; stock code still sets that child's linear layout fill and weight. A failed reparent restores the original grid placement where the child remains in the original grid. A reused wrapper's former placement is restored on failure. The code never adopts a foreign same-named widget or a wrapper with foreign contents, nor moves a child that a callback has moved elsewhere.
Stock source removes the old root and handler during storage-list refresh. The adapter is designed to reuse the now-empty wrapper without accumulating wrappers; this refresh path is covered by policy tests but has not yet been demonstrated natively. Weak root/grid/host identities and a separate bound flag refuse replacement or unexpected deletion. No delayed callbacks are created; native menu hierarchy deletion owns wrapper cleanup.
The implementation uses installed public APIs:
- `WorkspaceWidget.CreateWidget(WidgetType.VerticalLayoutWidgetTypeID, WidgetFlags.VISIBLE, null, 0, parent)`; native documentation permits null color, and vanilla `SCR_HUDGroupUIComponent` creates this widget type.
- `Widget.AddChild`, with vanilla reparenting precedent in `SCR_TaskListUIComponent`, plus `GetParent`, `GetChildren`, `FindAnyWidget`, `SetName`, and `RemoveFromHierarchy`.
- `GridSlot.Get/SetRow`, `Get/SetColumn`, `Get/SetRowSpan`, and `Get/SetColumnSpan`.
- `AlignableSlot.Get/SetPadding`, `Get/SetHorizontalAlign`, and `Get/SetVerticalAlign`, including the native `LayoutHorizontalAlign` and `LayoutVerticalAlign` enums.
- The stock constructor assigns protected `m_MenuHandler` before attachment. The override retains the native argument name `Widget w`.
`python3 tests/test_inventory_layout.py` executes the actual candidate method bodies with UI boundary doubles. It covers scope refusal, placement preservation, one-wrapper refresh reuse, foreign hierarchy refusal, allocation/reparent rollback, and exactly one stock delegation on accepted and refused paths. This checks policy and control flow; the doubles alone do not prove the engine regenerates the slot after `AddChild`. The separate ordinary first-open run supplies native evidence: unchanged stock LayoutSlot operations execute after reparenting without the previous GUI errors, and initialization reaches DONE.
The [180423 console](evidence/game-2026-09-19-180423-inventory-ready/console.log.txt) records native stage 6 with five hit-zone points, followed by stage 7 with seven points, initialization no longer pending and the loading overlay absent on two separated observations. Its delayed [open image](evidence/inventory-ui-review-2026-09-19-180423/inventory-ready.png) shows the character view, vicinity and clothing slots without the loading overlay. The [image review](evidence/inventory-ui-review-2026-09-19-180423/review.json) binds the original BMP and verifies the lossless PNG’s decoded pixels. This demonstrates rendered inventory content, not readability or correctness of every control, slot or interface state. The run binds 193 authored addon files to manifest SHA-256 `6ac9f2cea228b3bb6ca3801a43ec409275ecc49db098182d5da0d3e0feed2ad4` and separately records 2.62 m native movement.
The prior [175333 run](evidence/game-2026-09-19-175333-inventory-adapter/runner.json.txt) was clean but its image still contained a loading spinner. The [175938 run](evidence/game-2026-09-19-175938-inventory-loading-bound/runner.json.txt) was also clean but emitted no open capture; the cause is not established. Missing that image does not prove initialization or the overlay was stuck. Both historical results remain unchanged.
Native qualification still needs repeated open/close and storage-list refresh without wrapper growth, item-transfer behavior, geometry across other inventory configurations and multiplayer. The observed close and clean owned-process cleanup do not by themselves prove every menu/world teardown path. No error filter or changed acceptance rule is used.