diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2022-09-20 02:00:08 -0400 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2022-09-20 02:00:08 -0400 |
commit | 7e75beb7b1f3b1121961f8df36f0fee3cd41cb58 (patch) | |
tree | 297727d30a8cb5be309b47c1e8bfe41e0792888b /world/monuments/Monument.gd | |
parent | 51a0664a1c2265adddbf4c42d4eda747c8ea8aaf (diff) | |
download | game_jam49-7e75beb7b1f3b1121961f8df36f0fee3cd41cb58.tar.gz game_jam49-7e75beb7b1f3b1121961f8df36f0fee3cd41cb58.zip |
Add ability to add static monuments to the world
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 |