Rename bmod to just mod
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// animated textures: textures/<name>.json, carrying it through .bmod files, and playing it a tick at a time
|
||||
// animated textures: textures/<name>.json, carrying it through .cubi files, and playing it a tick at a time
|
||||
import { assertEquals, assertThrows } from "@std/assert";
|
||||
import { zipSync } from "fflate";
|
||||
import { read_bmod, texture_size_problem } from "@/common/bmod.ts";
|
||||
import { read_mod, texture_size_problem } from "@/common/mod.ts";
|
||||
import { texture_animation, validate_texture_json } from "@/common/texture_animation.ts";
|
||||
import { AnimatedTexture } from "@/client/texture_animations.ts";
|
||||
import { load_and_check } from "@/tools/check_mods.ts";
|
||||
@@ -70,7 +70,7 @@ Deno.test("an animated texture's frames have to fit the size limit, not its whol
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test("a texture's .json is checked, packed into the .bmod and read back", async () => {
|
||||
Deno.test("a texture's .json is checked, packed into the .cubi and read back", async () => {
|
||||
const sources = Deno.makeTempDirSync({ prefix: "bworld_anim_src_" });
|
||||
copy_dir("mods/bworld", `${sources}/bworld`);
|
||||
create_mod("lava_lamps", "Lava Lamps", sources);
|
||||
@@ -83,8 +83,8 @@ Deno.test("a texture's .json is checked, packed into the .bmod and read back", a
|
||||
const lamps = () => load_and_check(sources).find((m) => m.id === "lava_lamps")!;
|
||||
const mod = lamps();
|
||||
assertEquals(mod.report.errors, []);
|
||||
const bmod = read_bmod(await pack_mod(mod), "lava_lamps.bmod");
|
||||
assertEquals([...bmod.texture_json!], [["lava_lamps:lamps_goo", json]]);
|
||||
const packed = read_mod(await pack_mod(mod), "lava_lamps.cubi");
|
||||
assertEquals([...packed.texture_json!], [["lava_lamps:lamps_goo", json]]);
|
||||
|
||||
// a .json without its png, or one that doesn't fit it, is an error
|
||||
Deno.writeTextFileSync(`${textures}/stray.json`, JSON.stringify(json));
|
||||
@@ -103,14 +103,14 @@ Deno.test("a texture's .json is checked, packed into the .bmod and read back", a
|
||||
const manifest = { format_version: 1, id: "broken", name: "Broken", version: "1.0.0" };
|
||||
assertThrows(
|
||||
() =>
|
||||
read_bmod(
|
||||
read_mod(
|
||||
zipSync({
|
||||
"manifest.json": text(manifest),
|
||||
"data.json": text({}),
|
||||
"textures/goo.png": png_header(16, 32),
|
||||
"textures/goo.json": text({ animation: { frames: [2] } }),
|
||||
}),
|
||||
"broken.bmod",
|
||||
"broken.cubi",
|
||||
),
|
||||
Error,
|
||||
"textures/goo.json: animation.frames[0] isn't one of the png's frames, 0 to 1",
|
||||
|
||||
Reference in New Issue
Block a user