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,81 @@
[gd_resource type="Resource" script_class="TreeDataCollection" load_steps=11 format=3 uid="uid://buf5mtxc5f7o"]
[ext_resource type="Script" uid="uid://dj4dhsd0m0bvd" path="res://Entities/Tree/resources/TreeDataCollection.gd" id="1_7y4l8"]
[ext_resource type="Script" uid="uid://cdudelqysppwl" path="res://Entities/Tree/resources/TreeDataResource.gd" id="2_4yk3p"]
[ext_resource type="PackedScene" uid="uid://g74ar24o4s1" path="res://Entities/Tree/assets/tree_oak.glb" id="3_4yk3p"]
[ext_resource type="PackedScene" uid="uid://bwhpbjdyl577e" path="res://Entities/Tree/assets/tree.glb" id="4_4wxxs"]
[ext_resource type="PackedScene" uid="uid://besaean4w1n83" path="res://Entities/Tree/assets/tree_birch.glb" id="5_35hba"]
[ext_resource type="PackedScene" uid="uid://b3lc1nbuv5ol8" path="res://Entities/Tree/assets/tree_detailed.glb" id="6_ibfiw"]
[sub_resource type="Resource" id="Resource_7y4l8"]
script = ExtResource("2_4yk3p")
tree_name = "Oak"
model = ExtResource("3_4yk3p")
growth_stages = Array[PackedScene]([])
temperature_range = Vector2(0.4, 0.9)
moisture_range = Vector2(0.3, 0.8)
elevation_range = Vector2(0.1, 0.5)
max_height = 15.0
growth_time = 120.0
spawn_probability = 0.1
spread_radius = 5.0
seasonal_models = Array[PackedScene]([])
drops_leaves = true
leaf_color_variations = Array[Color]([])
metadata/_custom_type_script = "uid://cdudelqysppwl"
[sub_resource type="Resource" id="Resource_35hba"]
script = ExtResource("2_4yk3p")
tree_name = "Pine"
model = ExtResource("4_4wxxs")
growth_stages = Array[PackedScene]([])
temperature_range = Vector2(0.1, 0.6)
moisture_range = Vector2(0.2, 0.6)
elevation_range = Vector2(0.7, 1)
max_height = 15.0
growth_time = 120.0
spawn_probability = 0.1
spread_radius = 5.0
seasonal_models = Array[PackedScene]([])
drops_leaves = true
leaf_color_variations = Array[Color]([])
metadata/_custom_type_script = "uid://cdudelqysppwl"
[sub_resource type="Resource" id="Resource_4wxxs"]
script = ExtResource("2_4yk3p")
tree_name = "Birch"
model = ExtResource("5_35hba")
growth_stages = Array[PackedScene]([])
temperature_range = Vector2(0.2, 0.7)
moisture_range = Vector2(0.5, 0.6)
elevation_range = Vector2(0.1, 0.5)
max_height = 15.0
growth_time = 120.0
spawn_probability = 0.1
spread_radius = 5.0
seasonal_models = Array[PackedScene]([])
drops_leaves = true
leaf_color_variations = Array[Color]([])
metadata/_custom_type_script = "uid://cdudelqysppwl"
[sub_resource type="Resource" id="Resource_54eyh"]
script = ExtResource("2_4yk3p")
tree_name = "Elder"
model = ExtResource("6_ibfiw")
growth_stages = Array[PackedScene]([])
temperature_range = Vector2(0.3, 0.8)
moisture_range = Vector2(0.7, 1)
elevation_range = Vector2(0, 0.2)
max_height = 15.0
growth_time = 120.0
spawn_probability = 0.1
spread_radius = 5.0
seasonal_models = Array[PackedScene]([])
drops_leaves = true
leaf_color_variations = Array[Color]([])
metadata/_custom_type_script = "uid://cdudelqysppwl"
[resource]
script = ExtResource("1_7y4l8")
trees = Array[ExtResource("2_4yk3p")]([SubResource("Resource_7y4l8"), SubResource("Resource_35hba"), SubResource("Resource_4wxxs"), SubResource("Resource_54eyh")])
metadata/_custom_type_script = "uid://dj4dhsd0m0bvd"

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

View file

@ -0,0 +1 @@
uid://dj4dhsd0m0bvd

View file

@ -0,0 +1,23 @@
class_name TreeDataResource
extends Resource
@export var tree_name: String = "Oak Tree"
@export var model: PackedScene
@export var icon: Texture2D
@export var growth_stages: Array[PackedScene] = []
@export_group("Biome Preferences")
@export var temperature_range: Vector2 = Vector2(0.3, 0.7) # Min/Max temperature
@export var moisture_range: Vector2 = Vector2(0.4, 0.8) # Min/Max moisture
@export var elevation_range: Vector2 = Vector2(0.0, 0.6) # Min/Max elevation
@export_group("Growth Properties")
@export var max_height: float = 15.0
@export var growth_time: float = 120.0 # Seconds to full growth
@export var spawn_probability: float = 0.1
@export var spread_radius: float = 5.0
@export_group("Seasonal Behavior")
@export var seasonal_models: Array[PackedScene] = [] # Spring, Summer, Fall, Winter
@export var drops_leaves: bool = true
@export var leaf_color_variations: Array[Color] = []

View file

@ -0,0 +1 @@
uid://cdudelqysppwl