Proper directional blocks
This commit is contained in:
@@ -41,6 +41,18 @@ Deno.test("the board faces whoever placed it", async () => {
|
||||
assertEquals((await setup(-Math.PI / 2)).state("facing"), 3);
|
||||
});
|
||||
|
||||
Deno.test("so does any block with a facing state, like the furnace, keeping its other states", async () => {
|
||||
const t = await setup(Math.PI / 2);
|
||||
const at = [0, 100, 2] as const;
|
||||
t.send(1, { type: "chat", text: "/give bworld:furnace" });
|
||||
t.send(1, { type: "select_slot", slot: 0 });
|
||||
t.send(1, { type: "use_block", x: at[0], y: at[1] - 1, z: at[2], face: "top" });
|
||||
const info = t.game.world.get_block_info(...at)!;
|
||||
assertEquals(info.id, "bworld:furnace");
|
||||
assertEquals(get_state_value(t.game.world.get_block_value(...at), info, "facing"), 1);
|
||||
assertEquals(get_state_value(t.game.world.get_block_value(...at), info, "lit"), 0);
|
||||
});
|
||||
|
||||
Deno.test("a stack goes on the board, and a knife cuts one at a time by its recipe", async () => {
|
||||
const t = await setup();
|
||||
t.send(1, { type: "chat", text: "/give bworld:cod 3" });
|
||||
|
||||
@@ -247,4 +247,8 @@ Deno.test("a lit furnace shows its lit front", async () => {
|
||||
const front = (lit: number) => (block_variant(furnace, { lit }).textures as Record<string, string>).front;
|
||||
assertEquals(front(0), "bworld:furnace_front");
|
||||
assertEquals(front(1), "bworld:furnace_front_lit");
|
||||
// turned and lit at once: each comes from the first variant that sets it
|
||||
const variant = block_variant(furnace, { lit: 1, facing: 3 });
|
||||
assertEquals((variant.textures as Record<string, string>).front, "bworld:furnace_front_lit");
|
||||
assertEquals(variant.y, 270);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user