From cb18c2206a954698e964f22ca3d25dd4bdaecb9e Mon Sep 17 00:00:00 2001 From: copygirl Date: Tue, 30 Sep 2025 19:00:42 +0200 Subject: [PATCH] Add Chunk.region field --- world/chunk.gd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/world/chunk.gd b/world/chunk.gd index 0835eb4..956fe03 100644 --- a/world/chunk.gd +++ b/world/chunk.gd @@ -7,6 +7,7 @@ const SIZE := 32 # blocks signal clean var chunk_pos: Vector2i +var region: BlockRegion var dirty := false var tracked_by: Dictionary[ChunkLoader, Variant] # value is unused @@ -19,6 +20,11 @@ func get_players_tracking() -> Array[Player]: func _init(chunk_pos: Vector2i) -> void: self.chunk_pos = chunk_pos + + var min := chunk_pos * Chunk.SIZE + var max := (chunk_pos + Vector2i.ONE) * Chunk.SIZE - Vector2i.ONE + region = BlockRegion.new(min, max) + name = "Chunk %s" % chunk_pos position = (Vector2(chunk_pos) + Vector2.ONE / 2) * (Block.SIZE * SIZE)