Rework biome generation according to tectonic
This commit is contained in:
@@ -9,6 +9,8 @@ import { test_game } from "./helpers.ts";
|
||||
type Msg = any;
|
||||
|
||||
const ROD = "bworld:fishing_rod";
|
||||
// below where the hook floats, even at the bottom of its bobbing, see the bworld mod's fishing
|
||||
const HOOK_UNDER = 0.3;
|
||||
|
||||
// a player on a stone floor at y 99 with water next to them and a rod in hand
|
||||
async function setup() {
|
||||
@@ -27,16 +29,15 @@ async function setup() {
|
||||
const cast = () => t.send(1, { type: "use_block", x: 2, y: 100, z: 0, face: "top" });
|
||||
const reel = () => t.send(1, { type: "use_item" });
|
||||
const fish = () => inventory().filter((i: Msg) => i?.id === "bworld:cod" || i?.id === "bworld:salmon");
|
||||
// ticks until something bites, false if nothing did in 35 seconds
|
||||
const hooks = () => t.game.entities.all().filter((e) => e.type === "bworld:fishing_hook");
|
||||
// ticks until something bites, which pulls the hook under the water. false if nothing did in 35 seconds
|
||||
const wait_for_bite = () => {
|
||||
t.take(1);
|
||||
for (let i = 0; i < 700; i++) {
|
||||
t.game.tick();
|
||||
if (t.take(1).some((m: Msg) => m.type === "chat" && m.text.includes("biting"))) return true;
|
||||
if (hooks()[0]?.y < 101 - HOOK_UNDER) return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const hooks = () => t.game.entities.all().filter((e) => e.type === "bworld:fishing_hook");
|
||||
return { ...t, slot, rod, cast, reel, fish, wait_for_bite, hooks };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user