Fly command

This commit is contained in:
2026-10-02 18:45:08 -03:00
parent 043c526c9c
commit a4fec0681f
7 changed files with 69 additions and 6 deletions
+14
View File
@@ -223,3 +223,17 @@ Deno.test("/tp x y z teleports you there", async () => {
t.send(1, { type: "chat", text: "/tp 10 120.5 -3" });
assertEquals([t.player.x, t.player.y, t.player.z], [10, 120.5, -3]);
});
Deno.test("/fly toggles flying, which is sent to the player, and flying doesn't fall", async () => {
const t = await setup();
t.take(1);
t.send(1, { type: "chat", text: "/fly" });
assert(t.player.flying);
t.game.tick();
assert(t.take(1).some((m: Msg) => m.type === "flying" && m.flying), "the player hears they fly");
t.move(110);
for (let y = 109; y >= 100; y--) t.move(y);
assertEquals(t.player.health, MAX_HEALTH);
t.send(1, { type: "chat", text: "/fly" });
assert(!t.player.flying);
});