Change imports

This commit is contained in:
2026-11-04 21:51:26 -03:00
parent 98fa45ebd1
commit ba4b2a8798
270 changed files with 994 additions and 994 deletions
+7 -7
View File
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
// SPDX-License-Identifier: AGPL-3.0-or-later
// engine access: hooks on the engine's own methods, like neoforge's mixins, and the global the bworld/engine shim reads.
// engine access: hooks on the engine's own methods, like neoforge's mixins, and the global the cubi/engine shim reads.
// see docs/modding/misc/engine.md and docs/modding_plan.md
import { GAME_VERSION } from "./constants.ts";
@@ -199,7 +199,7 @@ export function clear_hooks() {
hooked.clear();
}
// runs fn as the mod: hook knows whose hooks it makes, and bworld/engine refuses mods without engine_access
// runs fn as the mod: hook knows whose hooks it makes, and cubi/engine refuses mods without engine_access
export async function loading_mod<T>(mod: string, engine_access: boolean, fn: () => Promise<T>): Promise<T> {
const previous = loading;
loading = { mod, engine_access };
@@ -217,7 +217,7 @@ export interface EngineModules {
client?: Record<string, unknown>;
}
// what bworld/engine reads, see common/mod_api/engine.ts
// what cubi/engine reads, see common/mod_api/engine.ts
export interface EngineGlobal {
version: string;
engine: EngineModules;
@@ -226,9 +226,9 @@ export interface EngineGlobal {
check_access(): void;
}
export const ENGINE_GLOBAL = "__bworld_engine";
export const ENGINE_GLOBAL = "__cubi_engine";
// puts a side's modules where bworld/engine finds them. a realm with the server and a client in it, like tests, gets
// puts a side's modules where cubi/engine finds them. a realm with the server and a client in it, like tests, gets
// both
export function expose_engine(modules: EngineModules) {
const global = globalThis as unknown as Record<string, EngineGlobal | undefined>;
@@ -242,9 +242,9 @@ export function expose_engine(modules: EngineModules) {
engine: { ...modules },
hook,
check_access() {
if (!loading) throw new Error("bworld/engine can only be imported by a mod's script");
if (!loading) throw new Error("cubi/engine can only be imported by a mod's script");
if (!loading.engine_access) {
throw new Error(`${loading.mod} imports bworld/engine without "engine_access" in its manifest`);
throw new Error(`${loading.mod} imports cubi/engine without "engine_access" in its manifest`);
}
},
};