Add all textures and models from create

This commit is contained in:
2026-10-12 18:47:41 -03:00
parent d4eff11f3e
commit 99bdcaeffc
3775 changed files with 66614 additions and 58 deletions
+12 -1
View File
@@ -12,8 +12,19 @@ import { decode_level_chunk } from "$/common/chunk_streaming.ts";
import { CHUNK_AREA, CHUNK_SIZE, ID_MASK } from "$/common/constants.ts";
import type { SavedChunk, SavedChunks, WorldSave } from "$/server/game/saves.ts";
// mods straight from their source folders, skipping the build: scripts are imported as typescript
// the repo's own mods/, read once: reading and checking every mod's files is most of starting a game in a test. only
// mods/ is kept, since tests change the temporary folders they make between games
let repo_mods: ServerModSource[] | undefined;
// mods straight from their source folders, skipping the build: scripts are imported as typescript. each call gets its
// own copy, so a test that changes what it got can't change another test's
export function mod_sources(mods_dir: string): ServerModSource[] {
if (resolve(mods_dir) !== resolve("mods")) return read_mod_sources(mods_dir);
repo_mods ??= read_mod_sources(mods_dir);
return structuredClone(repo_mods);
}
function read_mod_sources(mods_dir: string): ServerModSource[] {
const mods = load_and_check(mods_dir);
const errors = mods.flatMap((mod) => mod.report.errors.map((e) => `${mod.id}: ${e}`));
if (errors.length) throw new Error(errors.join("\n"));