Add all textures and models from create
This commit is contained in:
+12
-1
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user