Tree collisions and highlights

This commit is contained in:
Dan Baker 2025-06-26 18:28:33 +01:00
parent 57602adddb
commit 7255cbdf64
17 changed files with 231 additions and 2251 deletions

View file

@ -1,7 +1,5 @@
# 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
@ -9,17 +7,22 @@ var grid_x: int
var grid_z: int
var cell_info: CellDataResource = null
var spawners_ready: bool = false
var rng: RandomClass = RandomClass.new()
var cached_rng: RandomClass = null
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)
spawn_content()
update_text_label()
func get_rng() -> RandomClass:
if cached_rng == null and cell_info:
cached_rng = RandomClass.get_seeded_instance(cell_info.cell_seed)
elif cached_rng == null:
cached_rng = RandomClass.get_shared_instance()
return cached_rng
func set_grid_location(x, z) -> void:
grid_x = x