Deno compile
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
"pack-mod": "deno run --allow-read --allow-write --allow-run --allow-env tools/pack_mod.ts",
|
||||
"test": "deno test --allow-read --allow-write --allow-run --allow-net tests/",
|
||||
"bench": "deno bench --allow-read --allow-write --allow-run tests/",
|
||||
"desktop": "deno run --unstable-webgpu --allow-read --allow-write --allow-net --allow-ffi --allow-env=CUBI_SERVER,CUBI_CLIENT_UPDATES,HOME,USERPROFILE,APPDATA,XDG_DATA_HOME desktop/main.ts"
|
||||
"desktop": "deno run --unstable-webgpu --allow-read --allow-write --allow-net --allow-ffi --allow-env=CUBI_SERVER,CUBI_CLIENT_UPDATES,HOME,USERPROFILE,APPDATA,XDG_DATA_HOME desktop/main.ts",
|
||||
"compile": "deno run -A build.ts --once && deno compile --unstable-webgpu --allow-read --allow-write --allow-net --allow-ffi --allow-env=CUBI_SERVER,CUBI_CLIENT_UPDATES,HOME,USERPROFILE,APPDATA,XDG_DATA_HOME --include build --include server_mods --include server/game/worker.ts --include server/game/worldgen_worker.ts --include server/content_worker.ts --include desktop/config.json --output dist/cubi desktop/main.ts"
|
||||
},
|
||||
"compilerOptions": {
|
||||
"lib": ["dom", "dom.asynciterable", "dom.iterable", "deno.ns", "deno.unstable", "deno.webgpu"]
|
||||
|
||||
+21
-3
@@ -26,11 +26,28 @@ try {
|
||||
console.error(`No sound: ${(e as Error).message}`);
|
||||
}
|
||||
|
||||
const app = desktop_app((message) => {
|
||||
// the app can't go on. it says why in a message box, a packaged app has no terminal to read it in
|
||||
function fail(message: string) {
|
||||
console.error(message);
|
||||
game_window.show_error("bworld", `The singleplayer world stopped: ${message}`);
|
||||
game_window.set_grabbed(false);
|
||||
game_window.show_error("bworld", message);
|
||||
audio?.close();
|
||||
game_window.close();
|
||||
Deno.exit(1);
|
||||
}
|
||||
|
||||
// an error nothing caught, even a throw while starting, ends the app through fail. ending deno with it instead unloads
|
||||
// openal while its thread still plays, which crashes before the error is printed
|
||||
addEventListener("error", (event) => {
|
||||
event.preventDefault();
|
||||
fail(String(event.error?.stack ?? event.message));
|
||||
});
|
||||
addEventListener("unhandledrejection", (event) => {
|
||||
event.preventDefault();
|
||||
fail(String(event.reason?.stack ?? event.reason));
|
||||
});
|
||||
|
||||
const app = desktop_app((message) => fail(`The singleplayer world stopped: ${message}`));
|
||||
|
||||
const server = Deno.serve(
|
||||
{ hostname: "127.0.0.1", port: 0, onListen() {} },
|
||||
@@ -65,7 +82,8 @@ async function start_client(page: URL) {
|
||||
});
|
||||
worker.onmessage = (event: MessageEvent<ClientMessage>) => handle(event.data);
|
||||
worker.onerror = (event) => {
|
||||
console.error(`The client stopped: ${event.message}`);
|
||||
event.preventDefault();
|
||||
fail(`The client stopped: ${event.message}`);
|
||||
};
|
||||
client = worker;
|
||||
send({
|
||||
|
||||
@@ -431,7 +431,6 @@ saved before any of this plays exactly the same.
|
||||
- **Importing Minecraft's terrain.** Datapacks' noise settings assume a world from -64 to 320 and Minecraft's noises.
|
||||
The formats are close enough that an importer could translate them, but the result wouldn't look like Minecraft's. Not
|
||||
a goal for now.
|
||||
- **Generation's loose ends.** The desktop app isn't packaged yet, and a package will need the worldgen worker in it. In
|
||||
a world without land, the spawn search looks 32 chunks out on the game thread, which the server now does at startup.
|
||||
Saved chunks are read on the game thread, which waits for the host (see `read_chunk` in `server/game/worker.ts`): much
|
||||
faster than generating them, but Minecraft reads them ahead instead.
|
||||
- **Generation's loose ends.** In a world without land, the spawn search looks 32 chunks out on the game thread, which
|
||||
the server now does at startup. Saved chunks are read on the game thread, which waits for the host (see `read_chunk`
|
||||
in `server/game/worker.ts`): much faster than generating them, but Minecraft reads them ahead instead.
|
||||
|
||||
Reference in New Issue
Block a user