Files
satistaskory/docs/03-Architecture/▶️ Create Goal.md
T
Stephen Fasciani 4e57760de6
Build / build (push) Failing after 35s
Keep the plan on the player in this world's save.
Goals persist as a player attachment: load on join, write after each change, unload on leave so worlds do not leak. Dying does not wipe the list. Remote dedicated servers stay RAM-only.
2026-09-08 05:42:05 -04:00

90 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ▶️ Create Goal
First use case. Application layer. It does not contain domain rules; it uses [[🎯 Goal]] invariants.
Capture (hover item → Add key) is one caller. The use case does not know about inventory screens.
---
## Input
- `ItemId` (the item the player pointed at)
## Output
- The plan’s goals
- Refresh of missing materials (via [[📈 Progress Calculation]])
## Quantity
Always **1** on this path. New goal: quantity 1. Existing goal: quantity + 1.
---
## Flow
```text
CreateGoal(item)
↓
Goal exists for this ItemId?
yes → quantity += 1
no → add Goal(item, 1)
↓
RefreshProgress
remaining per goal = qty − available(item)
resolve remaining through RecipeProvider
aggregate
missing = required − available
```
Persistence: the player in this world's save (ADR-017). Leave the world and the overlay unloads; come back and the goals load.
---
## Sibling use cases (same slice)
Needed so Screen 2’s `[+]`, `[-]`, and Clear are not invented in the UI.
| Use case | Input | Result |
|----------|-------|--------|
| **Adjust Goal Quantity** | ItemId, delta +1 | Quantity + 1, then RefreshProgress |
| **Remove Goal** | ItemId | Goal gone, then RefreshProgress |
| **Clear Goals** | — | All goals gone, then RefreshProgress |
| **Refresh Progress** | — | Recompute missing list from current goals + inventory |
`[-]` on the overlay: if quantity > 1, Adjust −1; if quantity is 1, Remove Goal. The overlay does not keep a 0.
No confirm on Clear.
---
## First wiring
Capture: hover an item in inventory, the crafting bench craft pane, or the craft book; tooltip shows the bound key; press it. That calls this use case.
`/satistaskory add` remains a debug caller (unknown ids are rejected). Overlay on the **right** of the play screen.
Do not start EMI. Do not start a planner menu.
---
## Related Documents
[[🎯 Goal]]
[[📦 Packages]]
[[🔌 Recipe Provider]]
[[💾 Persistence]]
[[📈 Progress Calculation]]
[[🖥️ Experience]]
[[🖼️ Wireframes]]
[[📝 Decisions]]
[[🏛️ Architecture]]