refactor(server): drop unused synchronous get_chunk path
This commit is contained in:
parent
e6895de451
commit
12390d3008
|
|
@ -30,8 +30,6 @@ pub struct StreamStats {
|
||||||
/// The server's authoritative representation of the world.
|
/// The server's authoritative representation of the world.
|
||||||
#[derive(Resource)]
|
#[derive(Resource)]
|
||||||
pub struct ServerWorld {
|
pub struct ServerWorld {
|
||||||
/// Deterministic voxel source used to generate missing chunks on demand.
|
|
||||||
generator: Arc<VoxelGenerator>,
|
|
||||||
/// Currently resident chunks, keyed by chunk-space position.
|
/// Currently resident chunks, keyed by chunk-space position.
|
||||||
chunks: HashMap<ChunkPos, Chunk>,
|
chunks: HashMap<ChunkPos, Chunk>,
|
||||||
/// Sending end of the job channel; the main thread pushes positions that require generation.
|
/// Sending end of the job channel; the main thread pushes positions that require generation.
|
||||||
|
|
@ -82,7 +80,6 @@ impl ServerWorld {
|
||||||
drop(result_tx);
|
drop(result_tx);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
generator,
|
|
||||||
chunks: HashMap::new(),
|
chunks: HashMap::new(),
|
||||||
job_tx,
|
job_tx,
|
||||||
result_rx,
|
result_rx,
|
||||||
|
|
@ -91,13 +88,6 @@ impl ServerWorld {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves a reference to the chunk at the given position, generating it if necessary.
|
|
||||||
pub fn get_chunk(&mut self, pos: ChunkPos) -> &Chunk {
|
|
||||||
self.chunks
|
|
||||||
.entry(pos)
|
|
||||||
.or_insert_with(|| self.generator.generate_chunk(pos))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Number of chunks currently resident in memory.
|
/// Number of chunks currently resident in memory.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn loaded_count(&self) -> usize {
|
pub fn loaded_count(&self) -> usize {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue