More pathing

This commit is contained in:
2026-11-21 14:21:02 -03:00
parent 0f58a9cbfe
commit 357f8f2bd4
8 changed files with 314 additions and 24 deletions
+20
View File
@@ -33,6 +33,9 @@ import type { Face, SharedWorld } from "@/common/mod_api/shared.ts";
import { shared as setup_shared } from "@/mods/bworld/scripts/shared.ts";
import { shared_context } from "@/common/shared_context.ts";
import { RecipeBook } from "@/common/mod_loader.ts";
import type { EntityJson } from "@/common/mod_data.ts";
import { mod_entity_factory } from "@/server/game/entity/mod_entity.ts";
import type { Mob } from "@/server/game/entity/mob.ts";
// the repo's own mods/, read once: reading and checking every mod's files is most of starting a game in a test. only
// mods/ is kept, since tests change the temporary folders they make between games
@@ -445,3 +448,20 @@ export function client_of(game: GameServer, area: Area) {
blocks: () => blocks_in(area, (x, y, z) => at(x, y, z)!),
};
}
// a mob made straight from entity json fields, with no goals, so it only does what a test makes it do. 0.6 wide and
// 1.8 tall unless fields say otherwise, with its feet at x y z
export function test_mob(game: GameServer, fields: Partial<EntityJson>, x: number, y: number, z: number): Mob {
const json: EntityJson = {
id: "test:mob",
texture: "cubi:missing",
behavior: "test:still",
width: 0.6,
height: 1.8,
...fields,
};
const mob = mod_entity_factory(json, new Map([["test:still", () => {}]]))(game.entities) as Mob;
mob.set_position(x, y, z);
game.entities.add_entity(mob);
return mob;
}