summaryrefslogtreecommitdiff
path: root/chunk.gd
diff options
context:
space:
mode:
Diffstat (limited to 'chunk.gd')
-rw-r--r--chunk.gd8
1 files changed, 5 insertions, 3 deletions
diff --git a/chunk.gd b/chunk.gd
index 8dcd416..24713a2 100644
--- a/chunk.gd
+++ b/chunk.gd
@@ -6,7 +6,7 @@ var chunk_size := Vector3(16, 16, 16)
@export var noise: FastNoiseLite
-var blocks: Array[Block] = []
+var blocks: Array = []
func generate_chunk(row, column, depth):
@@ -18,7 +18,7 @@ func generate_chunk(row, column, depth):
st.begin(Mesh.PRIMITIVE_TRIANGLES)
st.set_material(material)
- var blocks = []
+ blocks = []
for x in chunk_size.x:
#blocks[x] = []
@@ -66,7 +66,7 @@ func generate_chunk(row, column, depth):
st.set_uv(Vector2(0, 0))
if (blocks[x][y].size() > z+1 and blocks[x][y][z + 1].type == Block.Type.AIR) or blocks[x][y].size() == z+1:
- block.add_face(st, Block.Face.FRONT, block)
+ block.add_face(st, Block.Face.FRONT)
if (blocks.size() > x+1 and blocks[x + 1][y][z].type == Block.Type.AIR) or blocks.size() == x+1:
block.add_face(st, Block.Face.RIGHT)
@@ -88,3 +88,5 @@ func generate_chunk(row, column, depth):
var mesh = MeshInstance3D.new()
mesh.mesh = st.commit()
mesh.create_trimesh_collision()
+
+ return mesh