Fly command
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user