class_name TreeDataCollection
extends Resource

@export var trees: Array[TreeDataResource] = []

# Helper functions
func get_tree_by_name(name: String) -> TreeDataResource:
	for tree in trees:
		if tree.tree_name == name:
			return tree
	return null

func get_suitable_trees(temperature: float, moisture: float, elevation: float) -> Array[TreeDataResource]:
	var suitable_trees: Array[TreeDataResource] = []
	for tree in trees:
		if (temperature >= tree.temperature_range.x and temperature <= tree.temperature_range.y and
			moisture >= tree.moisture_range.x and moisture <= tree.moisture_range.y and
			elevation >= tree.elevation_range.x and elevation <= tree.elevation_range.y):
			suitable_trees.append(tree)
	return suitable_trees