feat(vagrant): rock template gains player-facing properties
Rock template now declares name="Rock", a description, weight (kg), volume (L), and composition.stone=1.0. The module-side label_resolver override is removed — display lib's default reads name now. Inspect action prints a structured block (name, description, weight, volume, composition.<material>, reg_id) to the console. Future notification system will route this to an in-game text panel; for now the console output makes Inspect useful instead of silent.
This commit is contained in:
14
README.md
14
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
|
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.
|
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
|
**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
|
**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
|
**Tags:** test-chamber, puppet, walking-sim, interaction
|
||||||
@@ -111,6 +111,18 @@ Only one rock is spawned per session.
|
|||||||
|
|
||||||
## CHANGELOG
|
## 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: <material>=<value>` 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
|
### v0.9.0 — inventory panel UI
|
||||||
- **Panel overlay**: `lib-core.panel` + `lib-core.inventory-list-display` wired in.
|
- **Panel overlay**: `lib-core.panel` + `lib-core.inventory-list-display` wired in.
|
||||||
Tab key toggles a panel overlay showing backpack contents.
|
Tab key toggles a panel overlay showing backpack contents.
|
||||||
|
|||||||
49
init.lua
49
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 +
|
-- Sprite-mode test-chamber: 13-bone humanoid puppet + sprite-tilemap +
|
||||||
-- hardcoded furniture. Subterrain-style puppet control model:
|
-- hardcoded furniture. Subterrain-style puppet control model:
|
||||||
-- multi-look-target (aim/soft), slerp body rotation, hip-static legs,
|
-- 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
|
-- showing backpack contents. Right-click on an item row opens a context
|
||||||
-- menu with Drop and Inspect actions. Q-drop (LIFO quick-drop) remains
|
-- menu with Drop and Inspect actions. Q-drop (LIFO quick-drop) remains
|
||||||
-- available in parallel.
|
-- 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 input = require("lib-core.input")
|
||||||
local camera = require("lib-core.camera")
|
local camera = require("lib-core.camera")
|
||||||
@@ -81,6 +88,14 @@ composition.define_template{
|
|||||||
id = "rock",
|
id = "rock",
|
||||||
properties = {
|
properties = {
|
||||||
stack_mode = "individual", -- required by inventory-list
|
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_atlas = "",
|
||||||
sprite_uv = {x = 0, y = 0, w = 1, h = 1},
|
sprite_uv = {x = 0, y = 0, w = 1, h = 1},
|
||||||
position = {x = 0, y = 0},
|
position = {x = 0, y = 0},
|
||||||
@@ -405,11 +420,8 @@ function M.init(ctx)
|
|||||||
pause_on_open = false,
|
pause_on_open = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Module-side label-resolver (display lib's default returns "Item").
|
-- Default label_resolver reads `name` property from the item-template
|
||||||
-- Vagrant currently has one item template (rock); hardcoded for v0.9.
|
-- (set on the rock template above). No override needed in v0.9.1.
|
||||||
inv_display.set_label_resolver(backpack_widget, function(item)
|
|
||||||
return "Rock"
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Drop action: knows world-reparenting + player position
|
-- Drop action: knows world-reparenting + player position
|
||||||
inv_display.register_action(backpack_widget, "Drop", function(item, c)
|
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
|
if CI_FRAME_PERF then engine.print("vagrant: event=drop_via_menu") end
|
||||||
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)
|
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"))))
|
tostring(item:get_property("composition.reg_id"))))
|
||||||
c.close_menu()
|
c.close_menu()
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"id": "vagrant-skeleton",
|
"id": "vagrant-skeleton",
|
||||||
"version": "0.9.0",
|
"version": "0.9.1",
|
||||||
"kind": "module",
|
"kind": "module",
|
||||||
"api": "^0.1",
|
"api": "^0.1",
|
||||||
"ci_frames": 60,
|
"ci_frames": 60,
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
{"id": "lib-core.composition", "version": "0.2.0"},
|
{"id": "lib-core.composition", "version": "0.2.0"},
|
||||||
{"id": "lib-core.actor", "version": "0.1.0"},
|
{"id": "lib-core.actor", "version": "0.1.0"},
|
||||||
{"id": "lib-core.panel", "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.maps","version":"0.5.7"},
|
||||||
{"id": "lib-core.puppet", "version": "0.5.0"},
|
{"id": "lib-core.puppet", "version": "0.5.0"},
|
||||||
{"id": "lib-core.interaction", "version": "0.1.0"},
|
{"id": "lib-core.interaction", "version": "0.1.0"},
|
||||||
|
|||||||
Reference in New Issue
Block a user