Densité de partie de plantes en fonction du niveau de mutation
This commit is contained in:
@@ -12,7 +12,6 @@
|
|||||||
[ext_resource type="Resource" uid="uid://cyfyodtfxne1w" path="res://entities/plants/resources/plant_parts/Branch5.tres" id="8_qm7aw"]
|
[ext_resource type="Resource" uid="uid://cyfyodtfxne1w" path="res://entities/plants/resources/plant_parts/Branch5.tres" id="8_qm7aw"]
|
||||||
[ext_resource type="Resource" uid="uid://cuvtf4y1dspcp" path="res://entities/plants/resources/plant_parts/Branch6.tres" id="9_3e4c1"]
|
[ext_resource type="Resource" uid="uid://cuvtf4y1dspcp" path="res://entities/plants/resources/plant_parts/Branch6.tres" id="9_3e4c1"]
|
||||||
[ext_resource type="Resource" uid="uid://dcjpei6xuiswp" path="res://entities/plants/resources/plant_parts/LeafE5.tres" id="10_5job5"]
|
[ext_resource type="Resource" uid="uid://dcjpei6xuiswp" path="res://entities/plants/resources/plant_parts/LeafE5.tres" id="10_5job5"]
|
||||||
[ext_resource type="Resource" uid="uid://cqxmyd07qyj4g" path="res://entities/plants/resources/plant_parts/LeafE6.tres" id="11_cynqk"]
|
|
||||||
[ext_resource type="Resource" uid="uid://85bwx2tdjx0h" path="res://entities/plants/resources/plant_parts/LeafE7.tres" id="12_b21au"]
|
[ext_resource type="Resource" uid="uid://85bwx2tdjx0h" path="res://entities/plants/resources/plant_parts/LeafE7.tres" id="12_b21au"]
|
||||||
[ext_resource type="Resource" uid="uid://6jnbms553dyd" path="res://entities/plants/resources/plant_parts/Branch7.tres" id="12_yjh7s"]
|
[ext_resource type="Resource" uid="uid://6jnbms553dyd" path="res://entities/plants/resources/plant_parts/Branch7.tres" id="12_yjh7s"]
|
||||||
[ext_resource type="Resource" uid="uid://cowkewtw2lg4i" path="res://entities/plants/resources/plant_parts/FlowerA1.tres" id="13_17ac3"]
|
[ext_resource type="Resource" uid="uid://cowkewtw2lg4i" path="res://entities/plants/resources/plant_parts/FlowerA1.tres" id="13_17ac3"]
|
||||||
@@ -47,9 +46,11 @@
|
|||||||
[ext_resource type="Resource" uid="uid://bkgrwffi7m2i4" path="res://entities/plants/resources/plant_parts/FlowerC4.tres" id="24_rbd7l"]
|
[ext_resource type="Resource" uid="uid://bkgrwffi7m2i4" path="res://entities/plants/resources/plant_parts/FlowerC4.tres" id="24_rbd7l"]
|
||||||
[ext_resource type="Resource" uid="uid://dm7crxxg4kmw5" path="res://entities/plants/resources/plant_parts/LeafB1.tres" id="25_kvmj5"]
|
[ext_resource type="Resource" uid="uid://dm7crxxg4kmw5" path="res://entities/plants/resources/plant_parts/LeafB1.tres" id="25_kvmj5"]
|
||||||
[ext_resource type="Resource" uid="uid://vlxrq3tw1t6m" path="res://entities/plants/resources/plant_parts/LeafB2.tres" id="26_ocu7e"]
|
[ext_resource type="Resource" uid="uid://vlxrq3tw1t6m" path="res://entities/plants/resources/plant_parts/LeafB2.tres" id="26_ocu7e"]
|
||||||
|
[ext_resource type="Script" path="res://entities/plants/scripts/texture_builder/plant_attach.gd" id="27_80nvf"]
|
||||||
[ext_resource type="Resource" uid="uid://bdwhp12xkvscr" path="res://entities/plants/resources/plant_parts/LeafB3.tres" id="27_q771y"]
|
[ext_resource type="Resource" uid="uid://bdwhp12xkvscr" path="res://entities/plants/resources/plant_parts/LeafB3.tres" id="27_q771y"]
|
||||||
[ext_resource type="Resource" uid="uid://cc8kkqiqdvex6" path="res://entities/plants/resources/plant_parts/LeafE8.tres" id="27_rcays"]
|
[ext_resource type="Resource" uid="uid://cc8kkqiqdvex6" path="res://entities/plants/resources/plant_parts/LeafE8.tres" id="27_rcays"]
|
||||||
[ext_resource type="Resource" uid="uid://dmfiww0l5ha2l" path="res://entities/plants/resources/plant_parts/LeafB4.tres" id="28_5fbyu"]
|
[ext_resource type="Resource" uid="uid://dmfiww0l5ha2l" path="res://entities/plants/resources/plant_parts/LeafB4.tres" id="28_5fbyu"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bdwmandgxrjgn" path="res://entities/plants/assets/sprites/asset_plantes.png" id="28_d04mb"]
|
||||||
[ext_resource type="Resource" uid="uid://cusd2od1yj0ob" path="res://entities/plants/resources/plant_parts/LeafE9.tres" id="28_qs4je"]
|
[ext_resource type="Resource" uid="uid://cusd2od1yj0ob" path="res://entities/plants/resources/plant_parts/LeafE9.tres" id="28_qs4je"]
|
||||||
[ext_resource type="Resource" uid="uid://kiim46eda050" path="res://entities/plants/resources/plant_parts/LeafB5.tres" id="29_2plsj"]
|
[ext_resource type="Resource" uid="uid://kiim46eda050" path="res://entities/plants/resources/plant_parts/LeafB5.tres" id="29_2plsj"]
|
||||||
[ext_resource type="Resource" uid="uid://dqroc7h70bgew" path="res://entities/plants/resources/plant_parts/LeafB6.tres" id="30_yjh7s"]
|
[ext_resource type="Resource" uid="uid://dqroc7h70bgew" path="res://entities/plants/resources/plant_parts/LeafB6.tres" id="30_yjh7s"]
|
||||||
@@ -128,9 +129,31 @@
|
|||||||
[ext_resource type="Resource" uid="uid://c70ikd1qfmqqs" path="res://entities/plants/resources/plant_parts/LeafK6.tres" id="116_xxckx"]
|
[ext_resource type="Resource" uid="uid://c70ikd1qfmqqs" path="res://entities/plants/resources/plant_parts/LeafK6.tres" id="116_xxckx"]
|
||||||
[ext_resource type="Resource" uid="uid://bhgnimmagff30" path="res://entities/plants/resources/plant_parts/LeafK7.tres" id="117_s3ec7"]
|
[ext_resource type="Resource" uid="uid://bhgnimmagff30" path="res://entities/plants/resources/plant_parts/LeafK7.tres" id="117_s3ec7"]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_us16y"]
|
||||||
|
script = ExtResource("27_80nvf")
|
||||||
|
position = Vector2(-36, -37)
|
||||||
|
attach_types = Array[int]([2])
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_ux8f6"]
|
||||||
|
script = ExtResource("27_80nvf")
|
||||||
|
position = Vector2(59, -81)
|
||||||
|
attach_types = Array[int]([1, 3])
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_yh7e0"]
|
||||||
|
atlas = ExtResource("28_d04mb")
|
||||||
|
region = Rect2(2804, 1567, 294, 345)
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_6htke"]
|
||||||
|
resource_name = "LeafE6"
|
||||||
|
script = ExtResource("2_cfiqo")
|
||||||
|
texture = SubResource("AtlasTexture_yh7e0")
|
||||||
|
type = 2
|
||||||
|
root = SubResource("Resource_ux8f6")
|
||||||
|
attaches = Array[ExtResource("27_80nvf")]([SubResource("Resource_us16y")])
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_rt6tw"]
|
[sub_resource type="Resource" id="Resource_rt6tw"]
|
||||||
script = ExtResource("16_c3tk3")
|
script = ExtResource("16_c3tk3")
|
||||||
parts = Array[ExtResource("2_cfiqo")]([ExtResource("15_p2blu"), ExtResource("16_xt8tm"), ExtResource("17_qm7aw"), ExtResource("42_14c4k"), ExtResource("10_5job5"), ExtResource("11_cynqk"), ExtResource("12_b21au"), ExtResource("27_rcays"), ExtResource("28_qs4je")])
|
parts = Array[ExtResource("2_cfiqo")]([ExtResource("15_p2blu"), ExtResource("16_xt8tm"), ExtResource("17_qm7aw"), ExtResource("42_14c4k"), ExtResource("10_5job5"), SubResource("Resource_6htke"), ExtResource("12_b21au"), ExtResource("27_rcays"), ExtResource("28_qs4je")])
|
||||||
metadata/_custom_type_script = "uid://cfjd8jelpm8dt"
|
metadata/_custom_type_script = "uid://cfjd8jelpm8dt"
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_y02ao"]
|
[sub_resource type="Resource" id="Resource_y02ao"]
|
||||||
@@ -246,10 +269,10 @@ parts_mutation_associations = Dictionary[String, ExtResource("16_c3tk3")]({
|
|||||||
"TOUGH": SubResource("Resource_jbu3q"),
|
"TOUGH": SubResource("Resource_jbu3q"),
|
||||||
"VIVACIOUS": SubResource("Resource_0wuoa")
|
"VIVACIOUS": SubResource("Resource_0wuoa")
|
||||||
})
|
})
|
||||||
chance_to_have_part = 0.9
|
chance_to_have_part = 1.0
|
||||||
origin_weights_base = Dictionary[int, int]({
|
origin_weights_base = Dictionary[int, int]({
|
||||||
0: 20,
|
0: 100,
|
||||||
1: 10,
|
1: 0,
|
||||||
2: 2
|
2: 20
|
||||||
})
|
})
|
||||||
seed_texture_sets = Array[ExtResource("47_jbu3q")]([SubResource("Resource_cynqk"), SubResource("Resource_17ac3")])
|
seed_texture_sets = Array[ExtResource("47_jbu3q")]([SubResource("Resource_cynqk"), SubResource("Resource_17ac3")])
|
||||||
|
|||||||
@@ -4,29 +4,36 @@
|
|||||||
[ext_resource type="Script" uid="uid://c360ic1aost1n" path="res://entities/plants/scripts/texture_builder/plant_part_builder.gd" id="2_a5yje"]
|
[ext_resource type="Script" uid="uid://c360ic1aost1n" path="res://entities/plants/scripts/texture_builder/plant_part_builder.gd" id="2_a5yje"]
|
||||||
[ext_resource type="Script" path="res://entities/plants/scripts/texture_builder/plant_attach_builder.gd" id="3_yh7e0"]
|
[ext_resource type="Script" path="res://entities/plants/scripts/texture_builder/plant_attach_builder.gd" id="3_yh7e0"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_khbsd"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_yh7e0"]
|
||||||
atlas = ExtResource("1_yh7e0")
|
atlas = ExtResource("1_yh7e0")
|
||||||
region = Rect2(4497, 2359, 335, 454)
|
region = Rect2(3118, 1700, 367, 440)
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite2D" unique_id=1642167049 node_paths=PackedStringArray("root", "attaches")]
|
[node name="Sprite" type="Sprite2D" unique_id=1642167049 node_paths=PackedStringArray("root", "attaches")]
|
||||||
texture = SubResource("AtlasTexture_khbsd")
|
texture = SubResource("AtlasTexture_yh7e0")
|
||||||
script = ExtResource("2_a5yje")
|
script = ExtResource("2_a5yje")
|
||||||
part_name = "Base3"
|
part_name = "LeafE6"
|
||||||
|
type = 2
|
||||||
root = NodePath("Root")
|
root = NodePath("Root")
|
||||||
attaches = NodePath("Attaches")
|
attaches = NodePath("Attaches")
|
||||||
|
|
||||||
[node name="Root" type="Node2D" parent="." unique_id=1437082577]
|
[node name="Root" type="Node2D" parent="." unique_id=1437082577]
|
||||||
position = Vector2(15, 184)
|
position = Vector2(40, -66)
|
||||||
script = ExtResource("3_yh7e0")
|
script = ExtResource("3_yh7e0")
|
||||||
|
attach_types = Array[int]([1])
|
||||||
|
|
||||||
[node name="Attaches" type="Node" parent="." unique_id=1834697767]
|
[node name="Attaches" type="Node" parent="." unique_id=1834697767]
|
||||||
|
|
||||||
[node name="attach2" type="Node2D" parent="Attaches" unique_id=1063061640]
|
[node name="attach2" type="Node2D" parent="Attaches" unique_id=1063061640]
|
||||||
position = Vector2(-89, 45)
|
position = Vector2(-46, 17)
|
||||||
script = ExtResource("3_yh7e0")
|
script = ExtResource("3_yh7e0")
|
||||||
attach_types = Array[int]([3])
|
attach_types = Array[int]([2])
|
||||||
|
|
||||||
[node name="attach4" type="Node2D" parent="Attaches" unique_id=451232079]
|
[node name="attach1" type="Node2D" parent="Attaches" unique_id=539833351]
|
||||||
position = Vector2(-7, -161)
|
position = Vector2(116, 72)
|
||||||
|
script = ExtResource("3_yh7e0")
|
||||||
|
attach_types = Array[int]([2])
|
||||||
|
|
||||||
|
[node name="@Node2D@32601" type="Node2D" parent="Attaches" unique_id=2139586007]
|
||||||
|
position = Vector2(-38, -137)
|
||||||
script = ExtResource("3_yh7e0")
|
script = ExtResource("3_yh7e0")
|
||||||
attach_types = Array[int]([2])
|
attach_types = Array[int]([2])
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_resource type="Resource" script_class="PlantPart" format=3 uid="uid://cewwsxddmw36t"]
|
[gd_resource type="Resource" script_class="PlantPart" format=3 uid="uid://cewwsxddmw36t"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://co46ywm8bgnfh" path="res://entities/plants/scripts/texture_builder/plant_attach.gd" id="1_ef00k"]
|
[ext_resource type="Script" path="res://entities/plants/scripts/texture_builder/plant_attach.gd" id="1_ef00k"]
|
||||||
[ext_resource type="Script" uid="uid://b3jwglylqdqtw" path="res://entities/plants/scripts/texture_builder/plant_part.gd" id="2_0qgsw"]
|
[ext_resource type="Script" uid="uid://b3jwglylqdqtw" path="res://entities/plants/scripts/texture_builder/plant_part.gd" id="2_0qgsw"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bxnm1quxhx40i" path="res://entities/plants/assets/sprites/asset-plante-fin_assemble.png" id="3_snml7"]
|
[ext_resource type="Texture2D" uid="uid://bxnm1quxhx40i" path="res://entities/plants/assets/sprites/asset-plante-fin_assemble.png" id="3_snml7"]
|
||||||
|
|
||||||
|
|||||||
@@ -6,22 +6,32 @@
|
|||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_us16y"]
|
[sub_resource type="Resource" id="Resource_us16y"]
|
||||||
script = ExtResource("1_us16y")
|
script = ExtResource("1_us16y")
|
||||||
position = Vector2(-36, -37)
|
position = Vector2(-46, 17)
|
||||||
attach_types = Array[int]([2])
|
attach_types = Array[int]([2])
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_ux8f6"]
|
[sub_resource type="Resource" id="Resource_ux8f6"]
|
||||||
script = ExtResource("1_us16y")
|
script = ExtResource("1_us16y")
|
||||||
position = Vector2(59, -81)
|
position = Vector2(116, 72)
|
||||||
attach_types = Array[int]([1, 3])
|
attach_types = Array[int]([2])
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_qn1v0"]
|
||||||
|
script = ExtResource("1_us16y")
|
||||||
|
position = Vector2(-38, -137)
|
||||||
|
attach_types = Array[int]([2])
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_l0344"]
|
||||||
|
script = ExtResource("1_us16y")
|
||||||
|
position = Vector2(40, -66)
|
||||||
|
attach_types = Array[int]([1])
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yh7e0"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_yh7e0"]
|
||||||
atlas = ExtResource("3_qn1v0")
|
atlas = ExtResource("3_qn1v0")
|
||||||
region = Rect2(2804, 1567, 294, 345)
|
region = Rect2(3118, 1700, 367, 440)
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
resource_name = "LeafE6"
|
resource_name = "LeafE6"
|
||||||
script = ExtResource("2_ux8f6")
|
script = ExtResource("2_ux8f6")
|
||||||
texture = SubResource("AtlasTexture_yh7e0")
|
texture = SubResource("AtlasTexture_yh7e0")
|
||||||
type = 2
|
type = 2
|
||||||
root = SubResource("Resource_ux8f6")
|
root = SubResource("Resource_l0344")
|
||||||
attaches = Array[ExtResource("1_us16y")]([SubResource("Resource_us16y")])
|
attaches = Array[ExtResource("1_us16y")]([SubResource("Resource_us16y"), SubResource("Resource_ux8f6"), SubResource("Resource_qn1v0")])
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ extends Node
|
|||||||
@export var start_state: PlantData.State = PlantData.State.MATURE
|
@export var start_state: PlantData.State = PlantData.State.MATURE
|
||||||
@export var random_state := false
|
@export var random_state := false
|
||||||
@export var end_state: PlantData.State = PlantData.State.MATURE
|
@export var end_state: PlantData.State = PlantData.State.MATURE
|
||||||
|
@export var min_level := 1
|
||||||
|
@export var max_level := 1
|
||||||
|
|
||||||
@export var camera_speed := 1000.0
|
@export var camera_speed := 1000.0
|
||||||
|
|
||||||
var input_dir := Vector2.ZERO
|
var input_dir := Vector2.ZERO
|
||||||
@@ -21,6 +24,10 @@ func _ready():
|
|||||||
%NMutationsPerPlant.value = n_mutation_per_plant
|
%NMutationsPerPlant.value = n_mutation_per_plant
|
||||||
%RandomizePos.button_pressed = randomize_pos
|
%RandomizePos.button_pressed = randomize_pos
|
||||||
%RandomizeOffset.value = random_pos_offset
|
%RandomizeOffset.value = random_pos_offset
|
||||||
|
%toAgeLabel.visible = random_state
|
||||||
|
%EndAge.visible = random_state
|
||||||
|
%MinLvl.value = min_level
|
||||||
|
%MaxLvl.value = max_level
|
||||||
generate_plants();
|
generate_plants();
|
||||||
|
|
||||||
func _unhandled_key_input(_event) -> void:
|
func _unhandled_key_input(_event) -> void:
|
||||||
@@ -54,7 +61,9 @@ func generate_plants():
|
|||||||
elif plant_state == PlantData.State.DEAD:
|
elif plant_state == PlantData.State.DEAD:
|
||||||
plant_data.day = plant_data.get_lifetime()
|
plant_data.day = plant_data.get_lifetime()
|
||||||
for j in n_mutation_per_plant:
|
for j in n_mutation_per_plant:
|
||||||
plant_data.mutations.append(GameInfo.game_data.progression_data.available_mutations.pick_random())
|
var picked_mutation: PlantMutation = GameInfo.game_data.progression_data.available_mutations.pick_random().duplicate()
|
||||||
|
picked_mutation.level = randi_range(min_level, max_level)
|
||||||
|
plant_data.mutations.append(picked_mutation)
|
||||||
var plant: Plant = Plant.new(plant_data)
|
var plant: Plant = Plant.new(plant_data)
|
||||||
print(plant.data.plant_name)
|
print(plant.data.plant_name)
|
||||||
%Plants.add_child(plant)
|
%Plants.add_child(plant)
|
||||||
@@ -113,14 +122,20 @@ func _on_start_age_value_changed(value: float) -> void:
|
|||||||
|
|
||||||
func _on_random_age_toggled(toggled_on: bool) -> void:
|
func _on_random_age_toggled(toggled_on: bool) -> void:
|
||||||
random_state = toggled_on
|
random_state = toggled_on
|
||||||
|
%toAgeLabel.visible = toggled_on
|
||||||
|
%EndAge.visible = toggled_on
|
||||||
|
|
||||||
func _on_end_age_value_changed(value: float) -> void:
|
func _on_end_age_value_changed(value: float) -> void:
|
||||||
end_state = int(value) as PlantData.State
|
end_state = int(value) as PlantData.State
|
||||||
|
|
||||||
|
|
||||||
func _on_speed_value_changed(value: float) -> void:
|
func _on_speed_value_changed(value: float) -> void:
|
||||||
camera_speed = value
|
camera_speed = value
|
||||||
|
|
||||||
|
|
||||||
func _on_reset_speed_pressed() -> void:
|
func _on_reset_speed_pressed() -> void:
|
||||||
camera_speed = 1000
|
camera_speed = 1000
|
||||||
|
|
||||||
|
func _on_min_lvl_value_changed(value: float) -> void:
|
||||||
|
min_level = int(value)
|
||||||
|
|
||||||
|
func _on_max_lvl_value_changed(value: float) -> void:
|
||||||
|
max_level = int(value)
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ enum OriginType {BRANCH_ORIGIN, MUTATION_ORIGIN, BASE_LEAF_ORIGIN}
|
|||||||
@export var mutation_weight_base := 10
|
@export var mutation_weight_base := 10
|
||||||
@export var mutation_weight_loss := 3
|
@export var mutation_weight_loss := 3
|
||||||
@export var mutation_weight_gain := 1
|
@export var mutation_weight_gain := 1
|
||||||
|
|
||||||
@export var seed_texture_sets: Array[SeedTextureSet]
|
@export var seed_texture_sets: Array[SeedTextureSet]
|
||||||
|
|
||||||
@export var base_y_offset := -50.0
|
@export var base_y_offset := -50.0
|
||||||
@@ -75,6 +76,9 @@ func shuffle_weighted(array: Array, weights: Array[int]):
|
|||||||
array[i] = originalArray[indices[i]]
|
array[i] = originalArray[indices[i]]
|
||||||
weights[i] = originalWeights[indices[i]]
|
weights[i] = originalWeights[indices[i]]
|
||||||
|
|
||||||
|
func get_mutation_weight(level: int) -> int:
|
||||||
|
return 3 * level
|
||||||
|
|
||||||
func build_seed_texture(random_seed: int) -> Texture:
|
func build_seed_texture(random_seed: int) -> Texture:
|
||||||
rng.seed = random_seed
|
rng.seed = random_seed
|
||||||
|
|
||||||
@@ -129,7 +133,9 @@ func build_plant_texture(plant_data: PlantData) -> Texture:
|
|||||||
for mutation in plant_data.mutations:
|
for mutation in plant_data.mutations:
|
||||||
if mutation.id in parts_mutation_associations:
|
if mutation.id in parts_mutation_associations:
|
||||||
parts_to_place[OriginType.MUTATION_ORIGIN].append(parts_mutation_associations[mutation.id].parts)
|
parts_to_place[OriginType.MUTATION_ORIGIN].append(parts_mutation_associations[mutation.id].parts)
|
||||||
mutation_weights.append(mutation_weight_base)
|
var mutation_weight := get_mutation_weight(mutation.level)
|
||||||
|
mutation_weights.append(mutation_weight)
|
||||||
|
weight_per_origin_type[OriginType.MUTATION_ORIGIN] += mutation_weight
|
||||||
|
|
||||||
var flipped: bool = rng.randi() % 2 == 0
|
var flipped: bool = rng.randi() % 2 == 0
|
||||||
|
|
||||||
@@ -195,6 +201,9 @@ func get_part(all_parts: Dictionary[OriginType, Array], weight_per_origin_type:
|
|||||||
weight_per_origin_type[((origin + 2) % 3) as OriginType] += origin_weight_gain
|
weight_per_origin_type[((origin + 2) % 3) as OriginType] += origin_weight_gain
|
||||||
return all_parts[origin][ind]
|
return all_parts[origin][ind]
|
||||||
else: # find a mutation part to place
|
else: # find a mutation part to place
|
||||||
|
if weight_copy[originIndInd] < 0:
|
||||||
|
break
|
||||||
|
|
||||||
var parts_per_mutations: Array = all_parts[origin]
|
var parts_per_mutations: Array = all_parts[origin]
|
||||||
shuffle_weighted(parts_per_mutations, mutation_weights)
|
shuffle_weighted(parts_per_mutations, mutation_weights)
|
||||||
for mutation_parts_ind in range(parts_per_mutations.size()):
|
for mutation_parts_ind in range(parts_per_mutations.size()):
|
||||||
|
|||||||
@@ -136,16 +136,41 @@ layout_mode = 2
|
|||||||
|
|
||||||
[node name="Label2" type="Label" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/AgeContainer" unique_id=115359272]
|
[node name="Label2" type="Label" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/AgeContainer" unique_id=115359272]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "rand"
|
text = "rand :"
|
||||||
|
|
||||||
[node name="RandomAge" type="CheckBox" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/AgeContainer" unique_id=632428890]
|
[node name="RandomAge" type="CheckBox" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/AgeContainer" unique_id=632428890]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Label3" type="Label" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/AgeContainer" unique_id=1871497862]
|
[node name="toAgeLabel" type="Label" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/AgeContainer" unique_id=1871497862]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "to"
|
text = "to"
|
||||||
|
|
||||||
[node name="EndAge" type="SpinBox" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/AgeContainer" unique_id=155079103]
|
[node name="EndAge" type="SpinBox" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/AgeContainer" unique_id=155079103]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="MutationLvlContainer" type="HBoxContainer" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer" unique_id=245717208]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/MutationLvlContainer" unique_id=1071712301]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Mutation level : "
|
||||||
|
|
||||||
|
[node name="Label2" type="Label" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/MutationLvlContainer" unique_id=1969438517]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Min"
|
||||||
|
|
||||||
|
[node name="MinLvl" type="SpinBox" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/MutationLvlContainer" unique_id=443508962]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label3" type="Label" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/MutationLvlContainer" unique_id=883703881]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Max"
|
||||||
|
|
||||||
|
[node name="MaxLvl" type="SpinBox" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/MutationLvlContainer" unique_id=615247987]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="PossibleMutations" type="FoldableContainer" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer" unique_id=71622472]
|
[node name="PossibleMutations" type="FoldableContainer" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer" unique_id=71622472]
|
||||||
@@ -179,3 +204,5 @@ tile_set = ExtResource("3_3mb6h")
|
|||||||
[connection signal="value_changed" from="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/AgeContainer/StartAge" to="." method="_on_start_age_value_changed"]
|
[connection signal="value_changed" from="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/AgeContainer/StartAge" to="." method="_on_start_age_value_changed"]
|
||||||
[connection signal="toggled" from="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/AgeContainer/RandomAge" to="." method="_on_random_age_toggled"]
|
[connection signal="toggled" from="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/AgeContainer/RandomAge" to="." method="_on_random_age_toggled"]
|
||||||
[connection signal="value_changed" from="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/AgeContainer/EndAge" to="." method="_on_end_age_value_changed"]
|
[connection signal="value_changed" from="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/AgeContainer/EndAge" to="." method="_on_end_age_value_changed"]
|
||||||
|
[connection signal="value_changed" from="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/MutationLvlContainer/MinLvl" to="." method="_on_min_lvl_value_changed"]
|
||||||
|
[connection signal="value_changed" from="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/MutationLvlContainer/MaxLvl" to="." method="_on_max_lvl_value_changed"]
|
||||||
|
|||||||
Reference in New Issue
Block a user