Locate biome
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
literal,
|
||||
word,
|
||||
} from "$/common/commands.ts";
|
||||
import { estimate_biome } from "$/common/worldgen/overworld.ts";
|
||||
import { test_game } from "./helpers.ts";
|
||||
|
||||
interface Source {
|
||||
@@ -157,3 +158,18 @@ Deno.test("/give suggests item ids as they're typed", async () => {
|
||||
send(1, { type: "chat", text: "/give" });
|
||||
assertEquals(take(1).find((m) => m.type === "chat").text, "Not enough: /give <item> [<count>]");
|
||||
});
|
||||
|
||||
Deno.test("/locatebiome says where the nearest biome of a kind is", async () => {
|
||||
const { game, join, take, send } = await test_game("mods");
|
||||
join(1, "alice");
|
||||
take(1);
|
||||
const say = (text: string) => {
|
||||
send(1, { type: "chat", text });
|
||||
return take(1).filter((m) => m.type === "chat").map((m) => m.text).join("\n");
|
||||
};
|
||||
|
||||
const answer = say("/locatebiome bworld:plains");
|
||||
const [x, , z] = answer.match(/at (-?\d+) (-?\d+) (-?\d+)/)!.slice(1).map(Number);
|
||||
assertEquals(estimate_biome(game.world.seed, x, z).biome, "bworld:plains");
|
||||
assert(say("/locatebiome bworld:nowhere").includes("There's no biome bworld:nowhere"));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user