Loads of crap
This commit is contained in:
parent
b5bf7619e6
commit
1dc768ad27
725 changed files with 15096 additions and 191 deletions
|
|
@ -2,39 +2,23 @@
|
|||
extends Node3D
|
||||
class_name GrassController
|
||||
|
||||
# 229379
|
||||
|
||||
@onready var grass_multimesh: MultiMeshInstance3D = $GrassMultimesh
|
||||
var parent_node: GroundTile = null
|
||||
var grass_density: float = 0.5
|
||||
var grass_instance_range: int = 10
|
||||
|
||||
signal grass_data_ready()
|
||||
|
||||
func _ready() -> void:
|
||||
# Use call_deferred to ensure parent is fully ready
|
||||
call_deferred("_setup_connections")
|
||||
|
||||
func _setup_connections() -> void:
|
||||
parent_node = get_parent() as GroundTile
|
||||
if parent_node == null:
|
||||
Log.pr("Error: Parent node is not a GroundTile!")
|
||||
return
|
||||
|
||||
parent_node.cell_info_updated.connect(_on_parent_data_changed)
|
||||
|
||||
# Check if cell_info already exists and process it
|
||||
if parent_node.cell_info != null:
|
||||
_on_parent_data_changed(parent_node.cell_info)
|
||||
|
||||
func _on_parent_data_changed(value):
|
||||
func spawn_grass_for_cell(value):
|
||||
if value == null:
|
||||
return
|
||||
|
||||
grass_density = value.vegetation_density
|
||||
|
||||
update_grass_density()
|
||||
|
||||
grass_data_ready.emit()
|
||||
|
||||
if grass_multimesh and grass_multimesh.has_method("setup_multimesh"):
|
||||
grass_multimesh.setup_multimesh()
|
||||
|
||||
func update_grass_density() -> void:
|
||||
if parent_node == null or parent_node.rng == null:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue