Single module modding
This commit is contained in:
@@ -28,7 +28,7 @@ const HALF = {
|
||||
};
|
||||
|
||||
// testmod: a shaft with an axis state and a model of half of one, syrup, a jar drawn with the syrup in it, and maybe a
|
||||
// client script
|
||||
// client phase
|
||||
function write_testmod(dir: string, client_script?: string) {
|
||||
const mod = `${dir}/testmod`;
|
||||
for (const folder of ["blocks", "models", "scripts", "fluids", "items"]) {
|
||||
@@ -40,7 +40,7 @@ function write_testmod(dir: string, client_script?: string) {
|
||||
id: "testmod",
|
||||
name: "Test",
|
||||
version: "1.0.0",
|
||||
...(client_script && { scripts: { client: "scripts/client.ts" } }),
|
||||
...(client_script && { main: "scripts/client.ts" }),
|
||||
});
|
||||
write("blocks/shaft.json", {
|
||||
format_version: 1,
|
||||
@@ -473,7 +473,7 @@ Deno.test({
|
||||
},
|
||||
});
|
||||
|
||||
Deno.test("client scripts register visuals during setup, for blocks that exist", async () => {
|
||||
Deno.test("client phases register visuals during setup, for blocks that exist", async () => {
|
||||
const load = async (script: string) => {
|
||||
const dir = Deno.makeTempDirSync({ prefix: "bworld_visuals_" });
|
||||
write_testmod(dir, script);
|
||||
@@ -486,7 +486,7 @@ Deno.test("client scripts register visuals during setup, for blocks that exist",
|
||||
};
|
||||
await load(`
|
||||
import type { ClientContext } from "cubi/client";
|
||||
export function setup(ctx: ClientContext) {
|
||||
export function client(ctx: ClientContext) {
|
||||
ctx.render.register_visual("testmod:shaft", (_block, instances) => {
|
||||
instances.rotating();
|
||||
return {};
|
||||
@@ -500,7 +500,7 @@ Deno.test("client scripts register visuals during setup, for blocks that exist",
|
||||
() =>
|
||||
load(`
|
||||
import type { ClientContext } from "cubi/client";
|
||||
export function setup(ctx: ClientContext) {
|
||||
export function client(ctx: ClientContext) {
|
||||
ctx.render.register_visual("testmod:gear", () => ({}));
|
||||
}
|
||||
`),
|
||||
|
||||
Reference in New Issue
Block a user