Real ctx.world.is_loaded implementation

This commit is contained in:
2026-10-20 14:00:21 -03:00
parent 2c1eaf5735
commit 987e7a0f9a
5 changed files with 49 additions and 3 deletions
+4 -1
View File
@@ -241,7 +241,8 @@ export interface ServerAfterEvents {
// world and players
export interface ServerWorld {
get_block(x: number, y: number, z: number): Id | undefined; // undefined when the chunk isn't loaded
// generates the chunk if it never was, which takes a while, see is_loaded
get_block(x: number, y: number, z: number): Id | undefined;
set_block(x: number, y: number, z: number, id: Id): boolean; // runs on_break / on_create, synced to everyone
// like breaking it by hand without a tool: on_break, then its drops, which it returns (copies). undefined when there
// was nothing to break. see BreakOptions for machines breaking it
@@ -300,6 +301,8 @@ export interface ServerWorld {
// which way the liquid at x y z flows, a vector 1 long, or 0 0 0 where it's still or there's none, like minecraft's
// FluidState.getFlow: toward lower cells of it beside it, and down where it falls. for what it pushes, like a wheel
liquid_flow(x: number, y: number, z: number): Position;
// whether the chunk the column is in was ever generated, so reading its blocks generates nothing. for code that
// reaches far, like a walk along something long, which can stop at the rest: nobody has built anything there
is_loaded(x: number, z: number): boolean;
// the column's biome, like "bworld:plains", and that biome's season. in chunks that aren't loaded it's what
// generation makes there, which takes a while the first time