Loads of crap

This commit is contained in:
Dan Baker 2025-06-26 14:46:23 +01:00
parent b5bf7619e6
commit 1dc768ad27
725 changed files with 15096 additions and 191 deletions

View file

@ -1,22 +1,22 @@
# GroundTile.gd
class_name GroundTile
extends Node3D
@onready var debug_text: Label = $DebugText/DebugTextViewport/DebugTextLabel
@onready var tree_spawner = $Trees
@onready var grass_spawner = $Grass
var grid_x: int
var grid_z: int
var cell_info: CellDataResource = null:
set(value):
cell_info = value
if cell_info != null:
cell_info_updated.emit(value)
var cell_info: CellDataResource = null
var spawners_ready: bool = false
var rng: RandomClass = RandomClass.new()
signal cell_info_updated(value)
func _ready() -> void:
spawners_ready = true
# Now that spawners are ready, trigger spawning if we have cell_info
if cell_info != null:
spawn_content()
update_text_label()
rng.set_seed(cell_info.cell_seed)
@ -24,6 +24,19 @@ func set_grid_location(x, z) -> void:
grid_x = x
grid_z = z
cell_info = MapData.get_map_data(grid_x, grid_z)
# Only spawn if spawners are ready
if spawners_ready and cell_info != null:
spawn_content()
func spawn_content():
if cell_info == null:
return
if tree_spawner:
tree_spawner.spawn_trees_for_cell(cell_info)
if grass_spawner:
grass_spawner.spawn_grass_for_cell(cell_info)
func update_text_label() -> void:
debug_text.text = str(grid_x) + ', ' + str(grid_z) + ', ' + str(cell_info.cell_seed)
debug_text.text = str(cell_info.vegetation_density)