Remove duplicate code

This commit is contained in:
2026-10-13 11:57:43 -03:00
parent dfc6a6d77b
commit 5165698fe3
50 changed files with 307 additions and 812 deletions
+2 -3
View File
@@ -10,7 +10,7 @@ import { block_variant } from "$/common/block_models.ts";
import { load_worldgen } from "$/common/worldgen_loader.ts";
import { create_mod } from "$/tools/new_mod.ts";
import { PLAYER_MENU_CRAFTING, PROTOCOL_VERSION } from "$/common/protocol.ts";
import { copy_dir, test_game } from "./helpers.ts";
import { container_items, copy_dir, test_game } from "./helpers.ts";
// mods/bworld plus a mod made from the template, in a temp folder
function mods_with_template() {
@@ -22,8 +22,7 @@ function mods_with_template() {
// deno-lint-ignore no-explicit-any
type Msg = any;
const inventory_of = (messages: Msg[]) =>
messages.filter((m) => m.type === "container" && m.container === "inventory").at(-1)?.items ?? [];
const inventory_of = (messages: Msg[]) => container_items(messages, "inventory") ?? [];
Deno.test("the base game loads from mods/bworld", async () => {
const { game } = await test_game("mods");