Move farmers delight to bworld
This commit is contained in:
+32
-32
@@ -18,7 +18,7 @@ async function setup() {
|
||||
stone_floor(t.game);
|
||||
t.send(1, { type: "move", x: 2.5, y: 100, z: 2.5, yaw: 0, pitch: 0 });
|
||||
t.game.set_block(...FURNACE, "bworld:furnace");
|
||||
t.game.set_block(...POT, "farmersdelight:cooking_pot");
|
||||
t.game.set_block(...POT, "bworld:cooking_pot");
|
||||
|
||||
const container = (at: readonly [number, number, number]) => {
|
||||
const id = (t.game.world.get_tile(...at)?.mod_data as { container: string }).container;
|
||||
@@ -43,12 +43,12 @@ async function setup() {
|
||||
|
||||
Deno.test("the pot only cooks over a lit furnace, then serves the meal into bowls", async () => {
|
||||
const t = await setup();
|
||||
t.put(0, "farmersdelight:tomato", 2);
|
||||
t.put(3, "farmersdelight:tomato", 2);
|
||||
t.put(0, "bworld:tomato", 2);
|
||||
t.put(3, "bworld:tomato", 2);
|
||||
|
||||
// cold: nothing happens
|
||||
t.ticks(150);
|
||||
assertEquals(t.slot(0), "farmersdelight:tomato 2");
|
||||
assertEquals(t.slot(0), "bworld:tomato 2");
|
||||
assertEquals(t.slot(6), "");
|
||||
|
||||
t.light_furnace();
|
||||
@@ -56,13 +56,13 @@ Deno.test("the pot only cooks over a lit furnace, then serves the meal into bowl
|
||||
assertEquals(t.game.world.get_block_id(...FURNACE), "bworld:furnace");
|
||||
t.ticks(100);
|
||||
// one sauce, one tomato from each slot, waiting in the pot for a bowl
|
||||
assertEquals(t.slot(6), "farmersdelight:tomato_sauce 1");
|
||||
assertEquals(t.slot(0), "farmersdelight:tomato 1");
|
||||
assertEquals(t.slot(3), "farmersdelight:tomato 1");
|
||||
assertEquals(t.slot(6), "bworld:tomato_sauce 1");
|
||||
assertEquals(t.slot(0), "bworld:tomato 1");
|
||||
assertEquals(t.slot(3), "bworld:tomato 1");
|
||||
assertEquals(t.slot(8), "");
|
||||
|
||||
t.ticks(100);
|
||||
assertEquals(t.slot(6), "farmersdelight:tomato_sauce 2");
|
||||
assertEquals(t.slot(6), "bworld:tomato_sauce 2");
|
||||
assertEquals(t.slot(0), "");
|
||||
|
||||
// bowls take it out
|
||||
@@ -70,59 +70,59 @@ Deno.test("the pot only cooks over a lit furnace, then serves the meal into bowl
|
||||
t.ticks(1);
|
||||
assertEquals(t.slot(6), "");
|
||||
assertEquals(t.slot(7), "bworld:bowl 3");
|
||||
assertEquals(t.slot(8), "farmersdelight:tomato_sauce 2");
|
||||
assertEquals(t.slot(8), "bworld:tomato_sauce 2");
|
||||
});
|
||||
|
||||
Deno.test("ingredients go in any slots, lists take any of their items, and meals without a container come right out", async () => {
|
||||
const t = await setup();
|
||||
t.light_furnace();
|
||||
t.put(5, "bworld:potato");
|
||||
t.put(1, "farmersdelight:cabbage");
|
||||
t.put(1, "bworld:cabbage");
|
||||
t.ticks(101);
|
||||
assertEquals(t.slot(8), "farmersdelight:cabbage_rolls 1");
|
||||
assertEquals(t.slot(8), "bworld:cabbage_rolls 1");
|
||||
assertEquals(t.slot(6), "");
|
||||
|
||||
// something extra matches nothing
|
||||
t.put(0, "farmersdelight:cabbage");
|
||||
t.put(1, "farmersdelight:onion");
|
||||
t.put(2, "farmersdelight:rice");
|
||||
t.put(0, "bworld:cabbage");
|
||||
t.put(1, "bworld:onion");
|
||||
t.put(2, "bworld:rice");
|
||||
t.ticks(300);
|
||||
assertEquals(t.slot(8), "farmersdelight:cabbage_rolls 1");
|
||||
assertEquals(t.slot(0), "farmersdelight:cabbage 1");
|
||||
assertEquals(t.slot(8), "bworld:cabbage_rolls 1");
|
||||
assertEquals(t.slot(0), "bworld:cabbage 1");
|
||||
|
||||
// a different meal waits until the pot's empty of the other
|
||||
t.pot.set_item(0, undefined);
|
||||
t.pot.set_item(1, undefined);
|
||||
t.ticks(100);
|
||||
assertEquals(t.slot(6), "farmersdelight:cooked_rice 1");
|
||||
t.put(0, "farmersdelight:tomato", 2);
|
||||
t.put(1, "farmersdelight:tomato", 2);
|
||||
assertEquals(t.slot(6), "bworld:cooked_rice 1");
|
||||
t.put(0, "bworld:tomato", 2);
|
||||
t.put(1, "bworld:tomato", 2);
|
||||
t.ticks(300);
|
||||
assertEquals(t.slot(6), "farmersdelight:cooked_rice 1");
|
||||
assertEquals(t.slot(0), "farmersdelight:tomato 2");
|
||||
assertEquals(t.slot(6), "bworld:cooked_rice 1");
|
||||
assertEquals(t.slot(0), "bworld:tomato 2");
|
||||
});
|
||||
|
||||
Deno.test("holding a bowl serves the meal straight into your hand, and breaking the pot drops everything", async () => {
|
||||
const t = await setup();
|
||||
t.light_furnace();
|
||||
t.put(0, "farmersdelight:rice", 3);
|
||||
t.put(0, "bworld:rice", 3);
|
||||
t.ticks(301);
|
||||
assertEquals(t.slot(6), "farmersdelight:cooked_rice 3");
|
||||
assertEquals(t.slot(6), "bworld:cooked_rice 3");
|
||||
|
||||
t.send(1, { type: "chat", text: "/give bworld:bowl 2" });
|
||||
const inventory = () => t.game.players()[0].inventory.to_data().filter((i) => i);
|
||||
t.send(1, { type: "select_slot", slot: 0 });
|
||||
t.send(1, { type: "use_block", x: POT[0], y: POT[1], z: POT[2], face: "top" });
|
||||
assertEquals(t.slot(6), "farmersdelight:cooked_rice 2");
|
||||
assertEquals(inventory().map((i) => `${i!.id} ${i!.count}`), ["bworld:bowl 1", "farmersdelight:cooked_rice 1"]);
|
||||
assertEquals(t.slot(6), "bworld:cooked_rice 2");
|
||||
assertEquals(inventory().map((i) => `${i!.id} ${i!.count}`), ["bworld:bowl 1", "bworld:cooked_rice 1"]);
|
||||
|
||||
t.game.destroy_block(...POT);
|
||||
const dropped = t.game.item_entities().map((e) => `${e.item.type_id} ${e.item.amount}`);
|
||||
assert(dropped.includes("farmersdelight:cooked_rice 2"), String(dropped));
|
||||
assert(dropped.includes("bworld:cooked_rice 2"), String(dropped));
|
||||
});
|
||||
|
||||
Deno.test("mods' own recipe types are accepted, and model faces can turn their texture", () => {
|
||||
assertEquals(validate_recipe({ type: "farmersdelight:cooking", anything: 1 }), []);
|
||||
assertEquals(validate_recipe({ type: "bworld:cooking", anything: 1 }), []);
|
||||
assertEquals(validate_recipe({ type: "cooking" }).length, 1);
|
||||
|
||||
const face = (rotation?: number) =>
|
||||
@@ -144,21 +144,21 @@ Deno.test("a stove is placed lit and heats the pot, coal relights it, and standi
|
||||
const t = await setup();
|
||||
const info = () => t.game.world.get_block_info(...FURNACE)!;
|
||||
const lit = () => get_state_value(t.game.world.get_block_value(...FURNACE), info(), "lit");
|
||||
t.game.set_block(...FURNACE, "farmersdelight:stove");
|
||||
t.game.set_block(...FURNACE, "bworld:stove");
|
||||
assertEquals(lit(), 1);
|
||||
|
||||
t.put(0, "farmersdelight:rice");
|
||||
t.put(0, "bworld:rice");
|
||||
t.ticks(101);
|
||||
assertEquals(t.slot(6), "farmersdelight:cooked_rice 1");
|
||||
assertEquals(t.slot(6), "bworld:cooked_rice 1");
|
||||
|
||||
// out, it doesn't cook
|
||||
t.game.set_block_state(
|
||||
...FURNACE,
|
||||
set_state_value(t.game.world.get_block_value(...FURNACE), info(), "lit", 0)! >>> 16,
|
||||
);
|
||||
t.put(0, "farmersdelight:rice");
|
||||
t.put(0, "bworld:rice");
|
||||
t.ticks(150);
|
||||
assertEquals(t.slot(6), "farmersdelight:cooked_rice 1");
|
||||
assertEquals(t.slot(6), "bworld:cooked_rice 1");
|
||||
|
||||
// coal lights it again, used up
|
||||
t.send(1, { type: "chat", text: "/give bworld:coal 2" });
|
||||
|
||||
Reference in New Issue
Block a user