Allow for textures that aren't 16x16

This commit is contained in:
2026-09-28 16:20:37 -03:00
parent 52ef4e5ca6
commit fe149bb9ad
18 changed files with 268 additions and 136 deletions
+6 -1
View File
@@ -1,5 +1,6 @@
import { assert, assertEquals, assertThrows } from "@std/assert";
import { check_mods } from "$/tools/check_mods.ts";
import { MAX_TEXTURE_SIZE } from "$/common/constants.ts";
import { create_mod } from "$/tools/new_mod.ts";
function temp_mods_dir() {
@@ -92,7 +93,11 @@ Deno.test("check-mods finds broken mods", async () => {
},
});
// wrong texture size
Deno.copyFileSync("assets/sprites/gui.png", `${mod}/textures/huge.png`);
const huge = new Uint8Array(24);
huge.set([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
new DataView(huge.buffer).setUint32(16, MAX_TEXTURE_SIZE + 1);
new DataView(huge.buffer).setUint32(20, 16);
Deno.writeFileSync(`${mod}/textures/huge.png`, huge);
// a script that doesn't typecheck
Deno.writeTextFileSync(`${mod}/scripts/client.ts`, "export function setup(ctx: number) { ctx.nope(); }\n");
// a dependency that isn't installed, and no longer depending on bworld