placeschematic command

This commit is contained in:
2026-11-21 09:16:51 -03:00
parent c4eda256a1
commit 04c9511b6c
4 changed files with 41 additions and 1 deletions
+14
View File
@@ -259,6 +259,20 @@ Deno.test("blocks that aren't registered are left out of a schematic, and the re
assertEquals(t.game.world.get_block_id(5, 101, 5), "bworld:oak_planks");
});
Deno.test("/placeschematic places a registered schematic with its lowest corner at x y z", async () => {
const t = await place_setup();
t.join(1, "alice");
t.take(1);
t.send(1, { type: "chat", text: "/placeschematic testmod:post 3 100 4" });
assertEquals(t.game.world.get_block_id(3, 100, 4), "bworld:oak_log");
assertEquals(t.game.world.get_block_id(3, 101, 4), "bworld:oak_log");
t.take(1);
t.send(1, { type: "chat", text: "/placeschematic testmod:nothing 3 100 4" });
const chat = t.take(1).filter((m: Msg) => m.type === "chat").map((m: Msg) => m.text as string);
assert(chat.some((text) => text.includes("no schematic testmod:nothing")), chat.join("\n"));
});
Deno.test("get gives a copy of a registered schematic with its id, a file's or a script's", async () => {
const t = await place_setup();
const hut = t.schematics.get("testmod:hut")!;