summaryrefslogtreecommitdiff
path: root/chunk.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-11-24 11:46:03 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-11-24 11:46:03 +0100
commitb1d9bfe7e80b4d95acd26d0ab6a1ce34ad18d91c (patch)
tree3bc9cce0c176057fcc2f8b4640a3e23de374875e /chunk.gd
parent1a785420ec47c78ac3f95bd0ece08c819653f6e8 (diff)
next commitHEADmain
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