diff options
Diffstat (limited to 'world/monuments/Monument.gd')
-rw-r--r-- | world/monuments/Monument.gd | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/world/monuments/Monument.gd b/world/monuments/Monument.gd new file mode 100644 index 0000000..86074f1 --- /dev/null +++ b/world/monuments/Monument.gd @@ -0,0 +1,21 @@ +class_name Monument + +var xform:Transform = Transform(Basis(),Vector3.ZERO) +var scene:PackedScene = null +var chunks = {} +var origin_chunk = Vector2.ZERO +var loaded_chunk = null + +func is_chunk_in_monument(chunk_coords:Vector2): + return self.chunks.has(chunk_coords) + +func _init(transform,scn,member_chunks, origin): + self.xform = transform + self.xform.origin = ChunkLoader.v3_coords(ChunkLoader.chunk_coords(ChunkLoader.v2_coords(self.xform.origin))) + self.scene = scn + var org = ChunkLoader.chunk_coords(ChunkLoader.v2_coords(self.xform.origin)) + for c in member_chunks.keys(): + var c2 = ChunkLoader.v2_coords(self.xform.basis * ChunkLoader.v3_coords(c)) + self.chunks[ChunkLoader.chunk_coords(c2)+org] = member_chunks[c] + origin = ChunkLoader.v2_coords(self.xform.basis * ChunkLoader.v3_coords(origin)) + self.origin_chunk = ChunkLoader.chunk_coords(origin)+org |