| 1 | import { SkillId } from "./skills.js"; |
| 2 | |
| 3 | /** Placeable or fixed world stations that gate recipes (blocks / ground objects later). */ |
| 4 | export const CraftingStationId = Object.freeze({ |
| 5 | furnace: "furnace", |
| 6 | spinningWheel: "spinning-wheel", |
| 7 | loom: "loom", |
| 8 | anvil: "anvil", |
| 9 | leatherworkingStation: "leatherworking-station", |
| 10 | craftingBench: "crafting-bench", |
| 11 | woodworkingBench: "woodworking-bench", |
| 12 | tailorBench: "tailor-bench", |
| 13 | oven: "oven", |
| 14 | fireplace: "fireplace" |
| 15 | }); |
| 16 | |
| 17 | /** How long a player-lit campfire stays usable (ms). */ |
| 18 | export const FIREPLACE_DURATION_MS = 10 * 60 * 1000; |
| 19 | |
| 20 | /** Fixed craft action duration at any station (ms). */ |
| 21 | export const CRAFT_DURATION_MS = 2000; |
| 22 | |
| 23 | export const CRAFTING_STATION_DEFINITIONS = Object.freeze({ |
| 24 | [CraftingStationId.furnace]: Object.freeze({ |
| 25 | stationId: CraftingStationId.furnace, |
| 26 | displayName: "Furnace", |
| 27 | skillId: SkillId.smithing, |
| 28 | description: "Smelt gathered ore into metal bars." |
| 29 | }), |
| 30 | [CraftingStationId.spinningWheel]: Object.freeze({ |
| 31 | stationId: CraftingStationId.spinningWheel, |
| 32 | displayName: "Spinning wheel", |
| 33 | skillId: SkillId.tailoring, |
| 34 | description: "Spin raw fibre into yarn." |
| 35 | }), |
| 36 | [CraftingStationId.loom]: Object.freeze({ |
| 37 | stationId: CraftingStationId.loom, |
| 38 | displayName: "Loom", |
| 39 | skillId: SkillId.tailoring, |
| 40 | description: "Weave yarn into cloth." |
| 41 | }), |
| 42 | [CraftingStationId.tailorBench]: Object.freeze({ |
| 43 | stationId: CraftingStationId.tailorBench, |
| 44 | displayName: "Tailor's bench", |
| 45 | skillId: SkillId.tailoring, |
| 46 | description: "Sew garments from yarn or cloth. Optional dye colours the result." |
| 47 | }), |
| 48 | [CraftingStationId.anvil]: Object.freeze({ |
| 49 | stationId: CraftingStationId.anvil, |
| 50 | displayName: "Anvil", |
| 51 | skillId: SkillId.smithing, |
| 52 | description: "Smith metal items from bars." |
| 53 | }), |
| 54 | [CraftingStationId.leatherworkingStation]: Object.freeze({ |
| 55 | stationId: CraftingStationId.leatherworkingStation, |
| 56 | displayName: "Leatherworking station", |
| 57 | skillId: SkillId.leatherworking, |
| 58 | description: "Craft leather armour and goods." |
| 59 | }), |
| 60 | [CraftingStationId.craftingBench]: Object.freeze({ |
| 61 | stationId: CraftingStationId.craftingBench, |
| 62 | displayName: "Crafting bench", |
| 63 | skillId: SkillId.crafting, |
| 64 | description: "Assemble finished parts (handles + pickaxe/axe heads, later similar kits)." |
| 65 | }), |
| 66 | [CraftingStationId.woodworkingBench]: Object.freeze({ |
| 67 | stationId: CraftingStationId.woodworkingBench, |
| 68 | displayName: "Woodworking bench", |
| 69 | skillId: SkillId.crafting, |
| 70 | description: "Shape logs into handles and other wood components." |
| 71 | }), |
| 72 | [CraftingStationId.oven]: Object.freeze({ |
| 73 | stationId: CraftingStationId.oven, |
| 74 | displayName: "Oven", |
| 75 | skillId: SkillId.cooking, |
| 76 | description: "Cook raw meat; low Cooking risks burning the food." |
| 77 | }), |
| 78 | [CraftingStationId.fireplace]: Object.freeze({ |
| 79 | stationId: CraftingStationId.fireplace, |
| 80 | displayName: "Campfire", |
| 81 | skillId: SkillId.cooking, |
| 82 | description: "Portable cooking like an oven but a higher burn chance.", |
| 83 | portable: true, |
| 84 | maxPerTile: 1, |
| 85 | durationMs: FIREPLACE_DURATION_MS |
| 86 | }) |
| 87 | }); |
| 88 | |
| 89 | export function craftingStationDefinition (stationId) |
| 90 | { |
| 91 | return CRAFTING_STATION_DEFINITIONS[stationId] ?? null; |
| 92 | } |