summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block.gd93
-rw-r--r--block.gd.uid1
-rw-r--r--camera.gd.uid1
-rw-r--r--chunk.gd173
-rw-r--r--chunk.gd.uid1
-rw-r--r--chunk.tscn15
-rw-r--r--free-look-camera.gd.uid1
-rw-r--r--global.gd8
-rw-r--r--global.gd.uid1
-rw-r--r--inventory_bar.gd18
-rw-r--r--inventory_bar.gd.uid1
-rw-r--r--main.gd114
-rw-r--r--main.gd.uid1
-rw-r--r--main.tscn77
-rw-r--r--new_shader.gdshader.uid1
-rw-r--r--new_shader_material.tres4
-rw-r--r--new_shader_material_selection.tres4
-rw-r--r--new_shader_selection.gdshader.uid1
-rw-r--r--player.gd110
-rw-r--r--player.gd.uid1
-rw-r--r--project.godot50
21 files changed, 480 insertions, 196 deletions
diff --git a/block.gd b/block.gd
index 97f2695..c1f2ab5 100644
--- a/block.gd
+++ b/block.gd
@@ -1,11 +1,7 @@
class_name Block
-extends Resource
-const FACE_CORNERS = [
- Vector2(0, 0), Vector2(1, 0),
- Vector2(0, 1), Vector2(1, 1),
-]
+const BLOCK_SIZE := Vector3(1.0, 1.0, 1.0)
enum Face {
FRONT,
@@ -16,7 +12,7 @@ enum Face {
BOTTOM,
}
-const FACES = [
+var FACES = [
[ # FRONT
[Vector3(-1.0, 1.0, 1.0), Vector3(1.0, -1.0, 1.0), Vector3(-1.0, -1.0, 1.0)],
[Vector3(-1.0, 1.0, 1.0), Vector3(1.0, 1.0, 1.0), Vector3(1.0, -1.0, 1.0)],
@@ -43,7 +39,7 @@ const FACES = [
],
]
-const FACE_UVS = [
+var FACE_UVS = [
[ # FRONT
[Vector2(0.0, 0.0), Vector2(1.0, 1.0), Vector2(0.0, 1.0)],
[Vector2(0.0, 0.0), Vector2(1.0, 0.0), Vector2(1.0, 1.0)],
@@ -70,7 +66,7 @@ const FACE_UVS = [
],
]
-const FACE_NORMALS = [
+var FACE_NORMALS = [
Vector3(0, 0, 1), # FRONT
Vector3(0, 0, -1), # BACK
Vector3(-1, 0, 0), # LEFT
@@ -86,10 +82,17 @@ enum Type {
LEAVES,
STONE,
ICE,
+ WOOD,
+ SAND,
+ PLANKS,
+ YELLOW_STONE,
+ BLUE_STONE,
+ RED_STONE,
+ BLACK_STONE,
SELECTION,
}
-const BLOCK_TYPES = {
+var BLOCK_TYPES = {
Type.GRASS: {
"uv2s": [
Vector2(0, 0), # FRONT
@@ -140,6 +143,76 @@ const BLOCK_TYPES = {
Vector2(2, 1), # BOTTOM
],
},
+ Type.WOOD: {
+ "uv2s": [
+ Vector2(5, 0), # FRONT
+ Vector2(5, 0), # BACK
+ Vector2(5, 0), # LEFT
+ Vector2(5, 0), # RIGHT
+ Vector2(5, 0), # TOP
+ Vector2(5, 0), # BOTTOM
+ ],
+ },
+ Type.SAND: {
+ "uv2s": [
+ Vector2(4, 0), # FRONT
+ Vector2(4, 0), # BACK
+ Vector2(4, 0), # LEFT
+ Vector2(4, 0), # RIGHT
+ Vector2(4, 0), # TOP
+ Vector2(4, 0), # BOTTOM
+ ],
+ },
+ Type.PLANKS: {
+ "uv2s": [
+ Vector2(0, 2), # FRONT
+ Vector2(0, 2), # BACK
+ Vector2(0, 2), # LEFT
+ Vector2(0, 2), # RIGHT
+ Vector2(0, 2), # TOP
+ Vector2(0, 2), # BOTTOM
+ ],
+ },
+ Type.YELLOW_STONE: {
+ "uv2s": [
+ Vector2(3, 1), # FRONT
+ Vector2(3, 1), # BACK
+ Vector2(3, 1), # LEFT
+ Vector2(3, 1), # RIGHT
+ Vector2(3, 1), # TOP
+ Vector2(3, 1), # BOTTOM
+ ],
+ },
+ Type.BLUE_STONE: {
+ "uv2s": [
+ Vector2(4, 1), # FRONT
+ Vector2(4, 1), # BACK
+ Vector2(4, 1), # LEFT
+ Vector2(4, 1), # RIGHT
+ Vector2(4, 1), # TOP
+ Vector2(4, 1), # BOTTOM
+ ],
+ },
+ Type.RED_STONE: {
+ "uv2s": [
+ Vector2(5, 1), # FRONT
+ Vector2(5, 1), # BACK
+ Vector2(5, 1), # LEFT
+ Vector2(5, 1), # RIGHT
+ Vector2(5, 1), # TOP
+ Vector2(5, 1), # BOTTOM
+ ],
+ },
+ Type.BLACK_STONE: {
+ "uv2s": [
+ Vector2(1, 2), # FRONT
+ Vector2(1, 2), # BACK
+ Vector2(1, 2), # LEFT
+ Vector2(1, 2), # RIGHT
+ Vector2(1, 2), # TOP
+ Vector2(1, 2), # BOTTOM
+ ],
+ },
Type.SELECTION: {
"uv2s": [
Vector2(3, 2), # FRONT
@@ -168,7 +241,7 @@ func add_face(surface_tool: SurfaceTool, face: Face):
for idx in FACES[face].size():
var triangle = FACES[face][idx]
var triangle_positions = triangle.map(func(item):
- return (item / 2.0) + position + Vector3(0.5, 0.5, 0.5)
+ return (item * (BLOCK_SIZE * 0.5)) + position + (BLOCK_SIZE * 0.5)
)
var uvs = FACE_UVS[face][idx]
diff --git a/block.gd.uid b/block.gd.uid
new file mode 100644
index 0000000..8ddae71
--- /dev/null
+++ b/block.gd.uid
@@ -0,0 +1 @@
+uid://nk24rejftjmm
diff --git a/camera.gd.uid b/camera.gd.uid
new file mode 100644
index 0000000..e8ffa25
--- /dev/null
+++ b/camera.gd.uid
@@ -0,0 +1 @@
+uid://cja33lro5ww7n
diff --git a/chunk.gd b/chunk.gd
index c750153..4d24eba 100644
--- a/chunk.gd
+++ b/chunk.gd
@@ -1,39 +1,44 @@
class_name Chunk
-extends Node
+extends Node3D
-static var chunks: Array = []
-
-const CHUNK_SIZE := Vector3i(16, 16, 16)
-
-var position := Vector3i.ZERO
-var mesh := MeshInstance3D.new()
+var grid_position := Vector3i.ZERO
+var mesh: ArrayMesh = ArrayMesh.new()
@export var noise: FastNoiseLite
@export var blocks: Array = []
func generate_block_data(row: int, column: int, depth: int, empty: bool = false):
- position = Vector3i(row, column, depth)
+ Global.mutex.lock()
+
+ grid_position = Vector3i(row, column, depth)
blocks = []
- for x in CHUNK_SIZE.x:
+ for x in Global.CHUNK_SIZE.x:
blocks.append([])
- for y in CHUNK_SIZE.y:
+ for y in Global.CHUNK_SIZE.y:
blocks[x].append([])
- for z in CHUNK_SIZE.z:
+ for z in Global.CHUNK_SIZE.z:
var block_position = Vector3i(
- position.x * CHUNK_SIZE.x + x,
- position.y * CHUNK_SIZE.y + y,
- position.z * CHUNK_SIZE.z + z
+ grid_position.x * Global.CHUNK_SIZE.x + x,
+ grid_position.y * Global.CHUNK_SIZE.y + y,
+ grid_position.z * Global.CHUNK_SIZE.z + z
)# * 2
var value = noise.get_noise_3d(block_position.x, block_position.y, block_position.z) * 100
var type = Block.Type.AIR
- if value > -15:
+ if value > 4:
type = Block.Type.GRASS
- elif value > -20:
+ if value < -4:
type = Block.Type.STONE
+ #if value < -16:
+ #type = Block.Type.DIRT
+ if value < -17 and value > -20:
+ type = Block.Type.SAND
+ if abs(value) > 21 and abs(value) < 21.25:
+ type = [Block.Type.STONE, Block.Type.YELLOW_STONE, Block.Type.BLUE_STONE, Block.Type.RED_STONE, Block.Type.BLACK_STONE].pick_random()
+ #print(value)
var block = Block.new()
block.position = block_position
@@ -43,9 +48,13 @@ func generate_block_data(row: int, column: int, depth: int, empty: bool = false)
block.type = Block.Type.AIR
blocks[x][y].append(block)
+
+ Global.mutex.unlock()
-func generate_mesh() -> MeshInstance3D:
+func generate_mesh():
+ Global.mutex.lock()
+
var material := preload("res://new_shader_material.tres")
var st = SurfaceTool.new()
st.begin(Mesh.PRIMITIVE_TRIANGLES)
@@ -56,41 +65,52 @@ func generate_mesh() -> MeshInstance3D:
for z in blocks[x][y].size():
var block: Block = blocks[x][y][z]
+ if block.type == Block.Type.AIR:
+ continue
+
var block_front: Block
if block_exists(x, y, z + 1):
block_front = blocks[x][y][z + 1]
- elif is_chunk_border(x, y, z) and chunk_exists(position.x, position.y, position.z + 1):
- block_front = chunks[position.x][position.y][position.z + 1].blocks[x][y][0]
+ elif is_chunk_border(x, y, z) and chunk_exists(grid_position + Vector3i(0, 0, 1)):
+ var chunk_front := Global.chunks[grid_position + Vector3i(0, 0, 1)]
+ block_front = chunk_front.blocks[x][y][0]
var block_back: Block
if block_exists(x, y, z - 1):
block_back = blocks[x][y][z - 1]
- elif is_chunk_border(x, y, z) and chunk_exists(position.x, position.y, position.z - 1):
- block_back = chunks[position.x][position.y][position.z - 1].blocks[x][y][CHUNK_SIZE.z - 1]
-
- var block_left: Block
- if block_exists(x - 1, y, z):
- block_left = blocks[x - 1][y][z]
- elif is_chunk_border(x, y, z) and chunk_exists(position.x - 1, position.y, position.z):
- block_left = chunks[position.x - 1][position.y][position.z].blocks[CHUNK_SIZE.x - 1][y][z]
+ elif is_chunk_border(x, y, z) and chunk_exists(grid_position + Vector3i(0, 0, -1)):
+ var chunk_back := Global.chunks[grid_position + Vector3i(0, 0, -1)]
+ block_back = chunk_back.blocks[x][y][Global.CHUNK_SIZE.z - 1]
var block_right: Block
if block_exists(x + 1, y, z):
block_right = blocks[x + 1][y][z]
- elif is_chunk_border(x, y, z) and chunk_exists(position.x + 1, position.y, position.z):
- block_right = chunks[position.x + 1][position.y][position.z].blocks[0][y][z]
+ elif is_chunk_border(x, y, z) and chunk_exists(grid_position + Vector3i(1, 0, 0)):
+ var chunk_right := Global.chunks[grid_position + Vector3i(1, 0, 0)]
+ block_right = chunk_right.blocks[0][y][z]
+
+ var block_left: Block
+ if block_exists(x - 1, y, z):
+ block_left = blocks[x - 1][y][z]
+ elif is_chunk_border(x, y, z) and chunk_exists(grid_position + Vector3i(-1, 0, 0)):
+ var chunk_left := Global.chunks[grid_position + Vector3i(-1, 0, 0)]
+ block_left = chunk_left.blocks[Global.CHUNK_SIZE.x - 1][y][z]
var block_top: Block
if block_exists(x, y + 1, z):
block_top = blocks[x][y + 1][z]
- elif is_chunk_border(x, y, z) and chunk_exists(position.x, position.y + 1, position.z):
- block_top = chunks[position.x][position.y + 1][position.z].blocks[x][0][z]
+ elif is_chunk_border(x, y, z) and chunk_exists(grid_position + Vector3i(0, 1, 0)):
+ var chunk_top := Global.chunks[grid_position + Vector3i(0, 1, 0)]
+ #if chunk_top.is_inside_tree():
+ block_top = chunk_top.blocks[x][0][z]
var block_bottom: Block
if block_exists(x, y - 1, z):
block_bottom = blocks[x][y - 1][z]
- elif is_chunk_border(x, y, z) and chunk_exists(position.x, position.y - 1, position.z):
- block_bottom = chunks[position.x][position.y - 1][position.z].blocks[x][CHUNK_SIZE.y - 1][z]
+ elif is_chunk_border(x, y, z) and chunk_exists(grid_position + Vector3i(0, -1, 0)):
+ var chunk_bottom := Global.chunks[grid_position + Vector3i(0, -1, 0)]
+ #if chunk_bottom.is_inside_tree():
+ block_bottom = chunk_bottom.blocks[x][Global.CHUNK_SIZE.y - 1][z]
if not block.type == Block.Type.AIR:
if block.type == Block.Type.GRASS:
@@ -106,12 +126,12 @@ func generate_mesh() -> MeshInstance3D:
if not block_front or block_front.type == Block.Type.AIR:
block.add_face(st, Block.Face.FRONT)
- if not block_right or block_right.type == Block.Type.AIR:
- block.add_face(st, Block.Face.RIGHT)
-
if not block_back or block_back.type == Block.Type.AIR:
block.add_face(st, Block.Face.BACK)
+ if not block_right or block_right.type == Block.Type.AIR:
+ block.add_face(st, Block.Face.RIGHT)
+
if not block_left or block_left.type == Block.Type.AIR:
block.add_face(st, Block.Face.LEFT)
@@ -123,16 +143,24 @@ func generate_mesh() -> MeshInstance3D:
#st.generate_normals()
- #mesh = MeshInstance3D.new()
- mesh.mesh = st.commit()
+ mesh = st.commit()
- for child in mesh.get_children():
- child.queue_free()
- mesh.create_trimesh_collision.call_deferred()
-
- mesh.set_meta("chunk", self)
+ Global.mutex.unlock()
+
+
+func update_mesh() -> void:
+ $MeshInstance3D.mesh = mesh
- return mesh
+ var shape := ConcavePolygonShape3D.new()
+ var faces := mesh.get_faces()
+ if faces.size() > 0:
+ shape.set_faces(mesh.get_faces())
+ $StaticBody3D/CollisionShape3D.shape = shape
+
+
+func add_to(node: Node) -> void:
+ node.add_child(self)
+ update_mesh()
func generate_chunk(row: int, column: int, depth: int):
@@ -145,36 +173,65 @@ func generate_chunk(row: int, column: int, depth: int):
func add_block(block_position: Vector3, block_type: Block.Type = Block.Type.GRASS) -> void:
var block = Block.new()
block.position = Vector3i(
- position.x * CHUNK_SIZE.x + block_position.x,
- position.y * CHUNK_SIZE.y + block_position.y,
- position.z * CHUNK_SIZE.z + block_position.z
+ grid_position.x * Global.CHUNK_SIZE.x + int(block_position.x),
+ grid_position.y * Global.CHUNK_SIZE.y + int(block_position.y),
+ grid_position.z * Global.CHUNK_SIZE.z + int(block_position.z)
)
block.type = block_type
blocks[block_position.x][block_position.y][block_position.z] = block
- generate_mesh.call_deferred()
+ #generate_mesh.call_deferred()
func remove_block(block_position: Vector3) -> void:
blocks[block_position.x][block_position.y][block_position.z].type = Block.Type.AIR
- generate_mesh.call_deferred()
-static func chunk_exists(x: int, y: int, z: int):
- return x >= 0 and chunks.size() - 1 >= x and y >= 0 and chunks[x].size() - 1 >= y and z >= 0 and chunks[x][y].size() - 1 >= z
+static func chunk_exists(chunk_position: Vector3i):
+ return Global.chunks.has(chunk_position)
+ #return x >= 0 and chunks.size() - 1 >= x and y >= 0 and chunks[x].size() - 1 >= y and z >= 0 and chunks[x][y].size() - 1 >= z
func block_exists(x: int, y: int, z: int):
return x >= 0 and blocks.size() - 1 >= x and y >= 0 and blocks[x].size() - 1 >= y and z >= 0 and blocks[x][y].size() - 1 >= z
func is_chunk_border(x: int, y: int, z: int):
- return x == 0 or x == CHUNK_SIZE.x - 1 or y == 0 or y == CHUNK_SIZE.y - 1 or z == 0 or z == CHUNK_SIZE.z - 1
+ return x == 0 or x == Global.CHUNK_SIZE.x - 1 or y == 0 or y == Global.CHUNK_SIZE.y - 1 or z == 0 or z == Global.CHUNK_SIZE.z - 1
+
+func get_bordering_chunks(block_position: Vector3i) -> Array[Vector3i]:
+ var bordering_chunks := [] as Array[Vector3i]
+
+ if not is_chunk_border(block_position.x, block_position.y, block_position.z):
+ return bordering_chunks
+
+ if block_position.z == 0:
+ bordering_chunks.append(grid_position + Vector3i(0, 0, -1))
+ elif block_position.z == Global.CHUNK_SIZE.z - 1:
+ bordering_chunks.append(grid_position + Vector3i(0, 0, 1))
+
+ if block_position.x == 0:
+ bordering_chunks.append(grid_position + Vector3i(-1, 0, 0))
+ elif block_position.x == Global.CHUNK_SIZE.x - 1:
+ bordering_chunks.append(grid_position + Vector3i(1, 0, 0))
+
+ if block_position.y == 0:
+ bordering_chunks.append(grid_position + Vector3i(0, -1, 0))
+ elif block_position.y == Global.CHUNK_SIZE.y - 1:
+ bordering_chunks.append(grid_position + Vector3i(0, 1, 0))
+
+ return bordering_chunks
+
+func get_neighboring_blocks(_block_position: Vector3i) -> Array[Vector3i]:
+ return []
-static func global_to_chunk(global_position: Vector3) -> Vector3i:
- return floor(global_position / Vector3(CHUNK_SIZE))
+@warning_ignore("shadowed_variable_base_class")
+static func global_to_chunk(global_position: Vector3, normal: Vector3) -> Vector3i:
+ return floor((global_position - normal * (Block.BLOCK_SIZE * 0.5)) / Vector3(Global.CHUNK_SIZE))
-static func global_to_chunk_block(global_position: Vector3) -> Vector3i:
- return global_to_block(global_position) - CHUNK_SIZE * global_to_chunk(global_position)
+@warning_ignore("shadowed_variable_base_class")
+static func global_to_chunk_block(global_position: Vector3, normal: Vector3) -> Vector3i:
+ return global_to_block(global_position, normal) - Global.CHUNK_SIZE * global_to_chunk(global_position, normal)
-static func global_to_block(global_position: Vector3) -> Vector3i:
- return floor(global_position)
+@warning_ignore("shadowed_variable_base_class")
+static func global_to_block(global_position: Vector3, normal: Vector3) -> Vector3i:
+ return floor(global_position - normal * (Block.BLOCK_SIZE * 0.5))
diff --git a/chunk.gd.uid b/chunk.gd.uid
new file mode 100644
index 0000000..897e2c0
--- /dev/null
+++ b/chunk.gd.uid
@@ -0,0 +1 @@
+uid://cdje7x0r2xw8t
diff --git a/chunk.tscn b/chunk.tscn
new file mode 100644
index 0000000..4f50d5b
--- /dev/null
+++ b/chunk.tscn
@@ -0,0 +1,15 @@
+[gd_scene load_steps=3 format=3 uid="uid://e0kmmy52hfp8"]
+
+[ext_resource type="Script" uid="uid://cdje7x0r2xw8t" path="res://chunk.gd" id="1_kdh3y"]
+
+[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_kdh3y"]
+
+[node name="Chunk" type="Node3D"]
+script = ExtResource("1_kdh3y")
+
+[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
+
+[node name="StaticBody3D" type="StaticBody3D" parent="."]
+
+[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"]
+shape = SubResource("ConcavePolygonShape3D_kdh3y")
diff --git a/free-look-camera.gd.uid b/free-look-camera.gd.uid
new file mode 100644
index 0000000..8baa074
--- /dev/null
+++ b/free-look-camera.gd.uid
@@ -0,0 +1 @@
+uid://cpujedcq8ihr
diff --git a/global.gd b/global.gd
new file mode 100644
index 0000000..40d0954
--- /dev/null
+++ b/global.gd
@@ -0,0 +1,8 @@
+extends Node
+
+
+var player: Player
+var mutex := Mutex.new()
+
+var chunks: Dictionary[Vector3i, Chunk] = {}
+var CHUNK_SIZE := Vector3i(16, 16, 16)
diff --git a/global.gd.uid b/global.gd.uid
new file mode 100644
index 0000000..1504ca8
--- /dev/null
+++ b/global.gd.uid
@@ -0,0 +1 @@
+uid://bfo2qfm7kxid7
diff --git a/inventory_bar.gd b/inventory_bar.gd
index 0077274..3f9bda3 100644
--- a/inventory_bar.gd
+++ b/inventory_bar.gd
@@ -11,6 +11,12 @@ func _input(event: InputEvent) -> void:
_on_texture_rect_2_pressed()
if event.is_action_pressed("inventory_bar_slot_3"):
_on_texture_rect_3_pressed()
+ if event.is_action_pressed("inventory_bar_slot_4"):
+ _on_texture_rect_4_pressed()
+ if event.is_action_pressed("inventory_bar_slot_5"):
+ _on_texture_rect_5_pressed()
+ if event.is_action_pressed("inventory_bar_slot_6"):
+ _on_texture_rect_6_pressed()
func _on_texture_rect_pressed() -> void:
@@ -23,3 +29,15 @@ func _on_texture_rect_2_pressed() -> void:
func _on_texture_rect_3_pressed() -> void:
active_type = Block.Type.ICE
+
+
+func _on_texture_rect_4_pressed() -> void:
+ active_type = Block.Type.WOOD
+
+
+func _on_texture_rect_5_pressed() -> void:
+ active_type = Block.Type.SAND
+
+
+func _on_texture_rect_6_pressed() -> void:
+ active_type = Block.Type.PLANKS
diff --git a/inventory_bar.gd.uid b/inventory_bar.gd.uid
new file mode 100644
index 0000000..e098ba8
--- /dev/null
+++ b/inventory_bar.gd.uid
@@ -0,0 +1 @@
+uid://cmdqh0objlqre
diff --git a/main.gd b/main.gd
index 77dcfab..1f125d9 100644
--- a/main.gd
+++ b/main.gd
@@ -4,75 +4,87 @@ extends Node3D
@onready var noise := FastNoiseLite.new()
+var chunks_to_update: Array[Vector3i] = []
+var active_task_id: int = -1
+
func _ready() -> void:
- brrr()
+ Global.player = $Player
+ noise.seed = randi()
+
+ #var world_size := Vector3i(4, 2, 4)
+ #
+ #for column in range(world_size.y, 0, -1):
+ #for row in range(- world_size.x * 0.5, world_size.x * 0.5):
+ #for depth in range(- world_size.z * 0.5, world_size.z * 0.5):
+ #chunks_to_update.append(Vector3i(row, column, depth))
+ chunks_to_update.append(Vector3i(0, 0, 0))
+ chunks_to_update.append(Vector3i(0, 1, 0))
+ #chunks_to_update.append(Vector3i(0, 2, 0))
-class OtherThread extends Thread:
- func _exit_tree():
- wait_to_finish()
+func _process(_delta: float) -> void:
+ if chunks_to_update.size() > 0:
+ if active_task_id == -1:
+ active_task_id = WorkerThreadPool.add_group_task(update_chunk_task, chunks_to_update.size())
+ else:
+ if WorkerThreadPool.is_group_task_completed(active_task_id):
+ WorkerThreadPool.wait_for_group_task_completion(active_task_id)
+ chunks_to_update.clear()
+ active_task_id = -1
+
+ # TODO: get player current chunk
+ # TODO: get all chunk positions in radius
+ # TODO: add missing chunks. remove surplus chunks
-func brrr():
- noise.seed = randi()
-
- var thread = OtherThread.new()
- var rrrb = func():
- for row in range(0, 2):
- Chunk.chunks.append([])
- for column in range(0, 1):
- Chunk.chunks[row].append([])
- for depth in range(0, 2):
- Chunk.chunks[row][column].append([])
- var chunk = Chunk.new()
- chunk.noise = noise
- chunk.generate_block_data(row, column, depth)
- Chunk.chunks[row][column][depth] = chunk
-
- #var rrrb2 = func():
- for row in Chunk.chunks.size():
- for column in Chunk.chunks[row].size():
- for depth in Chunk.chunks[row][column].size():
- var chunk: Chunk = Chunk.chunks[row][column][depth]
- var mesh = chunk.generate_mesh()
- add_child.call_deferred(mesh)
+func update_chunk_task(index: int) -> void:
+ update_chunk(chunks_to_update[index])
+
+func update_chunk(chunk_position: Vector3i) -> void:
+ if Chunk.chunk_exists(chunk_position):
+ var chunk: Chunk = Global.chunks[chunk_position]
+ chunk.generate_mesh()
+ chunk.update_mesh.call_deferred()
- thread.start(rrrb)
- #thread.wait_to_finish()
- #thread.start(rrrb2)
+ else:
+ var chunk := create_chunk(chunk_position)
+ chunk.generate_block_data(chunk_position.x, chunk_position.y, chunk_position.z)
+ chunk.generate_mesh()
+ chunk.add_to.call_deferred(self)
-func create_chunk(chunk_position: Vector3) -> Chunk:
- var chunk := Chunk.new()
+func create_chunk(chunk_position: Vector3i) -> Chunk:
+ var chunk: Chunk = preload("res://chunk.tscn").instantiate()
chunk.noise = noise
-
- if Chunk.chunks.size() == chunk_position.x:
- Chunk.chunks.append([])
- if Chunk.chunks[chunk_position.x].size() == chunk_position.y:
- Chunk.chunks[chunk_position.x].append([])
- if Chunk.chunks[chunk_position.x][chunk_position.y].size() == chunk_position.z:
- Chunk.chunks[chunk_position.y].append([])
-
- Chunk.chunks[chunk_position.x][chunk_position.y][chunk_position.z] = chunk
+ Global.chunks[chunk_position] = chunk
return chunk
-func add_block(target_position: Vector3, block_type: Block.Type = Block.Type.AIR):
- var chunk_idx := Chunk.global_to_chunk(target_position)
+func add_block(target_position: Vector3, normal: Vector3, block_type: Block.Type = Block.Type.AIR):
+ var chunk_idx := Chunk.global_to_chunk(target_position + normal, Vector3.ZERO)
var chunk: Chunk
- var created_new_chunk := false
- if Chunk.chunk_exists(chunk_idx.x, chunk_idx.y, chunk_idx.z):
- chunk = Chunk.chunks[chunk_idx.x][chunk_idx.y][chunk_idx.z]
+ if Chunk.chunk_exists(chunk_idx):
+ chunk = Global.chunks[chunk_idx]
else:
- created_new_chunk = true
chunk = create_chunk(Vector3(chunk_idx.x, chunk_idx.y, chunk_idx.z))
chunk.generate_block_data(chunk_idx.x, chunk_idx.y, chunk_idx.z, true)
+ chunk.add_to.call_deferred(self)
- var block_chunk_idx := Chunk.global_to_chunk_block(target_position)
+ var block_chunk_idx := Chunk.global_to_chunk_block(target_position + normal, normal)
chunk.add_block(block_chunk_idx, block_type)
-
- if created_new_chunk:
- add_child.call_deferred(chunk.generate_mesh())
+ chunks_to_update.append(chunk.grid_position)
+
+
+func remove_block(target_position: Vector3, normal: Vector3):
+ var chunk_idx := Chunk.global_to_chunk(target_position, normal)
+ if Chunk.chunk_exists(chunk_idx):
+ var chunk: Chunk = Global.chunks[chunk_idx]
+ var block_chunk_idx := Chunk.global_to_chunk_block(target_position, normal)
+ chunk.remove_block(block_chunk_idx)
+ chunks_to_update.append(chunk.grid_position)
+ chunks_to_update.append_array(chunk.get_bordering_chunks(block_chunk_idx).filter(func(item):
+ return Chunk.chunk_exists(item)
+ ))
diff --git a/main.gd.uid b/main.gd.uid
new file mode 100644
index 0000000..e97d76c
--- /dev/null
+++ b/main.gd.uid
@@ -0,0 +1 @@
+uid://b7wxthju54wyu
diff --git a/main.tscn b/main.tscn
index cd34898..0683810 100644
--- a/main.tscn
+++ b/main.tscn
@@ -1,10 +1,10 @@
-[gd_scene load_steps=15 format=3 uid="uid://b7k6l3bm1f0db"]
+[gd_scene load_steps=18 format=3 uid="uid://b7k6l3bm1f0db"]
-[ext_resource type="Script" path="res://main.gd" id="1_g4bmv"]
-[ext_resource type="Script" path="res://free-look-camera.gd" id="2_4jusq"]
+[ext_resource type="Script" uid="uid://b7wxthju54wyu" path="res://main.gd" id="1_g4bmv"]
+[ext_resource type="Script" uid="uid://cpujedcq8ihr" path="res://free-look-camera.gd" id="2_4jusq"]
[ext_resource type="Texture2D" uid="uid://dv842eajslxyw" path="res://icon.svg" id="3_7tj3h"]
-[ext_resource type="Script" path="res://player.gd" id="3_tn7lj"]
-[ext_resource type="Script" path="res://inventory_bar.gd" id="5_c1toa"]
+[ext_resource type="Script" uid="uid://bvlgfeu5rty6x" path="res://player.gd" id="3_tn7lj"]
+[ext_resource type="Script" uid="uid://cmdqh0objlqre" path="res://inventory_bar.gd" id="5_c1toa"]
[ext_resource type="Texture2D" uid="uid://ld8e4g6oef3x" path="res://Spritesheet.png" id="5_dqy55"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_vv2it"]
@@ -44,6 +44,18 @@ region = Rect2(160, 0, 80, 80)
atlas = ExtResource("5_dqy55")
region = Rect2(160, 80, 80, 80)
+[sub_resource type="AtlasTexture" id="AtlasTexture_pooo8"]
+atlas = ExtResource("5_dqy55")
+region = Rect2(400, 0, 80, 80)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_ikpm6"]
+atlas = ExtResource("5_dqy55")
+region = Rect2(320, 0, 80, 80)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_vqce1"]
+atlas = ExtResource("5_dqy55")
+region = Rect2(0, 160, 80, 80)
+
[node name="Main" type="Node3D"]
script = ExtResource("1_g4bmv")
@@ -62,38 +74,38 @@ script = ExtResource("2_4jusq")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
-[node name="CharacterBody3D" type="CharacterBody3D" parent="."]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 238.895, 2)
+[node name="Player" type="CharacterBody3D" parent="." groups=["player"]]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 253.937, 2)
script = ExtResource("3_tn7lj")
-[node name="CollisionShape3D" type="CollisionShape3D" parent="CharacterBody3D"]
+[node name="CollisionShape3D" type="CollisionShape3D" parent="Player"]
shape = SubResource("CapsuleShape3D_cggfi")
-[node name="CameraAnchor" type="Marker3D" parent="CharacterBody3D"]
+[node name="CameraAnchor" type="Marker3D" parent="Player"]
transform = Transform3D(0.999999, 0, 0, 0, 1, 0, 7.45058e-09, 0, 1, 0, 0.87, 0)
-[node name="Camera" type="Camera3D" parent="CharacterBody3D/CameraAnchor"]
+[node name="Camera" type="Camera3D" parent="Player/CameraAnchor"]
current = true
-[node name="RayCast3D" type="RayCast3D" parent="CharacterBody3D/CameraAnchor/Camera"]
-target_position = Vector3(0, 0, -8)
+[node name="RayCast3D" type="RayCast3D" parent="Player/CameraAnchor/Camera"]
+target_position = Vector3(0, 0, -5)
-[node name="CanvasLayer" type="CanvasLayer" parent="CharacterBody3D"]
+[node name="CanvasLayer" type="CanvasLayer" parent="Player"]
-[node name="CenterContainer" type="CenterContainer" parent="CharacterBody3D/CanvasLayer"]
+[node name="CenterContainer" type="CenterContainer" parent="Player/CanvasLayer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
-[node name="TextureRect" type="TextureRect" parent="CharacterBody3D/CanvasLayer/CenterContainer"]
+[node name="TextureRect" type="TextureRect" parent="Player/CanvasLayer/CenterContainer"]
custom_minimum_size = Vector2(16, 16)
layout_mode = 2
texture = ExtResource("3_7tj3h")
expand_mode = 1
-[node name="MarginContainer" type="MarginContainer" parent="CharacterBody3D/CanvasLayer"]
+[node name="MarginContainer" type="MarginContainer" parent="Player/CanvasLayer"]
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
@@ -103,28 +115,43 @@ grow_vertical = 0
theme_override_constants/margin_bottom = 4
script = ExtResource("5_c1toa")
-[node name="CenterContainer" type="CenterContainer" parent="CharacterBody3D/CanvasLayer/MarginContainer"]
+[node name="CenterContainer" type="CenterContainer" parent="Player/CanvasLayer/MarginContainer"]
layout_mode = 2
-[node name="PanelContainer" type="PanelContainer" parent="CharacterBody3D/CanvasLayer/MarginContainer/CenterContainer"]
+[node name="PanelContainer" type="PanelContainer" parent="Player/CanvasLayer/MarginContainer/CenterContainer"]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_4b324")
-[node name="HBoxContainer" type="HBoxContainer" parent="CharacterBody3D/CanvasLayer/MarginContainer/CenterContainer/PanelContainer"]
+[node name="HBoxContainer" type="HBoxContainer" parent="Player/CanvasLayer/MarginContainer/CenterContainer/PanelContainer"]
layout_mode = 2
-[node name="TextureRect" type="TextureButton" parent="CharacterBody3D/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer"]
+[node name="TextureRect" type="TextureButton" parent="Player/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer"]
layout_mode = 2
texture_normal = SubResource("AtlasTexture_w53vy")
-[node name="TextureRect2" type="TextureButton" parent="CharacterBody3D/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer"]
+[node name="TextureRect2" type="TextureButton" parent="Player/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer"]
layout_mode = 2
texture_normal = SubResource("AtlasTexture_kv0hd")
-[node name="TextureRect3" type="TextureButton" parent="CharacterBody3D/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer"]
+[node name="TextureRect3" type="TextureButton" parent="Player/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer"]
layout_mode = 2
texture_normal = SubResource("AtlasTexture_46jgo")
-[connection signal="pressed" from="CharacterBody3D/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer/TextureRect" to="CharacterBody3D/CanvasLayer/MarginContainer" method="_on_texture_rect_pressed"]
-[connection signal="pressed" from="CharacterBody3D/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer/TextureRect2" to="CharacterBody3D/CanvasLayer/MarginContainer" method="_on_texture_rect_2_pressed"]
-[connection signal="pressed" from="CharacterBody3D/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer/TextureRect3" to="CharacterBody3D/CanvasLayer/MarginContainer" method="_on_texture_rect_3_pressed"]
+[node name="TextureRect4" type="TextureButton" parent="Player/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer"]
+layout_mode = 2
+texture_normal = SubResource("AtlasTexture_pooo8")
+
+[node name="TextureRect5" type="TextureButton" parent="Player/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer"]
+layout_mode = 2
+texture_normal = SubResource("AtlasTexture_ikpm6")
+
+[node name="TextureRect6" type="TextureButton" parent="Player/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer"]
+layout_mode = 2
+texture_normal = SubResource("AtlasTexture_vqce1")
+
+[connection signal="pressed" from="Player/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer/TextureRect" to="Player/CanvasLayer/MarginContainer" method="_on_texture_rect_pressed"]
+[connection signal="pressed" from="Player/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer/TextureRect2" to="Player/CanvasLayer/MarginContainer" method="_on_texture_rect_2_pressed"]
+[connection signal="pressed" from="Player/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer/TextureRect3" to="Player/CanvasLayer/MarginContainer" method="_on_texture_rect_3_pressed"]
+[connection signal="pressed" from="Player/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer/TextureRect4" to="Player/CanvasLayer/MarginContainer" method="_on_texture_rect_4_pressed"]
+[connection signal="pressed" from="Player/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer/TextureRect5" to="Player/CanvasLayer/MarginContainer" method="_on_texture_rect_5_pressed"]
+[connection signal="pressed" from="Player/CanvasLayer/MarginContainer/CenterContainer/PanelContainer/HBoxContainer/TextureRect6" to="Player/CanvasLayer/MarginContainer" method="_on_texture_rect_6_pressed"]
diff --git a/new_shader.gdshader.uid b/new_shader.gdshader.uid
new file mode 100644
index 0000000..e1ba58a
--- /dev/null
+++ b/new_shader.gdshader.uid
@@ -0,0 +1 @@
+uid://j15ms63fqodv
diff --git a/new_shader_material.tres b/new_shader_material.tres
index f01b9b1..b72a259 100644
--- a/new_shader_material.tres
+++ b/new_shader_material.tres
@@ -1,10 +1,10 @@
[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://13gixtegdfat"]
-[ext_resource type="Shader" path="res://new_shader.gdshader" id="1_ux1ye"]
+[ext_resource type="Shader" uid="uid://j15ms63fqodv" path="res://new_shader.gdshader" id="1_ux1ye"]
[ext_resource type="CompressedTexture2DArray" uid="uid://demlxku183noo" path="res://Spritesheet_array.png" id="2_delqc"]
[resource]
render_priority = 0
shader = ExtResource("1_ux1ye")
-shader_parameter/elements_per_row = 6
shader_parameter/textures = ExtResource("2_delqc")
+shader_parameter/elements_per_row = 6
diff --git a/new_shader_material_selection.tres b/new_shader_material_selection.tres
index 0aaa4a0..da85f8a 100644
--- a/new_shader_material_selection.tres
+++ b/new_shader_material_selection.tres
@@ -1,10 +1,10 @@
[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://cgvu2qg8kba3m"]
-[ext_resource type="Shader" path="res://new_shader_selection.gdshader" id="1_0lbk8"]
+[ext_resource type="Shader" uid="uid://boveokh7mbuwp" path="res://new_shader_selection.gdshader" id="1_0lbk8"]
[ext_resource type="CompressedTexture2DArray" uid="uid://demlxku183noo" path="res://Spritesheet_array.png" id="2_xnnyw"]
[resource]
render_priority = 0
shader = ExtResource("1_0lbk8")
-shader_parameter/elements_per_row = 6
shader_parameter/textures = ExtResource("2_xnnyw")
+shader_parameter/elements_per_row = 6
diff --git a/new_shader_selection.gdshader.uid b/new_shader_selection.gdshader.uid
new file mode 100644
index 0000000..0e15a33
--- /dev/null
+++ b/new_shader_selection.gdshader.uid
@@ -0,0 +1 @@
+uid://boveokh7mbuwp
diff --git a/player.gd b/player.gd
index b45d0a0..d4c43dc 100644
--- a/player.gd
+++ b/player.gd
@@ -19,10 +19,14 @@ func _ready() -> void:
selection_block.visible = false
selection_block.top_level = true
selection_block.rotation = Vector3.ZERO
- selection_block.scale = Vector3(1.001, 1.001, 1.001)
+ selection_block.scale = Vector3(1.0001, 1.0001, 1.0001)
add_child(selection_block)
selection_block_data = Block.new()
selection_block_data.type = Block.Type.SELECTION
+
+ #set_physics_process(false)
+ #await get_tree().create_timer(3.0).timeout
+ #set_physics_process(true)
func _input(event: InputEvent) -> void:
@@ -31,66 +35,48 @@ func _input(event: InputEvent) -> void:
if event.is_action_pressed("mouse_exit"):
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
+ if Input.mouse_mode != Input.MOUSE_MODE_CAPTURED:
+ return
+
if event is InputEventMouseMotion:
$CameraAnchor.rotate_y(deg_to_rad(clamp(-event.relative.x * 0.25, -45, 45)))
$CameraAnchor.rotate_object_local(Vector3(1,0,0), deg_to_rad(-event.relative.y * 0.25))
if event.is_action_pressed("right_click"):
if selection_block.visible:
- var point = selection_block.global_position + $CameraAnchor/Camera/RayCast3D.get_collision_normal()
- (get_tree().current_scene as World).add_block(point, $CanvasLayer/MarginContainer.active_type)
+ var point = (
+ $CameraAnchor/Camera/RayCast3D.get_collision_point() +
+ $CameraAnchor/Camera/RayCast3D.get_collision_normal() * (Block.BLOCK_SIZE * 0.5)
+ )
+
+ var q := PhysicsShapeQueryParameters3D.new()
+ q.shape = BoxShape3D.new()
+ q.transform = Transform3D(Basis(Vector3.ZERO,Vector3.ZERO,Vector3.ZERO), point)
+ var collision := get_world_3d().direct_space_state.intersect_shape(q)
+
+ if collision.is_empty():
+ (get_tree().current_scene as World).add_block(
+ $CameraAnchor/Camera/RayCast3D.get_collision_point(),
+ $CameraAnchor/Camera/RayCast3D.get_collision_normal(),
+ $CanvasLayer/MarginContainer.active_type
+ )
if event.is_action_pressed("left_click"):
if selection_block.visible:
- var point = selection_block.global_position
- var chunk_idx := Chunk.global_to_chunk(point)
- if Chunk.chunk_exists(chunk_idx.x, chunk_idx.y, chunk_idx.z):
- var chunk: Chunk = Chunk.chunks[chunk_idx.x][chunk_idx.y][chunk_idx.z]
- var block_chunk_idx := Chunk.global_to_chunk_block(point)
- chunk.remove_block(block_chunk_idx)
+ (get_tree().current_scene as World).remove_block(
+ $CameraAnchor/Camera/RayCast3D.get_collision_point(),
+ $CameraAnchor/Camera/RayCast3D.get_collision_normal()
+ )
-func _process(delta: float) -> void:
+func _process(_delta: float) -> void:
if $CameraAnchor/Camera/RayCast3D.is_colliding():
var collider = $CameraAnchor/Camera/RayCast3D.get_collider()
if collider is not StaticBody3D:
return
- var p = $CameraAnchor/Camera/RayCast3D.get_collision_point()
- var n = $CameraAnchor/Camera/RayCast3D.get_collision_normal()
- #var point = $CameraAnchor/Camera/RayCast3D.get_collision_point() - Vector3(1, 1, 1) - $CameraAnchor/Camera/RayCast3D.get_collision_normal()
- #point = $CameraAnchor/Camera/RayCast3D.get_collision_point() - Vector3(0.5, 0.5, 0.5) - $CameraAnchor/Camera/RayCast3D.get_collision_normal()
- var point = $CameraAnchor/Camera/RayCast3D.get_collision_point() - (
- $CameraAnchor/Camera/RayCast3D.get_collision_normal() if $CameraAnchor/Camera/RayCast3D.get_collision_normal() > Vector3.ZERO else Vector3.ZERO
- )
- #point = $CameraAnchor/Camera/RayCast3D.get_collision_point().snapped(Vector3(0.5, 0.5, 0.5))
-
- #var block_idx = floor(point)#floor(point / 2)
- #var chunk_idx = floor(point / 16)#floor(point / (16*2))
- #var block_chunk_idx = Vector3(
- #int(floor(point.x / 2)) % 16,
- #int(floor(point.y / 2)) % 16,
- #int(floor(point.z / 2)) % 16
- #)
- #var block_chunk_idx = block_idx - 16 * chunk_idx
-
- var chunk_idx := Chunk.global_to_chunk(point)
- var block_chunk_idx := Chunk.global_to_chunk_block(point)
-
- #acc += delta
- #if acc / 5 > 1.0:
- #acc = 0
- #print(block_chunk_idx)
- #print(chunk_idx)
- if Chunk.chunk_exists(chunk_idx.x, chunk_idx.y, chunk_idx.z):
- var chunk: Chunk = Chunk.chunks[chunk_idx.x][chunk_idx.y][chunk_idx.z]
- var block: Block = chunk.blocks[block_chunk_idx.x][block_chunk_idx.y][block_chunk_idx.z]
- selection_block.visible = true
- if previous_looked_at_block_position != block.position:
- update_selection_block(block.position)
- previous_looked_at_block_position = block.position
- #print(point, "==", block.position) #??
- #print(Block.Type.keys()[block.type])
+ var point = $CameraAnchor/Camera/RayCast3D.get_collision_point()
+ maybe_update_selection_block(point)
else:
selection_block.visible = false
@@ -114,8 +100,8 @@ func _physics_process(delta: float) -> void:
.rotated(Vector3(0, 0, 1), $CameraAnchor.rotation.z)
)
if direction:
- velocity.x = direction.x * SPEED
- velocity.z = direction.z * SPEED
+ velocity.x = direction.x * SPEED * (2.0 if Input.is_action_pressed("run") else 1.0) * (0.5 if not is_on_floor() else 1.0)
+ velocity.z = direction.z * SPEED * (2.0 if Input.is_action_pressed("run") else 1.0) * (0.5 if not is_on_floor() else 1.0)
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.z = move_toward(velocity.z, 0, SPEED)
@@ -123,6 +109,27 @@ func _physics_process(delta: float) -> void:
move_and_slide()
+func maybe_update_selection_block(collision_point: Vector3) -> void:
+ var chunk_idx := Chunk.global_to_chunk(
+ collision_point,
+ $CameraAnchor/Camera/RayCast3D.get_collision_normal()
+ )
+ var block_chunk_idx := Chunk.global_to_chunk_block(
+ collision_point,
+ $CameraAnchor/Camera/RayCast3D.get_collision_normal()
+ )
+
+ if Chunk.chunk_exists(chunk_idx):
+ var chunk: Chunk = Global.chunks[chunk_idx]
+ var block: Block = chunk.blocks[block_chunk_idx.x][block_chunk_idx.y][block_chunk_idx.z]
+
+ selection_block.visible = true
+
+ if previous_looked_at_block_position != block.position:
+ update_selection_block(block.position)
+ previous_looked_at_block_position = block.position
+
+
func update_selection_block(new_position: Vector3):
var material := preload("res://new_shader_material_selection.tres")
var st = SurfaceTool.new()
@@ -134,3 +141,12 @@ func update_selection_block(new_position: Vector3):
selection_block.global_position = new_position
selection_block.mesh = st.commit()
+
+
+func print_debug_block(message: String, block: Block) -> void:
+ print(
+ message.rpad(6), " => ",
+ block, " ",
+ Block.Type.keys()[block.type].rpad(5), " ",
+ block.generated_faces
+ )
diff --git a/player.gd.uid b/player.gd.uid
new file mode 100644
index 0000000..e0e0efa
--- /dev/null
+++ b/player.gd.uid
@@ -0,0 +1 @@
+uid://bvlgfeu5rty6x
diff --git a/project.godot b/project.godot
index 6321864..d0a61d0 100644
--- a/project.godot
+++ b/project.godot
@@ -12,9 +12,17 @@ config_version=5
config/name="Minecraft"
run/main_scene="res://main.tscn"
-config/features=PackedStringArray("4.3", "GL Compatibility")
+config/features=PackedStringArray("4.4", "GL Compatibility")
config/icon="res://icon.svg"
+[autoload]
+
+Global="*res://global.gd"
+
+[global_group]
+
+player=""
+
[input]
ui_left={
@@ -94,6 +102,46 @@ inventory_bar_slot_3={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":51,"key_label":0,"unicode":51,"location":0,"echo":false,"script":null)
]
}
+run={
+"deadzone": 0.5,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194326,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
+]
+}
+inventory_bar_slot_4={
+"deadzone": 0.5,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":52,"key_label":0,"unicode":52,"location":0,"echo":false,"script":null)
+]
+}
+inventory_bar_slot_5={
+"deadzone": 0.5,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":53,"key_label":0,"unicode":53,"location":0,"echo":false,"script":null)
+]
+}
+inventory_bar_slot_6={
+"deadzone": 0.5,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":54,"key_label":0,"unicode":54,"location":0,"echo":false,"script":null)
+]
+}
+inventory_bar_slot_7={
+"deadzone": 0.5,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":55,"key_label":0,"unicode":55,"location":0,"echo":false,"script":null)
+]
+}
+inventory_bar_slot_8={
+"deadzone": 0.5,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":56,"key_label":0,"unicode":56,"location":0,"echo":false,"script":null)
+]
+}
+inventory_bar_slot_9={
+"deadzone": 0.5,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":57,"key_label":0,"unicode":57,"location":0,"echo":false,"script":null)
+]
+}
+inventory_bar_slot_10={
+"deadzone": 0.5,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":48,"key_label":0,"unicode":48,"location":0,"echo":false,"script":null)
+]
+}
[rendering]