Double steel pipes model
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// dangerous business's placement components: slabs and other blocks that go in the top or bottom half, blocks that
|
||||
// join the same block beside them, and blocks that pick some of their looks when placed. and the death block
|
||||
// join the same block beside them, blocks that pick some of their looks when placed, and pipes that stand up or lie
|
||||
// down. and the death block
|
||||
import { assert, assertEquals, assertNotEquals } from "@std/assert";
|
||||
import { ItemStack } from "@/common/inventory.ts";
|
||||
import { get_state_value } from "@/common/utils.ts";
|
||||
@@ -13,6 +14,7 @@ const CONNECTS = "dangerous_business:floor_grate";
|
||||
const RANDOM_LOOK = "dangerous_business:water_puddle";
|
||||
const FLOOR = "dangerous_business:concrete_floor";
|
||||
const DEATH = "dangerous_business:death";
|
||||
const PIPE = "dangerous_business:double_steel_pipes";
|
||||
|
||||
// alice on a concrete floor at y 100, south of 0 100 0 and looking north, holding each of the blocks. it's a game of
|
||||
// its own, which tests playing mods/ leave out
|
||||
@@ -28,7 +30,7 @@ async function setup() {
|
||||
}
|
||||
}
|
||||
t.send(1, { type: "move", x: 0.5, y: 100, z: 3.5, yaw: 0, pitch: 0 });
|
||||
for (const id of [HALF, CONNECTS, RANDOM_LOOK]) t.send(1, { type: "chat", text: `/give ${id} 64` });
|
||||
for (const id of [HALF, CONNECTS, RANDOM_LOOK, PIPE]) t.send(1, { type: "chat", text: `/give ${id} 64` });
|
||||
const hold = (slot: number) => t.send(1, { type: "select_slot", slot });
|
||||
const state = (x: number, y: number, z: number, name: string) =>
|
||||
get_state_value(t.game.world.get_block_value(x, y, z), t.game.world.get_block_info(x, y, z)!, name);
|
||||
@@ -51,6 +53,21 @@ Deno.test("a half block goes in the top half against the underside of a block or
|
||||
assertEquals(state(-1, 102, -1, "half"), 0);
|
||||
});
|
||||
|
||||
Deno.test("a pipe stands up on top of a block and lies along the way it was placed against a side", async () => {
|
||||
const { t, hold, state } = await setup();
|
||||
hold(3);
|
||||
t.send(1, { type: "use_block", x: 0, y: 99, z: 0, face: "top", hit: [0.5, 1, 0.5] });
|
||||
assertEquals(state(0, 100, 0, "horizontal"), 0);
|
||||
|
||||
t.game.set_block(0, 101, -2, FLOOR);
|
||||
t.send(1, { type: "use_block", x: 0, y: 101, z: -2, face: "east", hit: [1, 0.5, 0.5] });
|
||||
assertEquals(state(1, 101, -2, "horizontal"), 1);
|
||||
assertEquals(state(1, 101, -2, "facing"), 1);
|
||||
t.send(1, { type: "use_block", x: 0, y: 101, z: -2, face: "south", hit: [0.5, 0.5, 1] });
|
||||
assertEquals(state(0, 101, -1, "horizontal"), 1);
|
||||
assertEquals(state(0, 101, -1, "facing"), 2);
|
||||
});
|
||||
|
||||
Deno.test("a connecting block joins the same block beside it, and parts when it's gone", async () => {
|
||||
const { t, hold, state } = await setup();
|
||||
hold(1);
|
||||
|
||||
Reference in New Issue
Block a user