diff --git a/README.md b/README.md index fad437f..7135364 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Inventory vertical-list widget. Reads a composition list-container via managed by `lib-core.panel`. Provides icon + label + count rows with right-click context-menu support. -**Version:** 0.1.0 +**Version:** 0.1.1 **Lib-ID:** lib-core.inventory-list-display **Requires:** lib-core.panel v0.1.0, lib-core.inventory-list v0.1.0, lib-core.composition v0.2.0 **Tags:** inventory, ui, panel, widget, list @@ -38,10 +38,33 @@ v0.1 ships a minimal vertical-list inventory widget: **Intentional non-goals (deferred):** - Row scrolling (wheel event silently ignored) - Stack-count display (`stack_mode="stack"` not supported in v0.1) -- Pretty item names (no `composition.template_of` accessor yet; override via `set_label_resolver`) - Row selection highlight - Multi-column layout +## Item-Template-Convention + +This widget reads optional player-facing properties from the item's +composition-template. All are optional; missing values fall back to +defaults. + +| Property | Type | Default | Used by | +|---|---|---|---| +| `name` | string | template-id-fallback / `"Item"` | default `label_resolver` — shown in the row | +| `description` | string | (empty) | consumer-side actions (e.g. Inspect) — flavor text | +| `weight` | number | 0 | reserved — read by `inventory-grid` (Phase F/G) | +| `volume` | number | 0 | reserved — read by `inventory-grid` (Phase F/G) | +| `composition.` | number (0-1) | (absent) | crafting recipes (Phase E); see `architecture/composition-model.md §4` for material catalog | +| `sprite_atlas` | string | (empty) | default `icon_resolver` — atlas path for icon | +| `sprite_uv` | `{x,y,w,h}` | (absent) | default `icon_resolver` — UV rect within atlas | +| `stack_mode` | string | required by `inventory-list` | `"individual"` only in v0.x | +| `position.x/y` | number | required for world placement | rendered by `lib-core.render` | + +**Skill-gated reveals on top of `description`** are handled by a +separate `lib-core.hints` lib (designed, not yet implemented). When +hints land, the base `description` stays untouched; hints attach +predicate-gated extra reveals at examine/tooltip time. Modules without +skill systems use `description` as the only flavor text. + ## API ### `display.create(container_entity, opts)` diff --git a/init.lua b/init.lua index fd69336..7679ca5 100644 --- a/init.lua +++ b/init.lua @@ -81,9 +81,14 @@ local function default_icon_resolver(item) end -- default_label_resolver(item) -> string --- v0.1: no public composition.template_of accessor exists. Module --- overrides via set_label_resolver to provide pretty names. +-- Reads the player-facing `name` property from the item-template. Modules +-- that declare `name` on their item-templates get pretty names automatically; +-- modules without `name` get the generic "Item" fallback. +-- Override via set_label_resolver for custom mappings (template-id, lookup +-- table, localization, …). local function default_label_resolver(item) + local name = item:get_property("name") + if name and name ~= "" then return name end return "Item" end diff --git a/manifest.lib b/manifest.lib index 757bc5e..2b548d2 100644 --- a/manifest.lib +++ b/manifest.lib @@ -1 +1 @@ -{"id":"lib-core.inventory-list-display","version":"0.1.0","api_min":"0.1","deps":[{"id":"lib-core.panel","version":"0.1.0"},{"id":"lib-core.inventory-list","version":"0.1.0"},{"id":"lib-core.composition","version":"0.2.0"}]} +{"id":"lib-core.inventory-list-display","version":"0.1.1","api_min":"0.1","deps":[{"id":"lib-core.panel","version":"0.1.0"},{"id":"lib-core.inventory-list","version":"0.1.0"},{"id":"lib-core.composition","version":"0.2.0"}]}