World gen stuff

This commit is contained in:
2026-11-13 00:01:59 -03:00
parent e013fbe550
commit e8ca9753f5
25 changed files with 645 additions and 162 deletions
+6 -20
View File
@@ -4,14 +4,8 @@
// item tooltips: the game's lines, the ones client scripts add and where they go
import { assertEquals } from "@std/assert";
import { item_tooltip } from "@/client/gui/tooltip.ts";
import { load_client_mods } from "@/client/mods.ts";
import { EverythingRegistry } from "@/common/everything_registry.ts";
import { ItemStack } from "@/common/inventory.ts";
import type { ModListing } from "@/common/mod_loader.ts";
import { read_mod } from "@/common/mod.ts";
import { load_and_check, load_order } from "@/tools/check_mods.ts";
import { pack_mod } from "@/tools/pack_mod.ts";
import { copy_dir } from "./helpers.ts";
import { copy_dir, load_as_player } from "./helpers.ts";
const SNACK = "tips:snack";
@@ -47,19 +41,11 @@ async function load(client_script: string) {
}),
);
write("scripts/client.ts", client_script);
const mods = load_order(await load_and_check(dir));
const packed = await Promise.all(mods.map(async (mod) => read_mod(await pack_mod(mod), `${mod.id}.cubi`)));
Deno.removeSync(dir, { recursive: true });
const listings: ModListing[] = mods.map((mod) => ({
id: mod.id,
name: mod.id,
version: "1.0.0",
sha256: "",
file: "",
size: 0,
}));
EverythingRegistry.clear();
await load_client_mods(listings, packed);
try {
await load_as_player(dir);
} finally {
Deno.removeSync(dir, { recursive: true });
}
return (id: string) => item_tooltip(new ItemStack(id)).map((line) => line.text);
}