Water flowing

This commit is contained in:
2026-10-07 00:09:08 -03:00
parent 69c5c187db
commit b830196829
14 changed files with 1033 additions and 55 deletions
+20
View File
@@ -290,3 +290,23 @@ Deno.test("a smithing result can't be taken once its inputs are gone, even befor
t.game.tick();
assertEquals(menu_items(t.take(1))[3], null);
});
Deno.test("a bucket picks up a water source but not flowing water, and a water bucket puts a source back", async () => {
const t = await setup([["bworld:bucket", 1]]);
const held = () => t.game.players()[0].held_item?.type_id;
t.game.set_block(1, 100, 0, "bworld:water");
// flowing water a block from it, the flow keeps it there
t.game.set_block(2, 100, 0, "bworld:water", undefined, 1);
t.send(1, { type: "use_block", x: 2, y: 100, z: 0, face: "top" });
assertEquals(held(), "bworld:bucket");
t.send(1, { type: "use_block", x: 1, y: 100, z: 0, face: "top" });
assertEquals(held(), "bworld:water_bucket");
assertEquals(t.game.world.get_block_id(1, 100, 0), "bworld:air");
t.send(1, { type: "use_block", x: -2, y: 99, z: 0, face: "top" });
assertEquals(held(), "bworld:bucket");
assertEquals(t.game.world.get_block_id(-2, 100, 0), "bworld:water");
assertEquals(t.game.world.get_block_value(-2, 100, 0) >>> 16, 0);
});