Add tiers for watering cans

This commit is contained in:
2026-09-30 00:11:04 -03:00
parent d8d1ee4698
commit 69900f7007
22 changed files with 219 additions and 37 deletions
+27 -8
View File
@@ -27,17 +27,17 @@ Deno.test("the base game loads from mods/bworld", async () => {
const bworld = (entries: [string, unknown][]) => entries.filter(([id]) => id.startsWith("bworld:")).length;
// 7 kinds of log, planks and leaves
assertEquals(bworld(EverythingRegistry.entries("blocks")), 42);
// 38 items (20 of them tools) plus the item forms of the 37 blocks that have one
assertEquals(bworld(EverythingRegistry.entries("items")), 75);
// bworld's 16 (4 wood tools, 7 planks, the fishing rod), the cooking pot, stove, cutting board and wood knife are
// farmersdelight's
assertEquals(game.recipes.shaped.length, 20);
// every log and fish smelts, every log burns
assertEquals(game.recipes.furnace.size, 14);
// 42 items (25 of them tools) plus the item forms of the 37 blocks that have one
assertEquals(bworld(EverythingRegistry.entries("items")), 79);
// bworld's 18 (4 wood tools, the wood watering can, 7 planks, the fishing rod, the smithing table), the cooking pot,
// stove, cutting board and wood knife are farmersdelight's
assertEquals(game.recipes.shaped.length, 22);
// every log and fish smelts, every log burns, and so do sand into glass and cobblestone into stone
assertEquals(game.recipes.furnace.size, 16);
assertEquals(game.recipes.fuel.size, 8);
assertEquals(EverythingRegistry.get<BlockRegistry>("blocks", "bworld:water")?.replaceable, true);
// still has its code until it's a component
assert(EverythingRegistry.get<ItemRegistry>("items", "bworld:watering_can")?.on_create);
assert(EverythingRegistry.get<ItemRegistry>("items", "bworld:copper_watering_can")?.on_create);
});
Deno.test("mods/bworld json survives going to the registry and back", async () => {
@@ -242,6 +242,25 @@ Deno.test("every tier of pickaxe, axe, shovel and hoe exists and can be made", a
}
});
Deno.test("every tier of watering can exists, can be made and holds more than the last", async () => {
const { game } = await test_game("mods");
const made = new Set([
...game.recipes.shaped.map((recipe) => recipe.result.id),
...game.recipes.smithing.map((recipe) => recipe.result),
]);
let last = 0;
for (const tier of ["wood", "stone", "copper", "iron", "gold"]) {
const id = `bworld:${tier}_watering_can`;
const item = EverythingRegistry.get<ItemRegistry>("items", id);
assertEquals(item?.tool?.type, "watering_can", id);
assertEquals(item?.texture_id, id);
assert(made.has(id), `nothing makes ${id}`);
const max_water = (item?.components?.["bworld:watering_can"] as { max_water: number }).max_water;
assert(max_water > last, id);
last = max_water;
}
});
Deno.test("a lit furnace shows its lit front", async () => {
await test_game("mods");
const furnace = EverythingRegistry.get<BlockRegistry>("blocks", "bworld:furnace")!;