Dangerous business
This commit is contained in:
@@ -54,8 +54,9 @@ export class EverythingRegistry {
|
||||
return this.#id_to_value.get(registry)?.[id] as T;
|
||||
}
|
||||
|
||||
// empty for a registry nothing has been added to, like blocks in a game whose mods have none
|
||||
static get_registry<T>(registry: string): T[] {
|
||||
return this.#id_to_value.get(registry) as T[];
|
||||
return (this.#id_to_value.get(registry) ?? []) as T[];
|
||||
}
|
||||
|
||||
// forget everything, for tests that load mods more than once
|
||||
|
||||
+3
-2
@@ -159,7 +159,8 @@ export function registered_ids(mods: LoadedMod[]): Record<TagRegistry, Set<strin
|
||||
|
||||
// engine_textures are the cubi: texture ids, for telling whether a texture a mod uses exists
|
||||
export function check_references(mods: LoadedMod[], engine_textures: Iterable<string>) {
|
||||
const block_owners = new Map<string, string[]>();
|
||||
// air is the engine's, so worldgen and place_on can name it like any block
|
||||
const block_owners = new Map<string, string[]>([["cubi:air", ["cubi"]]]);
|
||||
const item_owners = new Map<string, string[]>();
|
||||
const model_owners = new Map<string, string[]>();
|
||||
const model_parents = new Map<string, string>();
|
||||
@@ -303,7 +304,7 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
|
||||
}
|
||||
}
|
||||
for (const id of [...(json.place_on ?? []), ...(json.place_in ?? [])]) {
|
||||
if (id !== "cubi:air") uses(file, id, "block");
|
||||
uses(file, id, "block");
|
||||
}
|
||||
}
|
||||
for (const { file, json } of mod.models) {
|
||||
|
||||
Reference in New Issue
Block a user