Water flowing
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user