This commit is contained in:
33
server-rs/crates/module-runtime-item/README.md
Normal file
33
server-rs/crates/module-runtime-item/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# module-runtime-item 运行时宝藏模块说明
|
||||
|
||||
日期:`2026-04-21`
|
||||
|
||||
## 1. package 职责
|
||||
|
||||
`module-runtime-item` 是运行时物品子域 crate,当前已经承接宝藏奖励快照与背包桥接相关的纯领域能力:
|
||||
|
||||
1. `TreasureResolveInput / TreasureRecordSnapshot / TreasureInteractionAction`
|
||||
2. 宝藏奖励物品 `RuntimeItemRewardItemSnapshot` 的字段校验与归一化
|
||||
3. `build_treasure_record_snapshot`
|
||||
4. `build_inventory_item_snapshot_from_reward_item`
|
||||
5. 供 `crates/spacetime-module` 聚合表与 reducer 复用的纯 Rust 规则函数
|
||||
|
||||
## 2. 当前阶段说明
|
||||
|
||||
当前 crate 已经提供:
|
||||
|
||||
1. `treasure_record` 首版领域 contract
|
||||
2. 运行时奖励物品到 `module-inventory::InventoryItemSnapshot` 的显式映射 helper
|
||||
3. 中文错误语义与最小测试
|
||||
4. 供 `crates/spacetime-module` 在 `resolve_treasure_interaction` 中把宝藏奖励同步写入 `inventory_slot` 的桥接规则
|
||||
|
||||
补充说明:
|
||||
|
||||
1. 当前 crate 仍保持“纯领域规则”定位,不直接依赖 SpacetimeDB reducer context 或 Axum。
|
||||
2. `spacetime-types` feature 只用于在 `spacetime-module` 中复用这些类型做表字段和 reducer 输入。
|
||||
|
||||
## 3. 边界约束
|
||||
|
||||
1. 当前 crate 只负责任务奖励/宝藏奖励与 inventory 的字段桥接,不承接 story 编排或前端 DTO。
|
||||
2. 宝藏、任务、交易等不同奖励入口若要写入 `inventory_slot`,优先复用这里与 `module-inventory` 的桥接口径,而不是各自重新拼装物品字段。
|
||||
3. 当前真实工程口径以 `docs/technical/M4_RUNTIME_ITEM_TREASURE_SPACETIMEDB_BASELINE_2026-04-21.md` 为准。
|
||||
Reference in New Issue
Block a user