Fill on serverworld and clear out tiles on new day
This commit is contained in:
@@ -67,14 +67,18 @@ function placed(plan: InteriorPlan) {
|
||||
Deno.test("an interior has as many rooms as it's asked for when there's room, starting from main", () => {
|
||||
const { tiles } = plan("rooms");
|
||||
assertEquals(tiles.length, 30);
|
||||
assertEquals(tiles[0], { tile: "test:main", position: { x: 100, y: 50, z: -20 }, rotation: 0 });
|
||||
const { tile, position, rotation } = tiles[0];
|
||||
assertEquals({ tile, position, rotation }, { tile: "test:main", position: { x: 100, y: 50, z: -20 }, rotation: 0 });
|
||||
assertEquals(tiles.filter((tile) => tile.tile === "test:main").length, 1);
|
||||
});
|
||||
|
||||
Deno.test("rooms only share their outer walls", () => {
|
||||
for (const seed of ["a", "b", "c", "d", "e"]) {
|
||||
const tiles = placed(plan(seed));
|
||||
const result = plan(seed);
|
||||
const tiles = placed(result);
|
||||
for (let i = 0; i < tiles.length; i++) {
|
||||
// the box the plan keeps is the one its schematic covers
|
||||
assertEquals(result.tiles[i].box, { min: tiles[i].min, max: tiles[i].max });
|
||||
for (let j = i + 1; j < tiles.length; j++) {
|
||||
const [a, b] = [tiles[i], tiles[j]];
|
||||
const inside = [0, 1, 2].every((axis) => a.min[axis] < b.max[axis] && b.min[axis] < a.max[axis]);
|
||||
|
||||
Reference in New Issue
Block a user