fix: notify channel hygiene + craft-output sprites
- Drop "craft" tag from Inspect-Recipe payload; multi-line detail posts now route only to the inspect/detail channel, not the toast events channel. - Wire rock_pick + rock_pile templates to blob_rect_stone atlas slots (slot_05_tee_open + slot_13_solid) so crafted items render in inventory + on drop instead of magenta fallback. - Drop dead "crafting" tag from events filter (no post emitted it). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
92
init.lua
92
init.lua
@@ -147,43 +147,12 @@ composition.define_template{
|
|||||||
tags = {"renderable", "item"},
|
tags = {"renderable", "item"},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Stone-Pick-Template: output of rock_pick recipe (1 rock + 1 stick).
|
-- NOTE: Crafted-output templates (rock_pick, rock_pile) are defined inside
|
||||||
-- Lives only in the backpack post-craft in v0.11 (no world-drop path yet
|
-- M.init rather than at top-level, because their sprite_atlas defaults need
|
||||||
-- via the Crafting-Panel). slot_05_tee_open reads as a tool-shaped tile.
|
-- the resolved blob_rect_stone PNG path. Crafting calls composition.create
|
||||||
composition.define_template{
|
-- with no extra properties, so the template defaults are the only place to
|
||||||
id = "rock_pick",
|
-- carry sprite_atlas / sprite_uv onto crafted items. See M.init for the
|
||||||
properties = {
|
-- actual define_template calls.
|
||||||
stack_mode = "individual",
|
|
||||||
name = "Stone Pick",
|
|
||||||
description = "A crude pick for mining stone.",
|
|
||||||
weight = 2.8, -- rock + stick (real units)
|
|
||||||
volume = 0.0015,
|
|
||||||
["composition.stone"] = 0.9,
|
|
||||||
["composition.wood"] = 0.1,
|
|
||||||
sprite_atlas = "",
|
|
||||||
sprite_uv = {x = 0, y = 0, w = 1, h = 1},
|
|
||||||
position = {x = 0, y = 0},
|
|
||||||
},
|
|
||||||
tags = {"renderable", "item"},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Rock-Pile-Template: output of 3×rock recipe. slot_13_solid reads as
|
|
||||||
-- a dense cluster tile — visually distinct from a single rock.
|
|
||||||
composition.define_template{
|
|
||||||
id = "rock_pile",
|
|
||||||
properties = {
|
|
||||||
stack_mode = "individual",
|
|
||||||
name = "Rock Pile",
|
|
||||||
description = "A stack of rocks bundled together for storage.",
|
|
||||||
weight = 7.5, -- 3x rock
|
|
||||||
volume = 0.003,
|
|
||||||
["composition.stone"] = 1.0,
|
|
||||||
sprite_atlas = "",
|
|
||||||
sprite_uv = {x = 0, y = 0, w = 1, h = 1},
|
|
||||||
position = {x = 0, y = 0},
|
|
||||||
},
|
|
||||||
tags = {"renderable", "item"},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Player-Actor-Template (Phase A.6). Vagrant's player is an actor whose
|
-- Player-Actor-Template (Phase A.6). Vagrant's player is an actor whose
|
||||||
-- position drives the puppet (sync each frame). NOT tagged renderable —
|
-- position drives the puppet (sync each frame). NOT tagged renderable —
|
||||||
@@ -497,6 +466,51 @@ function M.init(ctx)
|
|||||||
stone_uvs[t.name] = { x = t.uv[1], y = t.uv[2], w = t.uv[3], h = t.uv[4] }
|
stone_uvs[t.name] = { x = t.uv[1], y = t.uv[2], w = t.uv[3], h = t.uv[4] }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Crafted-output templates: defined here (not top-level) so their
|
||||||
|
-- sprite_atlas defaults can carry the resolved blob_rect_stone PNG path.
|
||||||
|
-- crafting.craft calls composition.create with no overrides, so the
|
||||||
|
-- template defaults are the only carrier for sprite_atlas / sprite_uv
|
||||||
|
-- on the crafted instance. Without this, crafted items render as a
|
||||||
|
-- "?" placeholder in the inventory and a magenta-fallback square on
|
||||||
|
-- drop (lib-core.render path-3).
|
||||||
|
-- slot_05_tee_open reads as a tool-shaped tile (rock_pick).
|
||||||
|
-- slot_13_solid reads as a dense cluster tile (rock_pile).
|
||||||
|
local rock_pick_uv = stone_uvs["slot_05_tee_open"]
|
||||||
|
composition.define_template{
|
||||||
|
id = "rock_pick",
|
||||||
|
properties = {
|
||||||
|
stack_mode = "individual",
|
||||||
|
name = "Stone Pick",
|
||||||
|
description = "A crude pick for mining stone.",
|
||||||
|
weight = 2.8, -- rock + stick (real units)
|
||||||
|
volume = 0.0015,
|
||||||
|
["composition.stone"] = 0.9,
|
||||||
|
["composition.wood"] = 0.1,
|
||||||
|
sprite_atlas = stone_atlas_png,
|
||||||
|
sprite_uv = {x = rock_pick_uv.x, y = rock_pick_uv.y,
|
||||||
|
w = rock_pick_uv.w, h = rock_pick_uv.h},
|
||||||
|
position = {x = 0, y = 0},
|
||||||
|
},
|
||||||
|
tags = {"renderable", "item"},
|
||||||
|
}
|
||||||
|
local rock_pile_uv = stone_uvs["slot_13_solid"]
|
||||||
|
composition.define_template{
|
||||||
|
id = "rock_pile",
|
||||||
|
properties = {
|
||||||
|
stack_mode = "individual",
|
||||||
|
name = "Rock Pile",
|
||||||
|
description = "A stack of rocks bundled together for storage.",
|
||||||
|
weight = 7.5, -- 3x rock
|
||||||
|
volume = 0.003,
|
||||||
|
["composition.stone"] = 1.0,
|
||||||
|
sprite_atlas = stone_atlas_png,
|
||||||
|
sprite_uv = {x = rock_pile_uv.x, y = rock_pile_uv.y,
|
||||||
|
w = rock_pile_uv.w, h = rock_pile_uv.h},
|
||||||
|
position = {x = 0, y = 0},
|
||||||
|
},
|
||||||
|
tags = {"renderable", "item"},
|
||||||
|
}
|
||||||
|
|
||||||
-- Spawn Rock-Entity 80px to the left of the backpack so it sits in a
|
-- Spawn Rock-Entity 80px to the left of the backpack so it sits in a
|
||||||
-- distinct position: visible to the player on first load, not overlapping
|
-- distinct position: visible to the player on first load, not overlapping
|
||||||
-- the backpack, reachable by walking left from spawn.
|
-- the backpack, reachable by walking left from spawn.
|
||||||
@@ -668,7 +682,7 @@ function M.init(ctx)
|
|||||||
lines[#lines + 1] = "Output: " .. recipe.output.template
|
lines[#lines + 1] = "Output: " .. recipe.output.template
|
||||||
.. " \xc3\x97 " .. recipe.output.count
|
.. " \xc3\x97 " .. recipe.output.count
|
||||||
notify.post{
|
notify.post{
|
||||||
tags = {"craft", "inspect", "detail"},
|
tags = {"inspect", "detail"},
|
||||||
text = table.concat(lines, "\n"),
|
text = table.concat(lines, "\n"),
|
||||||
severity = "info",
|
severity = "info",
|
||||||
}
|
}
|
||||||
@@ -683,7 +697,7 @@ function M.init(ctx)
|
|||||||
-- Channels (created BEFORE display attach + widget register)
|
-- Channels (created BEFORE display attach + widget register)
|
||||||
notify.create_channel{ id = "inspect", filter = {"inspect"},
|
notify.create_channel{ id = "inspect", filter = {"inspect"},
|
||||||
display_mode = "detail" }
|
display_mode = "detail" }
|
||||||
notify.create_channel{ id = "events", filter = {"pickup", "drop", "crafting", "craft"},
|
notify.create_channel{ id = "events", filter = {"pickup", "drop", "craft"},
|
||||||
display_mode = "toast" }
|
display_mode = "toast" }
|
||||||
notify.create_channel{ id = "log", filter = {}, -- catch-all
|
notify.create_channel{ id = "log", filter = {}, -- catch-all
|
||||||
display_mode = "log" }
|
display_mode = "log" }
|
||||||
|
|||||||
Reference in New Issue
Block a user