Single module modding

This commit is contained in:
2026-11-14 12:18:41 -03:00
parent 605008f584
commit 313098892e
134 changed files with 919 additions and 924 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
// SPDX-License-Identifier: AGPL-3.0-or-later
// what machines do to the world through server scripts: read which way water flows, find items lying around and
// what machines do to the world through server phases: read which way water flows, find items lying around and
// change them, push things, break blocks over time, and use items on blocks like a player would
import { assert, assertEquals, assertThrows } from "@std/assert";
import type { ServerContext } from "cubi/server";
@@ -11,7 +11,7 @@ import { copy_dir, stone_floor, test_game } from "./helpers.ts";
// hands the test its context, and has a block that says who right clicked it and an item that gives a stick when used
const SERVER_SCRIPT = `
import type { ServerContext } from "cubi/server";
export function setup(ctx: ServerContext) {
export function server(ctx: ServerContext) {
(globalThis as any).machines_ctx = ctx;
ctx.components.register_block("testmod:button", {
on_interact(block, _params, player) {
@@ -39,7 +39,7 @@ async function setup() {
name: "Test",
version: "1.0.0",
dependencies: [{ id: "bworld", version: "*" }],
scripts: { server: "scripts/server.ts" },
main: "scripts/server.ts",
});
write("blocks/button.json", {
format_version: 1,