crafting v0.5.0 + composition v0.4.0: Quality & Condition (Phase J)
lib-core.composition v0.4.0: un-defer quality/condition as inert numeric properties (loud-error removed); composition stores them without semantics. lib-core.crafting v0.5.0: quality-block (multi-contributor product-quality formula: skill-band with min=requires-floor + named ingredient/tool qualities), optional slot name, tool wear_per_use (condition decrement + wear report). affordance stays boolean. Additive to v0.4.0. vagrant-skeleton v0.22.0: branch quality-band RNG at spawn; stone_hammer condition=1.0; knap+axe quality-blocks; hammer wears out. Headless-verified 20/20. Design: meta/docs/design/2026-08-03-crafting-quality-condition-design.md. Docs synced: crafting-model.md, composition-model.md, libraries.md, READMEs.
This commit is contained in:
11
README.md
11
README.md
@@ -5,7 +5,7 @@ property defaults; `create` spawns an `engine.entity` with template
|
||||
defaults + per-instance overrides; entities are indexed by template-id
|
||||
and tag for cheap reverse-lookup.
|
||||
|
||||
**Version:** 0.3.0
|
||||
**Version:** 0.4.0
|
||||
**Lib-ID:** lib-core.composition
|
||||
**Requires:** (none — uses engine `entity.*`, `domain.contribute` only)
|
||||
**Tags:** composition, entity, template, tag-index
|
||||
@@ -21,7 +21,7 @@ graph LR
|
||||
```
|
||||
<!-- topology:end -->
|
||||
|
||||
## Scope (v0.3.0)
|
||||
## Scope (v0.4.0)
|
||||
|
||||
Template-Only-Subset + set_tag + container declaration + template-id reverse-lookup.
|
||||
|
||||
@@ -35,11 +35,16 @@ Template-Only-Subset + set_tag + container declaration + template-id reverse-loo
|
||||
- `set_tag(entity, tag, present)` — v0.2: runtime tag add/remove
|
||||
- `get_container(entity)` — v0.2: read back the container block from entity's template
|
||||
|
||||
**Supported (v0.4.0 — Phase J):**
|
||||
- `quality`, `condition` — accepted as ordinary inert numeric properties
|
||||
(template default or per-instance override). composition stores them and
|
||||
knows NO semantics (no clamp/default/decay/RNG); producers set the values
|
||||
(crafting quality-formula, wear-decrement, module acquisition roll).
|
||||
|
||||
**Deferred (Loud-Error if attempted):**
|
||||
- `slots` block → Phase D trigger (Composite Items with Sub-Items)
|
||||
- `container` constraint fields (`weight_max`, `volume_max`, `grid`,
|
||||
`accepts_fluid`, `accepts_gas`, `restrictions`) → Phase F/G trigger
|
||||
- `quality`, `condition` → Phase J trigger (Damage / Wear)
|
||||
- `parent:` template-inheritance → no consumer yet
|
||||
|
||||
## API
|
||||
|
||||
22
init.lua
22
init.lua
@@ -28,12 +28,17 @@
|
||||
-- entity was created from, or nil if the entity is not
|
||||
-- composition-managed. Loud-Error if entity is nil.
|
||||
--
|
||||
-- v0.4.0 additions (Phase J — Quality / Condition):
|
||||
-- - `quality` / `condition` are now accepted as ordinary inert numeric
|
||||
-- properties (no longer a loud-error). composition stores them and knows
|
||||
-- NO semantics — no clamp, no default, no decay, no RNG. Producers own the
|
||||
-- meaning (crafting quality-formula, wear-decrement, module acquisition
|
||||
-- roll). See design/2026-08-03-crafting-quality-condition-design.md.
|
||||
--
|
||||
-- DEFERRED (loud-error if attempted):
|
||||
-- - slots → Phase D Trigger (Composite Items with Sub-Items)
|
||||
-- - container constraint fields (weight_max, volume_max, grid,
|
||||
-- accepts_fluid, accepts_gas, restrictions) → Phase F/G Trigger
|
||||
-- - quality → Phase J Trigger (Damage / Wear)
|
||||
-- - condition → Phase J Trigger (Damage / Wear)
|
||||
-- - parent: → Template-Inheritance, no consumer yet
|
||||
-- - composite-property values (e.g. position = {x, y} as single
|
||||
-- property) — engine PROPERTY_TABLE doesn't exist; nested-tables
|
||||
@@ -202,12 +207,13 @@ function M.define_template(def)
|
||||
end
|
||||
end
|
||||
end
|
||||
if def.quality ~= nil or def.condition ~= nil then
|
||||
error(string.format(
|
||||
"composition.define_template '%s': 'quality' / 'condition' " ..
|
||||
"are Phase-J triggers (Damage / Wear); not supported in v0.2",
|
||||
def.id))
|
||||
end
|
||||
-- v0.4.0 (Phase J): `quality` / `condition` are no longer rejected. They are
|
||||
-- ordinary inert numeric properties — composition stores them and knows NO
|
||||
-- semantics (no clamp, no default, no decay, no RNG). Producers set them:
|
||||
-- crafting's quality-formula, a wear-decrement, or a module's acquisition
|
||||
-- roll. A template may declare them as plain properties (e.g. a tool with a
|
||||
-- default `condition = 1.0`); they flatten/declare like any other scalar.
|
||||
-- See design/2026-08-03-crafting-quality-condition-design.md §2.
|
||||
if def.parent ~= nil then
|
||||
error(string.format(
|
||||
"composition.define_template '%s': 'parent:' inheritance has " ..
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"id":"lib-core.composition","version":"0.3.0","api_min":"0.1","deps":[]}
|
||||
{"id":"lib-core.composition","version":"0.4.0","api_min":"0.1","deps":[]}
|
||||
|
||||
Reference in New Issue
Block a user