Send chunks to players connected to server
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import type { BlockRegistry } from "$/common/everything_registry.ts";
|
||||
import type { SpriteRegion } from "$/common/constants.ts";
|
||||
import type { OreJson } from "$/common/mod_data.ts";
|
||||
import type { ModelJson } from "$/common/block_models.ts";
|
||||
import type { SortType } from "./translucent_sort.ts";
|
||||
|
||||
@@ -29,16 +28,11 @@ export type ToChunkWorker =
|
||||
type: "init";
|
||||
// the blocks registry without its functions, indexed by numeric id
|
||||
blocks_registry: BlockRegistry[];
|
||||
block_ids: Record<string, number>;
|
||||
// mods' block models by id, the engine's are built in
|
||||
models: Record<string, ModelJson>;
|
||||
textures_info: Record<string, SpriteRegion>;
|
||||
image: { width: number; height: number };
|
||||
// mods' worldgen scripts and ores, so generation matches the server
|
||||
worldgen_scripts: { mod: string; url: string }[];
|
||||
ores: OreJson[];
|
||||
}
|
||||
| { type: "generate"; chunk_x: number; chunk_z: number; seed: string }
|
||||
| {
|
||||
type: "mesh";
|
||||
chunk_x: number;
|
||||
@@ -46,7 +40,7 @@ export type ToChunkWorker =
|
||||
version: number;
|
||||
// copies of the blocks of the 3x3 chunks around it, going +x then +z from -x -z, for lighting
|
||||
chunks: (Uint32Array | null)[];
|
||||
// the same chunks' biome colors (see "generated"), blended across their edges
|
||||
// the same chunks' biome colors (see Chunk.biome_colors in client_level.ts), blended across their edges
|
||||
biome_colors: (Uint32Array | null)[];
|
||||
// where the camera is, to sort the translucent quads
|
||||
camera: number[];
|
||||
@@ -70,16 +64,6 @@ export interface LayerMesh {
|
||||
}
|
||||
|
||||
export type FromChunkWorker =
|
||||
| {
|
||||
type: "generated";
|
||||
chunk_x: number;
|
||||
chunk_z: number;
|
||||
blocks: Uint32Array;
|
||||
// blocks that landed in other chunks (from features like a mod's trees), flattened as x, y, z, numeric id
|
||||
spills: Int32Array;
|
||||
// each column's biome grass color as 0xRRGGBB, x then z, then each column's foliage color
|
||||
biome_colors: Uint32Array;
|
||||
}
|
||||
| {
|
||||
type: "meshed";
|
||||
chunk_x: number;
|
||||
|
||||
Reference in New Issue
Block a user