Real ctx.world.is_loaded implementation
This commit is contained in:
@@ -272,6 +272,13 @@ export class ServerWorld {
|
||||
return this.#chunks.has(chunk_key(chunk_x, chunk_z));
|
||||
}
|
||||
|
||||
// whether the chunk was ever generated: it's kept, or saved, so reading it generates nothing. it may not be in
|
||||
// memory, then reading it decodes it from the save
|
||||
is_generated(chunk_x: number, chunk_z: number) {
|
||||
const key = chunk_key(chunk_x, chunk_z);
|
||||
return this.#chunks.has(key) || this.#is_saved(key);
|
||||
}
|
||||
|
||||
// counts as using the chunk so it's kept longer, if it's there. returns whether it is, see has_chunk
|
||||
keep_chunk(chunk_x: number, chunk_z: number) {
|
||||
return this.#chunks.get(chunk_key(chunk_x, chunk_z)) !== undefined;
|
||||
|
||||
Reference in New Issue
Block a user