18 lines
713 B
TypeScript
18 lines
713 B
TypeScript
import { test_game } from "../helpers.ts";
|
|
Deno.test("kb", async () => {
|
|
const t = await test_game("mods");
|
|
t.join(1, "alice");
|
|
t.join(2, "bob");
|
|
for (let x = -8; x <= 8; x++) for (let z = -8; z <= 8; z++) t.game.set_block(x, 99, z, "bworld:stone");
|
|
t.send(1, { type: "move", x: 0.5, y: 100, z: 0.5, yaw: 0, pitch: 0 });
|
|
t.send(2, { type: "move", x: 0.5, y: 100, z: 2.5, yaw: 0, pitch: 0 });
|
|
t.game.tick();
|
|
t.take(2);
|
|
const bob = t.game.players()[1];
|
|
console.log("on_ground", bob.on_ground);
|
|
t.send(1, { type: "attack_entity", id: bob.id });
|
|
console.log("v after hurt", bob.vx, bob.vy, bob.vz, "health", bob.health);
|
|
t.game.tick();
|
|
console.log(t.take(2).filter((m) => m.type === "set_motion"));
|
|
});
|