Rename engine to cubi

This commit is contained in:
2026-11-03 17:17:37 -03:00
parent 68b78f053a
commit 98fa45ebd1
109 changed files with 643 additions and 788 deletions
+10 -10
View File
@@ -53,7 +53,7 @@ Deno.test("hoe, fill the can, plant, water, and the crop grows the next morning"
// seeds only go on farmland
t.hold("bworld:wheat_seeds");
t.use(0, 100, 1);
assertEquals(t.game.world.get_block_id(0, 101, 1), "bworld:air");
assertEquals(t.game.world.get_block_id(0, 101, 1), "cubi:air");
t.use(1, 100, 0);
assertEquals(t.game.world.get_block_id(1, 101, 0), "bworld:wheat");
@@ -107,7 +107,7 @@ Deno.test("digging up the farmland pops the crop off with its drops", async () =
t.game.set_block(1, 100, 0, "bworld:hoed_dirt");
t.game.set_block(1, 101, 0, "bworld:wheat");
t.send(1, { type: "break_block", x: 1, y: 100, z: 0 });
assertEquals(t.game.world.get_block_id(1, 101, 0), "bworld:air");
assertEquals(t.game.world.get_block_id(1, 101, 0), "cubi:air");
const ids = t.game.item_entities().map((e) => e.item.type_id).sort();
assertEquals(ids, ["bworld:dirt", "bworld:wheat_seeds"]);
});
@@ -182,7 +182,7 @@ Deno.test("potatoes and carrots are planted on farmland, and eaten anywhere else
assertEquals(t.game.players()[0].vitals.food, 10, "planted, not eaten");
// on stone it can't be planted, so it's eaten
t.use(0, 99, 1);
assertEquals(t.game.world.get_block_id(0, 100, 1), "bworld:air");
assertEquals(t.game.world.get_block_id(0, 100, 1), "cubi:air");
assertEquals(t.game.players()[0].vitals.food, 11);
});
@@ -220,14 +220,14 @@ Deno.test("rice is planted in water, grows panicles on top without watering, and
// not on land
t.hold("bworld:rice");
t.use(2, 100, 0);
assertEquals(t.game.world.get_block_id(2, 101, 0), "bworld:air");
assertEquals(t.game.world.get_block_id(2, 101, 0), "cubi:air");
// into the water, standing on the dirt under it
t.use(1, 100, 0);
assertEquals(t.game.world.get_block_id(1, 100, 0), "bworld:rice");
for (let day = 0; day < 3; day++) t.next_morning();
assertEquals(t.state(1, 100, 0, "age"), 3);
assertEquals(t.game.world.get_block_id(1, 101, 0), "bworld:air");
assertEquals(t.game.world.get_block_id(1, 101, 0), "cubi:air");
for (let day = 0; day < 3; day++) t.next_morning();
assertEquals(t.game.world.get_block_id(1, 101, 0), "bworld:rice_panicles");
assertEquals(t.state(1, 101, 0, "age"), 3, "fully grown after 6 days");
@@ -241,7 +241,7 @@ Deno.test("rice is planted in water, grows panicles on top without watering, and
const dropped = t.game.item_entities().map((e) => e.item.type_id).sort();
assertEquals(dropped, ["bworld:rice", "bworld:rice_panicle"]);
assertEquals(t.game.world.get_block_id(1, 100, 0), "bworld:water");
assertEquals(t.game.world.get_block_id(1, 101, 0), "bworld:air");
assertEquals(t.game.world.get_block_id(1, 101, 0), "cubi:air");
});
Deno.test("a crop dies into a dead bush the first morning out of its seasons", async () => {
@@ -272,7 +272,7 @@ Deno.test("a two block crop dies whole, its top going without dropping anything"
t.game.tick();
t.game.tick();
assertEquals(t.game.world.get_block_id(1, 100, 0), "bworld:dead_bush");
assertEquals(t.game.world.get_block_id(1, 101, 0), "bworld:air");
assertEquals(t.game.world.get_block_id(1, 101, 0), "cubi:air");
assertEquals(t.game.item_entities(), []);
});
@@ -329,7 +329,7 @@ Deno.test("blocks without data run on_new_day near players, once a morning", asy
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");
assertEquals(t.game.world.get_block_id(0, 103, 0), "cubi:air", "the new block waits for tomorrow");
// far from every player, in a chunk that isn't kept, nothing runs
const far = 16 * 40;
@@ -337,7 +337,7 @@ Deno.test("blocks without data run on_new_day near players, once a morning", asy
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");
assertEquals(t.game.world.get_block_id(far, 102, 0), "cubi:air");
});
Deno.test("a cactus grows a block a day until it's 4 tall", async () => {
@@ -346,5 +346,5 @@ Deno.test("a cactus grows a block a day until it's 4 tall", async () => {
t.game.set_block(0, 101, 0, "bworld:cactus");
for (let day = 0; day < 6; day++) t.next_morning();
const column = [101, 102, 103, 104, 105].map((y) => t.game.world.get_block_id(0, y, 0));
assertEquals(column, ["bworld:cactus", "bworld:cactus", "bworld:cactus", "bworld:cactus", "bworld:air"]);
assertEquals(column, ["bworld:cactus", "bworld:cactus", "bworld:cactus", "bworld:cactus", "cubi:air"]);
});