Single module modding
This commit is contained in:
@@ -14,7 +14,7 @@ import { load_and_check } from "@/tools/check_mods.ts";
|
||||
import { pack_mod } from "@/tools/pack_mod.ts";
|
||||
import { copy_dir, test_game } from "./helpers.ts";
|
||||
|
||||
// testfluids: a manifest, the given fluids/ files by file name, and maybe a shared script and an item for it to read
|
||||
// testfluids: a manifest, the given fluids/ files by file name, and maybe a shared phase and an item for it to read
|
||||
function fluid_mod(dir: string, fluids: Record<string, unknown>, shared_script?: string) {
|
||||
const mod = `${dir}/testfluids`;
|
||||
const write = (path: string, json: unknown) => {
|
||||
@@ -26,7 +26,7 @@ function fluid_mod(dir: string, fluids: Record<string, unknown>, shared_script?:
|
||||
id: "testfluids",
|
||||
name: "Test Fluids",
|
||||
version: "1.0.0",
|
||||
...(shared_script && { scripts: { shared: "scripts/shared.ts" } }),
|
||||
...(shared_script && { main: "scripts/shared.ts" }),
|
||||
});
|
||||
for (const [file, fluid] of Object.entries(fluids)) write(`fluids/${file}`, { format_version: 1, fluid });
|
||||
if (shared_script) {
|
||||
@@ -66,7 +66,7 @@ Deno.test("a fluid with a bad color fails loading", async () => {
|
||||
// syrup is named after the tree in its data and has the color its data says, sap has no rules
|
||||
const RULES = `
|
||||
import type { SharedContext } from "cubi/shared";
|
||||
export function setup(ctx: SharedContext) {
|
||||
export function shared(ctx: SharedContext) {
|
||||
ctx.fluids.register("testfluids:syrup", {
|
||||
name: (data: any) => data?.tree && ctx.items.name(data.tree) + " Syrup",
|
||||
color: (data: any) => data?.color,
|
||||
|
||||
Reference in New Issue
Block a user