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