Much stuff wow
This commit is contained in:
parent
7255cbdf64
commit
734730beee
45 changed files with 697 additions and 119 deletions
20
Entities/Tree/resources/TreeDataCollection.gd
Normal file
20
Entities/Tree/resources/TreeDataCollection.gd
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue