Engine api

This commit is contained in:
2026-10-06 20:27:17 -03:00
parent d13938550d
commit 69c5c187db
27 changed files with 1026 additions and 90 deletions
+5
View File
@@ -28,6 +28,7 @@ import {
validate_tag,
} from "./mod_data.ts";
import type { ModData } from "./mod_loader.ts";
import { ENGINE_GLOBAL } from "./hooks.ts";
export const BMOD_EXTENSION = ".bmod";
@@ -169,6 +170,10 @@ export function read_bmod(bytes: Uint8Array, file: string): Bmod {
scripts[side as ScriptSide] = code;
}
}
// what the bworld/engine shim reads, so it's in the bundle of every script that imports it
if (!manifest.engine_access && Object.values(scripts).some((code) => code.includes(ENGINE_GLOBAL))) {
problems.push(`a script uses bworld/engine, which needs "engine_access": true in manifest.json`);
}
const credits = manifest.credits === undefined ? undefined : text(manifest.credits);
if (manifest.credits !== undefined && credits === undefined) {
problems.push(`manifest.json: credits ${manifest.credits} isn't in the file`);