Biome as data
This commit is contained in:
@@ -52,7 +52,8 @@ import {
|
||||
number,
|
||||
word,
|
||||
} from "$/common/commands.ts";
|
||||
import { BIOMES, estimate_biome } from "$/common/worldgen/overworld.ts";
|
||||
import { estimate_biome } from "$/common/worldgen/overworld.ts";
|
||||
import { biome_ids, get_biome } from "$/common/worldgen/biomes.ts";
|
||||
import type { GameLoop } from "./game_loop.ts";
|
||||
import { update_crafting_result } from "./crafting.ts";
|
||||
import type { Menu } from "./menu.ts";
|
||||
@@ -1401,12 +1402,10 @@ export class GameServer {
|
||||
register(
|
||||
literal<ServerCommandSource>("locatebiome").describe("Finds the nearest biome of a kind").then(
|
||||
argument<string, ServerCommandSource>("biome", word())
|
||||
.suggests((partial) =>
|
||||
Object.keys(BIOMES).filter((id) => id.startsWith(partial)).map((text) => ({ text }))
|
||||
)
|
||||
.suggests((partial) => biome_ids().filter((id) => id.startsWith(partial)).map((text) => ({ text })))
|
||||
.executes((context) => {
|
||||
const id = context.get<string>("biome");
|
||||
if (!BIOMES[id]) throw new CommandError(`There's no biome ${id}`);
|
||||
if (!get_biome(id)) throw new CommandError(`There's no biome ${id}`);
|
||||
const player = context.source.server_player;
|
||||
const found = this.#locate_biome(id, Math.floor(player.x), Math.floor(player.z));
|
||||
if (!found) {
|
||||
|
||||
Reference in New Issue
Block a user