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 };
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -44,8 +44,9 @@ export function mod_sources(mods_dir: string): ServerModSource[] {
|
||||
});
|
||||
}
|
||||
|
||||
// a game with an in memory host that remembers what it sent to each connection
|
||||
export async function test_game(mods_dir: string, save?: WorldSave, seed = "test-seed") {
|
||||
// a game with an in memory host that remembers what it sent to each connection. the seed has low, dry land around
|
||||
// 0, 0, where players spawn and where tests build things
|
||||
export async function test_game(mods_dir: string, save?: WorldSave, seed = "test-seed-90") {
|
||||
EverythingRegistry.clear();
|
||||
const outbox = new Map<number, unknown[]>();
|
||||
const closed = new Set<number>();
|
||||
|
||||
@@ -55,7 +55,7 @@ Deno.test("trees grow on the ground, never closer than 4 blocks, even across chu
|
||||
let spilled_leaves = 0;
|
||||
for (let cx = -6; cx < 6; cx++) {
|
||||
for (let cz = -6; cz < 6; cz++) {
|
||||
const { blocks, spills } = generate_raw_chunk(cx, cz, "trees-test", ids);
|
||||
const { blocks, spills } = generate_raw_chunk(cx, cz, game.world.seed, ids);
|
||||
blocks.forEach((block, i) => {
|
||||
if (logs.has(block) && ground.has(blocks[i - CHUNK_AREA])) {
|
||||
const x = cx * 16 + (i % 16);
|
||||
|
||||
Reference in New Issue
Block a user