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
+2 -2
View File
@@ -187,7 +187,7 @@ function loot_mod(dir: string) {
name: "Test Loot",
version: "1.0.0",
dependencies: [{ id: "bworld", version: "*" }],
scripts: { server: "scripts/server.ts" },
main: "scripts/server.ts",
});
for (const id of ["gem", "charm"]) {
write(`items/${id}.json`, { format_version: 1, item: { id: `testloot:${id}`, texture: `testloot:${id}` } });
@@ -233,7 +233,7 @@ function loot_mod(dir: string) {
Deno.writeTextFileSync(
`${mod}/scripts/server.ts`,
`import type { ServerContext } from "cubi/server";
export function setup(ctx: ServerContext) {
export function server(ctx: ServerContext) {
ctx.loot.register_condition("testloot:high", (_params, context) => (context.position?.y ?? 0) > 120);
ctx.loot.register_function("testloot:double", (item) => ({ ...item, count: item.count * 2 }));
ctx.loot.modify("testloot:chests/treasure", (items) => { items.push({ id: "testloot:charm", count: 1 }); });