Grubs for seashrooms

This commit is contained in:
2026-10-12 02:32:54 -03:00
parent df26248f4a
commit 726a52b91a
6 changed files with 73 additions and 12 deletions
+23 -4
View File
@@ -77,7 +77,7 @@ Deno.test("right clicking a crab pot opens its menu: a bait slot on top and 9 ou
assert(opened.slots.slice(1, 10).every((s: { output?: boolean }) => s.output));
});
Deno.test("crab pots have a freshwater and a saltwater loot table, one catch a roll", async () => {
Deno.test("crab pots have a freshwater and a saltwater loot table for each bait, one catch a roll", async () => {
const { game } = await test_game("mods");
const catches = (table: string) => {
const items = new Set<string>();
@@ -88,12 +88,12 @@ Deno.test("crab pots have a freshwater and a saltwater loot table, one catch a r
}
return [...items].sort();
};
assertEquals(catches("bworld:gameplay/crabpot_freshwater"), [
assertEquals(catches("bworld:gameplay/crabpot_worms_freshwater"), [
"bworld:chorus_snail",
"bworld:crayfish",
"bworld:leech",
]);
assertEquals(catches("bworld:gameplay/crabpot_saltwater"), [
assertEquals(catches("bworld:gameplay/crabpot_worms_saltwater"), [
"bworld:clam",
"bworld:cold_ocean_hermit_crab",
"bworld:crab",
@@ -104,9 +104,19 @@ Deno.test("crab pots have a freshwater and a saltwater loot table, one catch a r
"bworld:shrimp",
"bworld:warm_ocean_hermit_crab",
]);
assertEquals(catches("bworld:gameplay/crabpot_grubs_freshwater"), [
"bworld:chorus_snail",
"bworld:crayfish",
"bworld:leech",
]);
assertEquals(catches("bworld:gameplay/crabpot_grubs_saltwater"), SEASHROOMS.toSorted());
});
Deno.test("every morning a crab pot in water uses a worm to catch something, from its water's table", async () => {
const SEASHROOMS = ["white", "light_gray", "gray", "black", "brown", "red", "orange", "yellow", "lime", "green"]
.concat(["cyan", "light_blue", "blue", "purple", "magenta", "pink"])
.map((color) => `bworld:${color}_seashroom`);
Deno.test("every morning a crab pot in water uses its bait to catch something, from its bait and water's table", async () => {
const t = await test_game("mods");
t.join(1, "alice");
const tags = tag_api();
@@ -153,6 +163,9 @@ Deno.test("every morning a crab pot in water uses a worm to catch something, fro
const [dry_x, dry_z] = column(false);
const dry = pot([dry_x + 3, dry_z], false, new ItemStack("bworld:worms", 1));
const unbaited = pot([dry_x + 6, dry_z], true, new ItemStack("bworld:dirt", 1));
const [ocean_x, ocean_z] = column(true);
const grubs_ocean = pot([ocean_x + 3, ocean_z], true, new ItemStack("bworld:grubs", 1));
const grubs_river = pot([dry_x + 9, dry_z], true, new ItemStack("bworld:grubs", 1));
next_morning();
assertEquals(caught(ocean).length, 1);
@@ -165,6 +178,12 @@ Deno.test("every morning a crab pot in water uses a worm to catch something, fro
// not in water, or without worms, nothing
assertEquals([caught(dry), dry.get_item(0)?.amount], [[], 1]);
assertEquals([caught(unbaited), unbaited.get_item(0)?.type_id], [[], "bworld:dirt"]);
// grubs catch from their own tables, seashrooms in the ocean
assertEquals(caught(grubs_ocean).length, 1);
assert(SEASHROOMS.includes(caught(grubs_ocean)[0]), caught(grubs_ocean)[0]);
assertEquals(grubs_ocean.get_item(0), undefined);
assertEquals(caught(grubs_river).length, 1);
assert(freshwater.includes(caught(grubs_river)[0]), caught(grubs_river)[0]);
// with no room for the catch it's let go, and the worm kept
for (let slot = 1; slot <= 9; slot++) ocean.set_item(slot, new ItemStack("bworld:stone", 64));