diff --git a/README.md b/README.md index b63983b..f353c61 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ callback, foot-body-orientation ("tactical twist"), scale-deformation walk cycle, and inheritance-decoupled foot sprites. End-to-end inventory pickup/drop demo: pick up a rock into a backpack container, drop it back into the world. -**Version:** 0.9.0 +**Version:** 0.9.1 **Module-ID:** vagrant-skeleton **Requires:** lib-core.input >=0.4.0, lib-core.camera >=0.3.0, lib-core.render >=0.1.0, lib-core.maps >=0.1.2, lib-core.puppet >=0.4.4, lib-core.interaction >=0.1.0, lib-core.composition >=0.2.0, lib-core.actor >=0.1.0, lib-core.inventory-list >=0.1.0, lib-core.panel >=0.1.0, lib-core.inventory-list-display >=0.1.0, lib-asset.prototype-subterrain >=0.1.0 **Tags:** test-chamber, puppet, walking-sim, interaction @@ -111,6 +111,18 @@ Only one rock is spawned per session. ## CHANGELOG +### v0.9.1 — item-template player-facing properties +- **Rock template enriched**: `name`, `description`, `weight` (kg), + `volume` (L), and `composition.stone = 1.0` properties added. Other item + templates can follow the same convention (optional with fallbacks). +- **Inspect prints structured info**: `name`, `description`, `weight`, + `volume`, and a `composition: =` line; `reg_id` + parenthetical at the end. Future notification system will route this + to an in-game text panel. +- **Module-side label_resolver override removed**: `inventory-list-display` + v0.1.1's `default_label_resolver` reads the `name` property; the + hardcoded `"Rock"` override is obsolete. + ### v0.9.0 — inventory panel UI - **Panel overlay**: `lib-core.panel` + `lib-core.inventory-list-display` wired in. Tab key toggles a panel overlay showing backpack contents. diff --git a/init.lua b/init.lua index fd6f9f6..38a328c 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,4 @@ --- sporel-module-vagrant-skeleton v0.9.0 +-- sporel-module-vagrant-skeleton v0.9.1 -- Sprite-mode test-chamber: 13-bone humanoid puppet + sprite-tilemap + -- hardcoded furniture. Subterrain-style puppet control model: -- multi-look-target (aim/soft), slerp body rotation, hip-static legs, @@ -27,6 +27,13 @@ -- showing backpack contents. Right-click on an item row opens a context -- menu with Drop and Inspect actions. Q-drop (LIFO quick-drop) remains -- available in parallel. +-- +-- v0.9.1: Rock template gains player-facing properties (name, +-- description, weight, volume, composition.stone). Inspect prints the +-- name+description+weight+composition block to the console; future +-- notification system will route this to an in-game text panel. Module- +-- side label_resolver override removed — default_label_resolver reads +-- the `name` property. local input = require("lib-core.input") local camera = require("lib-core.camera") @@ -81,6 +88,14 @@ composition.define_template{ id = "rock", properties = { stack_mode = "individual", -- required by inventory-list + -- Player-facing properties (item-template-convention v0.x): + name = "Rock", -- shown by inventory display + description = "A heavy stone. Could be useful for crafting.", + weight = 2.5, -- kg (real units) + volume = 0.001, -- L (real units) + -- Material composition (composition-model.md §4 — 0-1 platonic; + -- 1.0 = pure stone). Phase E (property-driven recipes) reads this. + ["composition.stone"] = 1.0, sprite_atlas = "", sprite_uv = {x = 0, y = 0, w = 1, h = 1}, position = {x = 0, y = 0}, @@ -405,11 +420,8 @@ function M.init(ctx) pause_on_open = false, }) - -- Module-side label-resolver (display lib's default returns "Item"). - -- Vagrant currently has one item template (rock); hardcoded for v0.9. - inv_display.set_label_resolver(backpack_widget, function(item) - return "Rock" - end) + -- Default label_resolver reads `name` property from the item-template + -- (set on the rock template above). No override needed in v0.9.1. -- Drop action: knows world-reparenting + player position inv_display.register_action(backpack_widget, "Drop", function(item, c) @@ -423,9 +435,30 @@ function M.init(ctx) if CI_FRAME_PERF then engine.print("vagrant: event=drop_via_menu") end end) - -- Inspect action: dumps reg_id to console + -- Inspect action: prints player-facing item info to console. Future + -- notification-system (lib-core.toast or similar) will route this to + -- an in-game text panel instead of engine.print. inv_display.register_action(backpack_widget, "Inspect", function(item, c) - engine.print(string.format("vagrant: inspect: reg_id=%s", + local name = item:get_property("name") or "(unnamed)" + local description = item:get_property("description") or "" + local weight = item:get_property("weight") or 0 + local volume = item:get_property("volume") or 0 + engine.print(string.format("=== %s ===", name)) + if description ~= "" then engine.print(description) end + engine.print(string.format("weight=%.2fkg volume=%.3fL", weight, volume)) + -- Surface material composition by iterating composition.* properties. + local props = item:get_properties() + local mats = {} + for k, v in pairs(props) do + local mat = k:match("^composition%.(.+)$") + if mat and mat ~= "reg_id" then + table.insert(mats, string.format("%s=%.2f", mat, v)) + end + end + if #mats > 0 then + engine.print("composition: " .. table.concat(mats, " ")) + end + engine.print(string.format("(reg_id=%s)", tostring(item:get_property("composition.reg_id")))) c.close_menu() end) diff --git a/manifest.module b/manifest.module index 87c21a7..98af40a 100644 --- a/manifest.module +++ b/manifest.module @@ -1,6 +1,6 @@ { "id": "vagrant-skeleton", - "version": "0.9.0", + "version": "0.9.1", "kind": "module", "api": "^0.1", "ci_frames": 60, @@ -18,7 +18,7 @@ {"id": "lib-core.composition", "version": "0.2.0"}, {"id": "lib-core.actor", "version": "0.1.0"}, {"id": "lib-core.panel", "version": "0.1.0"}, - {"id": "lib-core.inventory-list-display", "version": "0.1.0"}, + {"id": "lib-core.inventory-list-display", "version": "0.1.1"}, {"id": "lib-core.maps","version":"0.5.7"}, {"id": "lib-core.puppet", "version": "0.5.0"}, {"id": "lib-core.interaction", "version": "0.1.0"},