plante part pour ermit et tropical
[dev] upgrade sprite tester (choix de mutation)
This commit is contained in:
@@ -4,22 +4,32 @@
|
||||
[ext_resource type="Script" uid="uid://c360ic1aost1n" path="res://entities/plants/scripts/texture_builder/plant_part_builder.gd" id="2_aiy5l"]
|
||||
[ext_resource type="Script" path="res://entities/plants/scripts/texture_builder/plant_attach_builder.gd" id="3_vh6ap"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_o81jt"]
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_o2vh8"]
|
||||
atlas = ExtResource("1_14px2")
|
||||
region = Rect2(12, 3055, 172, 176)
|
||||
region = Rect2(4273, 876, 362, 319)
|
||||
|
||||
[node name="Sprite" type="Sprite2D" unique_id=1642167049 node_paths=PackedStringArray("root", "attaches")]
|
||||
texture = SubResource("AtlasTexture_o81jt")
|
||||
texture = SubResource("AtlasTexture_o2vh8")
|
||||
script = ExtResource("2_aiy5l")
|
||||
part_name = "FlowerM"
|
||||
part_index = 3
|
||||
type = 3
|
||||
part_name = "LeafG"
|
||||
part_index = 4
|
||||
type = 2
|
||||
root = NodePath("Root")
|
||||
attaches = NodePath("Attaches")
|
||||
|
||||
[node name="Root" type="Node2D" parent="." unique_id=1437082577]
|
||||
position = Vector2(5, 1)
|
||||
position = Vector2(128, 73)
|
||||
script = ExtResource("3_vh6ap")
|
||||
attach_types = Array[int]([3])
|
||||
attach_types = Array[int]([1])
|
||||
|
||||
[node name="Attaches" type="Node" parent="." unique_id=1834697767]
|
||||
|
||||
[node name="attach0" type="Node2D" parent="Attaches" unique_id=1182953632]
|
||||
position = Vector2(-32, -8)
|
||||
script = ExtResource("3_vh6ap")
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[node name="attach1" type="Node2D" parent="Attaches" unique_id=268023553]
|
||||
position = Vector2(116, -91)
|
||||
script = ExtResource("3_vh6ap")
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
@@ -1,32 +1,189 @@
|
||||
[gd_resource type="Resource" script_class="PartGroup" format=3 uid="uid://dvwmk2suorf05"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b3jwglylqdqtw" path="res://entities/plants/scripts/texture_builder/plant_part.gd" id="1_p4gde"]
|
||||
[ext_resource type="Script" path="res://entities/plants/scripts/texture_builder/plant_attach.gd" id="2_scyei"]
|
||||
[ext_resource type="Script" uid="uid://co46ywm8bgnfh" path="res://entities/plants/scripts/texture_builder/plant_attach.gd" id="2_scyei"]
|
||||
[ext_resource type="Texture2D" uid="uid://bdwmandgxrjgn" path="res://entities/plants/assets/sprites/asset_plantes.png" id="3_2i3vh"]
|
||||
[ext_resource type="Script" uid="uid://u2j7hn5her8i" path="res://entities/plants/scripts/texture_builder/part_group.gd" id="4_rt28t"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_iqjxq"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(-20, -3)
|
||||
position = Vector2(-8, -3)
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_8w5hg"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(124, 72)
|
||||
position = Vector2(137, 73)
|
||||
attach_types = Array[int]([1])
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yh7e0"]
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_m6uos"]
|
||||
atlas = ExtResource("3_2i3vh")
|
||||
region = Rect2(4923, 111, 282, 177)
|
||||
region = Rect2(4891, 116, 319, 167)
|
||||
|
||||
[sub_resource type="Resource" id="Resource_m6uos"]
|
||||
[sub_resource type="Resource" id="Resource_dw4y8"]
|
||||
resource_name = "LeafG"
|
||||
script = ExtResource("1_p4gde")
|
||||
texture = SubResource("AtlasTexture_yh7e0")
|
||||
texture = SubResource("AtlasTexture_m6uos")
|
||||
type = 2
|
||||
root = SubResource("Resource_8w5hg")
|
||||
attaches = Array[ExtResource("2_scyei")]([SubResource("Resource_iqjxq")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_p4gde"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(-19, -20)
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_scyei"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(141, 61)
|
||||
attach_types = Array[int]([1])
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2i3vh"]
|
||||
atlas = ExtResource("3_2i3vh")
|
||||
region = Rect2(4813, 290, 324, 282)
|
||||
|
||||
[sub_resource type="Resource" id="Resource_rt28t"]
|
||||
resource_name = "LeafG"
|
||||
script = ExtResource("1_p4gde")
|
||||
texture = SubResource("AtlasTexture_2i3vh")
|
||||
type = 2
|
||||
root = SubResource("Resource_scyei")
|
||||
attaches = Array[ExtResource("2_scyei")]([SubResource("Resource_p4gde")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_2i3vh"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(12, -25)
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_m6uos"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(11, 65)
|
||||
attach_types = Array[int]([3])
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yx3hg"]
|
||||
atlas = ExtResource("3_2i3vh")
|
||||
region = Rect2(5220, 149, 127, 167)
|
||||
|
||||
[sub_resource type="Resource" id="Resource_sfgdq"]
|
||||
resource_name = "LeafG"
|
||||
script = ExtResource("1_p4gde")
|
||||
texture = SubResource("AtlasTexture_yx3hg")
|
||||
type = 2
|
||||
root = SubResource("Resource_m6uos")
|
||||
attaches = Array[ExtResource("2_scyei")]([SubResource("Resource_2i3vh")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_p0ibe"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(0, -19)
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_802dr"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(11, 74)
|
||||
attach_types = Array[int]([3])
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4l34w"]
|
||||
atlas = ExtResource("3_2i3vh")
|
||||
region = Rect2(5179, 329, 145, 193)
|
||||
|
||||
[sub_resource type="Resource" id="Resource_nq8sv"]
|
||||
resource_name = "LeafG"
|
||||
script = ExtResource("1_p4gde")
|
||||
texture = SubResource("AtlasTexture_4l34w")
|
||||
type = 2
|
||||
root = SubResource("Resource_802dr")
|
||||
attaches = Array[ExtResource("2_scyei")]([SubResource("Resource_p0ibe")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_4l34w"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(-32, -8)
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_c8nhr"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(116, -91)
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_1r02i"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(128, 73)
|
||||
attach_types = Array[int]([1])
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_o2vh8"]
|
||||
atlas = ExtResource("3_2i3vh")
|
||||
region = Rect2(4273, 876, 362, 319)
|
||||
|
||||
[sub_resource type="Resource" id="Resource_plgvq"]
|
||||
resource_name = "LeafG"
|
||||
script = ExtResource("1_p4gde")
|
||||
texture = SubResource("AtlasTexture_o2vh8")
|
||||
type = 2
|
||||
root = SubResource("Resource_1r02i")
|
||||
attaches = Array[ExtResource("2_scyei")]([SubResource("Resource_4l34w"), SubResource("Resource_c8nhr")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_o2vh8"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(3, 20)
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_lo685"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(51, -90)
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_tudco"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(-52, -106)
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_u3h67"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(164, 104)
|
||||
attach_types = Array[int]([1])
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_x2l6y"]
|
||||
atlas = ExtResource("3_2i3vh")
|
||||
region = Rect2(4317, 1210, 372, 391)
|
||||
|
||||
[sub_resource type="Resource" id="Resource_xyldh"]
|
||||
resource_name = "LeafG"
|
||||
script = ExtResource("1_p4gde")
|
||||
texture = SubResource("AtlasTexture_x2l6y")
|
||||
type = 2
|
||||
root = SubResource("Resource_u3h67")
|
||||
attaches = Array[ExtResource("2_scyei")]([SubResource("Resource_o2vh8"), SubResource("Resource_lo685"), SubResource("Resource_tudco")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_x2l6y"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(-23, 47)
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_qjke8"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(16, -56)
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_k00bd"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(101, 6)
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_l10lm"]
|
||||
script = ExtResource("2_scyei")
|
||||
position = Vector2(121, 124)
|
||||
attach_types = Array[int]([1])
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dw4y8"]
|
||||
atlas = ExtResource("3_2i3vh")
|
||||
region = Rect2(3569, 2493, 339, 308)
|
||||
|
||||
[sub_resource type="Resource" id="Resource_v6stg"]
|
||||
resource_name = "LeafG"
|
||||
script = ExtResource("1_p4gde")
|
||||
texture = SubResource("AtlasTexture_dw4y8")
|
||||
type = 2
|
||||
root = SubResource("Resource_l10lm")
|
||||
attaches = Array[ExtResource("2_scyei")]([SubResource("Resource_x2l6y"), SubResource("Resource_qjke8"), SubResource("Resource_k00bd")])
|
||||
|
||||
[resource]
|
||||
script = ExtResource("4_rt28t")
|
||||
parts = Array[ExtResource("1_p4gde")]([SubResource("Resource_m6uos")])
|
||||
parts = Array[ExtResource("1_p4gde")]([SubResource("Resource_dw4y8"), SubResource("Resource_rt28t"), SubResource("Resource_sfgdq"), SubResource("Resource_nq8sv"), SubResource("Resource_plgvq"), SubResource("Resource_xyldh"), SubResource("Resource_v6stg")])
|
||||
|
||||
@@ -14,7 +14,9 @@ extends Node
|
||||
|
||||
@export var camera_speed := 1000.0
|
||||
|
||||
var test_progression_data: TestProgressionData
|
||||
var input_dir := Vector2.ZERO
|
||||
var checkBoxes: Dictionary[String, CheckBox]
|
||||
|
||||
func _ready():
|
||||
%Speed.value = camera_speed
|
||||
@@ -28,6 +30,19 @@ func _ready():
|
||||
%EndAge.visible = random_state
|
||||
%MinLvl.value = min_level
|
||||
%MaxLvl.value = max_level
|
||||
test_progression_data = TestProgressionData.new()
|
||||
GameInfo.game_data.progression_data = test_progression_data
|
||||
for m in test_progression_data.get_all_mutations():
|
||||
var lineContainer := HBoxContainer.new()
|
||||
var checkBox := CheckBox.new()
|
||||
checkBox.button_pressed = true
|
||||
checkBox.toggled.connect(func(toggled_on): toggle_mutation_available(m, toggled_on))
|
||||
checkBoxes[m.id] = checkBox
|
||||
lineContainer.add_child(checkBox)
|
||||
var label := Label.new()
|
||||
label.text = m.id
|
||||
lineContainer.add_child(label)
|
||||
%PossibleMutationContainer.add_child(lineContainer)
|
||||
generate_plants();
|
||||
|
||||
func _unhandled_key_input(_event) -> void:
|
||||
@@ -67,7 +82,6 @@ func generate_plants():
|
||||
var plant: Plant = Plant.new(plant_data)
|
||||
print(plant.data.plant_name)
|
||||
%Plants.add_child(plant)
|
||||
# plant.set_owner(self )
|
||||
plant.global_position = plant_position
|
||||
|
||||
func generate_seeds():
|
||||
@@ -139,3 +153,33 @@ func _on_min_lvl_value_changed(value: float) -> void:
|
||||
|
||||
func _on_max_lvl_value_changed(value: float) -> void:
|
||||
max_level = int(value)
|
||||
|
||||
func toggle_mutation_available(mutation: PlantMutation, toggled_on: bool):
|
||||
if toggled_on:
|
||||
test_progression_data.discover_mutation(mutation)
|
||||
else:
|
||||
test_progression_data.lock_mutation(mutation)
|
||||
checkBoxes[mutation.id].set_pressed_no_signal(toggled_on)
|
||||
|
||||
func _on_toggle_on_all() -> void:
|
||||
for m in test_progression_data.get_all_mutations():
|
||||
test_progression_data.discover_mutation(m)
|
||||
checkBoxes[m.id].set_pressed_no_signal(true)
|
||||
|
||||
func _on_toggle_off_all() -> void:
|
||||
for m in test_progression_data.get_all_mutations():
|
||||
test_progression_data.lock_mutation(m)
|
||||
checkBoxes[m.id].set_pressed_no_signal(false)
|
||||
|
||||
func _on_toggle_all() -> void:
|
||||
for m in test_progression_data.get_all_mutations():
|
||||
if test_progression_data.mutations_available.has(m.id):
|
||||
test_progression_data.lock_mutation(m)
|
||||
checkBoxes[m.id].set_pressed_no_signal(false)
|
||||
else:
|
||||
test_progression_data.discover_mutation(m)
|
||||
checkBoxes[m.id].set_pressed_no_signal(true)
|
||||
|
||||
func update_checkboxes() -> void:
|
||||
for key in checkBoxes:
|
||||
checkBoxes[key].set_pressed_no_signal(test_progression_data.mutations_available.has(key))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
extends Resource
|
||||
class_name PlantAttach
|
||||
|
||||
enum AttachType {BIG_ATTACH, MEDIUM_ATTACH, FLOWER_ATTACH, SMALL_ATTACH}
|
||||
enum AttachType {DEPRECATED, MEDIUM_ATTACH, FLOWER_ATTACH, SMALL_ATTACH}
|
||||
|
||||
@export var position: Vector2
|
||||
@export var attach_types: Array[AttachType]
|
||||
|
||||
@@ -55,6 +55,12 @@ func _ready() -> void:
|
||||
bases[i] = all_bases.parts[i]
|
||||
else:
|
||||
baby_bases[i - baby_bases_start_ind] = all_bases.parts[i]
|
||||
for mutation_id in part_group:
|
||||
if GameInfo.game_data.progression_data.get_all_mutations().find_custom(func(m): return m.id == mutation_id) < 0:
|
||||
printerr("Mutation ID \"", mutation_id, "\" not existant")
|
||||
for m in GameInfo.game_data.progression_data.get_all_mutations():
|
||||
if not part_group.keys().has(m.id):
|
||||
printerr("Missing mutation ID \"", m.id, "\"")
|
||||
|
||||
func random_ind(array: Array) -> int:
|
||||
return rng.randi_range(0, array.size() - 1)
|
||||
|
||||
@@ -175,13 +175,40 @@ layout_mode = 2
|
||||
|
||||
[node name="PossibleMutations" type="FoldableContainer" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer" unique_id=71622472]
|
||||
layout_mode = 2
|
||||
folded = true
|
||||
title = "Possible Mutations"
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/PossibleMutations" unique_id=611287858]
|
||||
visible = false
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/PossibleMutations" unique_id=924496971]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/PossibleMutations/VBoxContainer" unique_id=1818974229]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="AllOn" type="Button" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/PossibleMutations/VBoxContainer/HBoxContainer" unique_id=1782227791]
|
||||
custom_minimum_size = Vector2(20, 0)
|
||||
layout_mode = 2
|
||||
text = "All on"
|
||||
|
||||
[node name="AllOff" type="Button" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/PossibleMutations/VBoxContainer/HBoxContainer" unique_id=1397119927]
|
||||
custom_minimum_size = Vector2(20, 0)
|
||||
layout_mode = 2
|
||||
text = "All off"
|
||||
|
||||
[node name="Invert all" type="Button" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/PossibleMutations/VBoxContainer/HBoxContainer" unique_id=970535768]
|
||||
custom_minimum_size = Vector2(20, 0)
|
||||
layout_mode = 2
|
||||
text = "Invert all"
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/PossibleMutations/VBoxContainer" unique_id=1133261960]
|
||||
custom_minimum_size = Vector2(100, 100)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PossibleMutationContainer" type="VBoxContainer" parent="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/PossibleMutations/VBoxContainer/ScrollContainer" unique_id=611287858]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(100, 100)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Plants" type="Node" parent="." unique_id=849342032]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -206,3 +233,6 @@ tile_set = ExtResource("3_3mb6h")
|
||||
[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"]
|
||||
[connection signal="pressed" from="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/PossibleMutations/VBoxContainer/HBoxContainer/AllOn" to="." method="_on_toggle_on_all"]
|
||||
[connection signal="pressed" from="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/PossibleMutations/VBoxContainer/HBoxContainer/AllOff" to="." method="_on_toggle_off_all"]
|
||||
[connection signal="pressed" from="Camera2D/CanvasLayer/VBoxContainer/Folder/VBoxContainer/PossibleMutations/VBoxContainer/HBoxContainer/Invert all" to="." method="_on_toggle_all"]
|
||||
|
||||
Reference in New Issue
Block a user