| 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 | oven: "oven", |
| 12 | fireplace: "fireplace" |
| 13 | }); |
| 14 | |
| 15 | /** How long a player-lit campfire stays usable (ms). */ |
| 16 | export const FIREPLACE_DURATION_MS = 10 * 60 * 1000; |
| 17 | |
| 18 | /** Fixed craft action duration at any station (ms). */ |
| 19 | export const CRAFT_DURATION_MS = 2000; |
| 20 | |
| 21 | export const CRAFTING_STATION_DEFINITIONS = Object.freeze({ |
| 22 | [CraftingStationId.furnace]: Object.freeze({ |
| 23 | stationId: CraftingStationId.furnace, |
| 24 | displayName: "Furnace", |
| 25 | skillId: SkillId.smithing, |
| 26 | description: "Smelt gathered ore into metal bars." |
| 27 | }), |
| 28 | [CraftingStationId.spinningWheel]: Object.freeze({ |
| 29 | stationId: CraftingStationId.spinningWheel, |
| 30 | displayName: "Spinning wheel", |
| 31 | skillId: SkillId.tailoring, |
| 32 | description: "Spin wool (from shorn sheep) into thread." |
| 33 | }), |
| 34 | [CraftingStationId.loom]: Object.freeze({ |
| 35 | stationId: CraftingStationId.loom, |
| 36 | displayName: "Loom", |
| 37 | skillId: SkillId.tailoring, |
| 38 | description: "Weave cloth garments." |
| 39 | }), |
| 40 | [CraftingStationId.anvil]: Object.freeze({ |
| 41 | stationId: CraftingStationId.anvil, |
| 42 | displayName: "Anvil", |
| 43 | skillId: SkillId.smithing, |
| 44 | description: "Smith metal items from bars." |
| 45 | }), |
| 46 | [CraftingStationId.leatherworkingStation]: Object.freeze({ |
| 47 | stationId: CraftingStationId.leatherworkingStation, |
| 48 | displayName: "Leatherworking station", |
| 49 | skillId: SkillId.leatherworking, |
| 50 | description: "Craft leather armour and goods." |
| 51 | }), |
| 52 | [CraftingStationId.craftingBench]: Object.freeze({ |
| 53 | stationId: CraftingStationId.craftingBench, |
| 54 | displayName: "Crafting bench", |
| 55 | skillId: SkillId.crafting, |
| 56 | description: "General crafting (e.g. fletching arrows from smithed tips)." |
| 57 | }), |
| 58 | [CraftingStationId.oven]: Object.freeze({ |
| 59 | stationId: CraftingStationId.oven, |
| 60 | displayName: "Oven", |
| 61 | skillId: SkillId.cooking, |
| 62 | description: "Cook raw meat; low Cooking risks burning the food." |
| 63 | }), |
| 64 | [CraftingStationId.fireplace]: Object.freeze({ |
| 65 | stationId: CraftingStationId.fireplace, |
| 66 | displayName: "Campfire", |
| 67 | skillId: SkillId.cooking, |
| 68 | description: "Portable cooking like an oven but a higher burn chance.", |
| 69 | portable: true, |
| 70 | maxPerTile: 1, |
| 71 | durationMs: FIREPLACE_DURATION_MS |
| 72 | }) |
| 73 | }); |
| 74 | |
| 75 | export function craftingStationDefinition (stationId) |
| 76 | { |
| 77 | return CRAFTING_STATION_DEFINITIONS[stationId] ?? null; |
| 78 | } |