feat: v0.13.0 Workbench multi-panel via panel v0.2.0
D.2-revisit closes the Workbench Gate-2 walkthrough: right-click on Workbench now opens workbench_crafting (left-half layout-slot) + workbench_inv (right-half) simultaneously, replacing the v0.12.0 auto-switch workaround. Both panels visible at the same time. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
32
init.lua
32
init.lua
@@ -1,4 +1,4 @@
|
||||
-- sporel-module-vagrant-skeleton v0.12.0
|
||||
-- sporel-module-vagrant-skeleton v0.13.0
|
||||
-- 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,
|
||||
@@ -57,9 +57,12 @@
|
||||
-- in the workbench. Take-action in workbench-inv moves an item back
|
||||
-- to the backpack. C-key Backpack-Crafting remains via the bw-compat
|
||||
-- shim in crafting v0.2.0 (Form-1 bare entity-handle stays valid).
|
||||
-- Panel-lib v0.1 is single-active so opening both panels lets
|
||||
-- workbench_inv win; user can close it (X) to reveal workbench_crafting
|
||||
-- below — Gate-2 walkthrough documents the flow.
|
||||
--
|
||||
-- v0.13.0: lib-core.panel bumped to 0.2.0 (multi-active + layout-slots).
|
||||
-- Workbench-Crafting registers with layout="left-half", Workbench-
|
||||
-- Inventory with layout="right-half"; right-click opens both panels
|
||||
-- simultaneously side-by-side. Replaces the v0.12.0 single-active
|
||||
-- caveat where workbench_inv covered workbench_crafting.
|
||||
|
||||
local input = require("lib-core.input")
|
||||
local camera = require("lib-core.camera")
|
||||
@@ -297,16 +300,13 @@ end
|
||||
-- Workbench-Inventory panels.
|
||||
--
|
||||
-- lib-core.interaction v0.1.0 is XY-based (not entity-bound); the trigger
|
||||
-- snapshots the position at registration time. Workbench is static in v0.12
|
||||
-- so a single registration suffices. Action-name "use" is bound to
|
||||
-- mouse_right in M.init's input.bind block.
|
||||
-- snapshots the position at registration time. Workbench is static so a
|
||||
-- single registration suffices. Action-name "use" is bound to mouse_right
|
||||
-- in M.init's input.bind block.
|
||||
--
|
||||
-- Note on dual-panel-open: lib-core.panel v0.1.1 enforces a single active
|
||||
-- widget. Calling panel.open twice means the second call wins
|
||||
-- (workbench_inv shows on top; workbench_crafting is hidden until the
|
||||
-- player closes the inv panel via X). This matches the spec §4.4 note that
|
||||
-- "v0.2 default ist whatever panel-lib default" — proper side-by-side
|
||||
-- layout is a panel-lib v0.2 task, out of scope for D.2.
|
||||
-- panel v0.2.0 supports multi-active panels with layout-slots; the two
|
||||
-- panels (workbench_crafting=left-half, workbench_inv=right-half) are
|
||||
-- visible simultaneously side-by-side after both panel.open calls.
|
||||
local function register_interaction_use(entity)
|
||||
local x = entity:get_property("position.x")
|
||||
local y = entity:get_property("position.y")
|
||||
@@ -882,7 +882,8 @@ function M.init(ctx)
|
||||
ctx_inner.close_menu()
|
||||
end)
|
||||
|
||||
panel.register("workbench_crafting", state.workbench_crafting_widget)
|
||||
panel.register("workbench_crafting", state.workbench_crafting_widget,
|
||||
{layout = "left-half"})
|
||||
-- KEIN bind_default_trigger: trigger is the workbench right-click via
|
||||
-- register_interaction_use(state.workbench) below.
|
||||
|
||||
@@ -934,7 +935,8 @@ function M.init(ctx)
|
||||
c.close_menu()
|
||||
end)
|
||||
|
||||
panel.register("workbench_inv", state.workbench_inv_widget)
|
||||
panel.register("workbench_inv", state.workbench_inv_widget,
|
||||
{layout = "right-half"})
|
||||
|
||||
-- Right-click trigger registered AFTER both workbench widgets are
|
||||
-- panel.register'd; the callback panel.open()s them by id, so they
|
||||
|
||||
Reference in New Issue
Block a user