Change default view distance to 16 and add /viewdistance command
This commit is contained in:
@@ -130,3 +130,15 @@ Deno.test("block changes only go to players who have the chunk, the others get t
|
||||
const chunk = decode_level_chunk(game.world.level_chunk(0, 0));
|
||||
assertEquals(chunk.blocks[120 * CHUNK_AREA + 5 * CHUNK_SIZE + 3], game.world.get_block_value(3, 120, 5));
|
||||
});
|
||||
|
||||
Deno.test("/viewdistance caps every player's view distance, and raising it gives them what they asked for", async () => {
|
||||
const t = await test_game("mods");
|
||||
t.join(1, "alice");
|
||||
const player = t.game.players()[0];
|
||||
t.send(1, { type: "view_distance", distance: 12 });
|
||||
assertEquals(player.chunks.view_distance, 12);
|
||||
t.send(1, { type: "chat", text: "/viewdistance 4" });
|
||||
assertEquals([t.game.view_distance, player.chunks.view_distance], [4, 4]);
|
||||
t.send(1, { type: "chat", text: "/viewdistance 32" });
|
||||
assertEquals([t.game.view_distance, player.chunks.view_distance], [32, 12]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user