Change how ticking works a little
This commit is contained in:
@@ -331,3 +331,22 @@ Deno.test("a pumpkin plant becomes a pumpkin the morning it's grown, and a melon
|
||||
assertEquals(slices.map((item) => item.id), ["bworld:melon_slice"]);
|
||||
assert(slices[0].count >= 3 && slices[0].count <= 7);
|
||||
});
|
||||
|
||||
Deno.test("blocks without data run on_new_day near players, once a morning", async () => {
|
||||
const t = await setup();
|
||||
// a cactus without data, like one world generation made
|
||||
t.game.set_block(0, 100, 0, "bworld:sand");
|
||||
t.game.set_block(0, 101, 0, "bworld:cactus");
|
||||
t.game.world.remove_tile(0, 101, 0);
|
||||
t.next_morning();
|
||||
assertEquals(t.game.world.get_block_id(0, 102, 0), "bworld:cactus", "grew a block");
|
||||
assertEquals(t.game.world.get_block_id(0, 103, 0), "bworld:air", "the new block waits for tomorrow");
|
||||
|
||||
// far from every player, in a chunk that isn't kept, nothing runs
|
||||
const far = 16 * 40;
|
||||
t.game.set_block(far, 100, 0, "bworld:sand");
|
||||
t.game.set_block(far, 101, 0, "bworld:cactus");
|
||||
t.game.world.remove_tile(far, 101, 0);
|
||||
t.next_morning();
|
||||
assertEquals(t.game.world.get_block_id(far, 102, 0), "bworld:air");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user