Much stuff wow

This commit is contained in:
Dan Baker 2025-06-27 11:58:59 +01:00
parent 7255cbdf64
commit 734730beee
45 changed files with 697 additions and 119 deletions

View file

@ -0,0 +1,20 @@
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