From ec2e94e3463654a6288464a4c070b48ef9bf7368 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 17 Jun 2026 21:13:07 -0400 Subject: feat: smithing added, item/object interaction reworked. recipes and menus refactored. --- AGENTS.md | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) (limited to 'AGENTS.md') diff --git a/AGENTS.md b/AGENTS.md index d3eec03..3217614 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -49,7 +49,7 @@ internal/ | `login_char.go` | Character creation, connection, rename, delete | | `cmd_*.go` | Command handlers for each command (see Commands section) | | `action.go` | StartAction, CancelAction, AdvanceActions, checkCondition, verbAliases, verbSkill | -| `action_*.go` | Action lifecycle per type (gather, talk, use, toggle) | +| `action_*.go` | Action lifecycle per type (gather, talk, use, toggle, production) | | `action_burn.go` | Burn/stoke firemaking (standalone, not behavior-YAML-driven) | | `action_search.go` | Search bird's nests for loot | | `action_room.go` | RunEnterSteps (on_enter scripts), BroadcastRespawns | @@ -137,7 +137,7 @@ Item and object YAML `color` fields also support gradient syntax: `color: "g:196 | `say ` | Room chat (preserves case from raw input) | | `score` / `sc` | Character stats and skills | | `inventory` / `i` / `inv` | Inventory contents (28 slots) | -| `equipment` / `eq` | Equipped items by slot | +| `equip` / `eq` / `equipment` / `wear` / `wield` | View or change equipped items (no args = view, with args = equip) | | `look` / `l` | Room view (mobs, objects, ground items, exits, players) | | `look ` / `l ` | Examine mobs, objects, items, players, directions | | `exits` | List available exits | @@ -158,8 +158,7 @@ Item and object YAML `color` fields also support gradient syntax: `color: "g:196 ### Free (stackable, execute before active) | Command | Description | |---------|-------------| -| `wear` / `wield ` | Equip item to correct slot. `wear all` auto-equips best per slot | -| `wear all` | Auto-equips highest-value item per slot from inventory | +| `equip` / `wear` / `wield ` | Equip item to correct slot. `equip all` auto-equips best per slot | | `remove` / `unwear` / `unwield ` | Unequip item back to inventory. `remove all` unequips everything | | `eat ` | Eat food to heal (3-tick cooldown, can eat during combat) | @@ -175,6 +174,8 @@ Item and object YAML `color` fields also support gradient syntax: `color: "g:196 | `mine` / `chop` / `cut` / `fish ` | Gathering with smart default (verbAliases map to "gather") | | `use [on/with] ` | Universal item interaction: recipes, crafting, gathering shortcuts | | `cook ` | Cook raw food on a fire or cooking range (Cooking skill) | +| `smelt [item]` | Smelt ore into bars at a furnace (Smithing skill) | +| `smith [item]` | Smith bars into items at an anvil with a hammer (Smithing skill) | | `talk` / `speak` / `ask ` | NPC conversations (objects or mobs with behavior) | | `pull` / `push ` | Toggle interactions (levers, gates) | | `search ` | Search bird's nests / searchable items (rolls on search_table) | @@ -237,6 +238,9 @@ The `verbSkill` map maps verb → skill name for default target resolution: | `moving` | n/s/e/w/u/d | Multi-tick movement state | | `picking_up` | get | One-tick pickup state | | `dropping` | drop | One-tick drop state | +| `cooking` | cook | Cooking food on fire/range | +| `smelting` | smelt | Smelting ore into bars at furnace | +| `smithing` | smith | Smithing bars into items at anvil | ### Behavior Types (YAML-driven) @@ -254,6 +258,9 @@ The `verbSkill` map maps verb → skill name for default target resolution: | burn | `action_burn.go` | 3-phase firemaking: drop log → try burn → skill check → create fire object | | stoke | `action_burn.go` | Add logs to fire, XP per log, increments fire quality | | search | `action_search.go` | Search items with search_table, consumes one, rolls on drop table | +| cook | `action_production.go` | Recipe-driven cooking on fire/range stations | +| smelt | `action_production.go` | Recipe-driven smelting of ore into bars at furnace | +| smith | `action_production.go` | Recipe-driven smithing of bars into items at anvil (requires hammer) | ### GatherConfig Fields @@ -419,6 +426,8 @@ From `internal/object/item.go`: | `search_misc_table` | Secondary drop table | | `search_ticks` | Ticks per search action | | `search_message` | Custom search message | +| `made_from` | MadeFrom entries for item-on-item combinations (byproducts supported) | +| `ticks` | Ticks per production cycle for MadeFrom combines (default 2) | ## ObjectDef Fields @@ -432,7 +441,8 @@ From `internal/object/object.go`: | `hidden` | Interactable but not shown in room listing | | `inroom_description` | Custom "A X is here." text | | `removal_item` | Item dropped when instance is removed (fire → ashes) | -| `props` | Arbitrary key-value map (description, quality_description with `{quality}` placeholder) | +| `description` | Text shown when examining the object (supports `{quality}` placeholder for quality-based objects) | +| `use_interactions` | List of item-on-object interactions with conditions and actions (see worldbuilding guide) | ## World ObjState Fields @@ -475,7 +485,9 @@ From `internal/net/server.go`: | `StateChangeDescription` | Setting player description | | `StateTalk` | NPC conversation input | | `StateDropAllConfirm` | Confirming `drop all` | -| `StateCookRecipe` | Cook recipe selection | +| `StateRecipeChoice` | Recipe/product selection menu | +| `StateHowMany` | "How many?" production count prompt | +| `StateSmithProduct` | Smith product selection with table display | | `StateColorChoice` | New account color preference | ## Adding a New Skill @@ -491,7 +503,16 @@ Set `xp` on the behavior to award XP on successful gathers. Set `deplete_timer` ## Adding a New Production Skill -Same as gathering but use `type: use` behavior (see `UseConfig` in `internal/action/behavior.go`). Smithing is the reference example planned. +Production skills (cooking, smelting, smithing) share a unified system in `action_production.go`: + +1. Create recipe YAMLs in `data/recipes/` with the new `type` (e.g., `type: fletching`) +2. Create a station object in `data/objects/` if needed +3. Add a `cmd_.go` command handler following the `cmd_cook.go` pattern +4. Add the command to `classifyCommand()` and `executeCommand()` in `game.go` +5. Add the action type string to `AdvanceActions` in `action.go` +6. Add a case in `startProductionFromRecipe()` for default messages + +The unified production cycle handles: "How many?" prompt, start message, timed loops, success/fail rolls, XP, output quantity, stackable stacking, byproducts, and end message. Tool requirements (e.g., hammer for smithing, needle for crafting) are checked in the command handler before calling `promptHowMany`. ## Adding a New Command @@ -508,7 +529,7 @@ Same as gathering but use `type: use` behavior (see `UseConfig` in `internal/act | Production | Cooking, Smithing, Crafting, Fletching, Alchemy, Construction, Firemaking | | Utility | Agility | -Implemented: Mining, Fishing, Woodcutting, Firemaking. The rest are stubs (skill defined, XP tracked, but no behaviors/objects/items yet). +Implemented: Mining, Fishing, Woodcutting, Firemaking, Cooking, Smithing (smelting + smithing). The rest are stubs (skill defined, XP tracked, but no behaviors/objects/items yet). ## Places to Be Careful -- cgit v1.2.3