Make players mobs too !

This commit is contained in:
2026-09-30 10:42:52 -03:00
parent 65f27d6099
commit 4fbcca6851
23 changed files with 314 additions and 132 deletions
+17
View File
@@ -0,0 +1,17 @@
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"));
});