Breathing !

This commit is contained in:
2026-10-02 11:28:30 -03:00
parent 9ca717d2d0
commit 88d6de13d5
10 changed files with 50 additions and 12 deletions
+13
View File
@@ -183,3 +183,16 @@ Deno.test("mods can stop or change damage, and hurt, heal and feed players", asy
api.feed(4, 0.5);
assertEquals(api.food, 6);
});
Deno.test("under water they run out of air, shown in bubbles, then drown", async () => {
const t = await setup();
t.game.set_block(0, 100, 0, "bworld:water");
t.game.set_block(0, 101, 0, "bworld:water");
t.take(1);
for (let i = 0; i < 100; i++) t.game.tick();
const air = t.take(1).filter((m: Msg) => m.type === "vitals").at(-1).air;
assert(air > 0 && air < 20, `air ${air}`);
assertEquals(t.player.health, MAX_HEALTH);
for (let i = 0; i < 300; i++) t.game.tick();
assert(t.player.health < MAX_HEALTH);
});