From 2f23b3fcb538057984f1a23610846d6d36ce810e Mon Sep 17 00:00:00 2001 From: Altaezio Date: Fri, 27 Feb 2026 12:23:52 +0100 Subject: [PATCH] various fixes and add --- .../plant_texture_builder.tscn | 42 +++++++++++++++++-- .../truck/recharge/scripts/truck_recharge.gd | 3 ++ .../truck/recharge/truck_recharge.tscn | 6 +-- entities/plants/plant_part_buider.tscn | 5 +-- .../plants/resources/plant_parts/Base1.tres | 2 +- entities/plants/scripts/plant.gd | 10 +++++ entities/plants/scripts/plant_data.gd | 2 +- .../scripts/plant_mutation/tough_mutation.gd | 2 +- .../texture_builder/plant_texture_builder.gd | 20 ++++----- .../texture_builder/seed_texture_set.gd | 16 +++---- .../player/inventory/scripts/items/seed.gd | 1 - entities/scripts/inspectable_entity.gd | 3 ++ gui/pointer/scripts/pointer.gd | 4 +- translation/game/gui.csv | 2 + 14 files changed, 86 insertions(+), 32 deletions(-) diff --git a/common/plant_texture_builder/plant_texture_builder.tscn b/common/plant_texture_builder/plant_texture_builder.tscn index 84c4af4..004baaa 100644 --- a/common/plant_texture_builder/plant_texture_builder.tscn +++ b/common/plant_texture_builder/plant_texture_builder.tscn @@ -2,7 +2,8 @@ [ext_resource type="Script" uid="uid://dt2ip3pw2cboy" path="res://entities/plants/scripts/texture_builder/plant_texture_builder.gd" id="1_s8rsj"] [ext_resource type="Script" uid="uid://b3jwglylqdqtw" path="res://entities/plants/scripts/texture_builder/plant_part.gd" id="2_cfiqo"] -[ext_resource type="Resource" uid="uid://bfyafiewcrjln" path="res://entities/plants/resources/plant_parts/Base1.tres" id="3_15wue"] +[ext_resource type="Script" path="res://entities/plants/scripts/texture_builder/plant_attach.gd" id="3_cynqk"] +[ext_resource type="Texture2D" uid="uid://bxnm1quxhx40i" path="res://entities/plants/assets/sprites/asset-plante-fin_assemble.png" id="4_b21au"] [ext_resource type="Resource" uid="uid://7hrdkl6bf3o4" path="res://entities/plants/resources/plant_parts/Branch1.tres" id="4_ggud5"] [ext_resource type="Resource" uid="uid://bgh8a4xwc5stw" path="res://entities/plants/resources/plant_parts/Base2.tres" id="5_21cjy"] [ext_resource type="Resource" uid="uid://ceisi5yyie7to" path="res://entities/plants/resources/plant_parts/Branch2.tres" id="5_ufbqh"] @@ -54,6 +55,41 @@ [ext_resource type="Texture2D" uid="uid://b3apxg55cjoow" path="res://entities/plants/assets/sprites/seeds/haricot/color_2.png" id="52_cynqk"] [ext_resource type="Texture2D" uid="uid://0ayiumcnqyc1" path="res://entities/plants/assets/sprites/seeds/haricot/outline.png" id="53_b21au"] +[sub_resource type="Resource" id="Resource_10bgv"] +script = ExtResource("3_cynqk") +position = Vector2(59, 99) +attach_types = Array[int]([0]) + +[sub_resource type="Resource" id="Resource_m78t0"] +script = ExtResource("3_cynqk") +position = Vector2(-3, -68) +attach_types = Array[int]([0]) + +[sub_resource type="Resource" id="Resource_hbwie"] +script = ExtResource("3_cynqk") +position = Vector2(-17, -237) +attach_types = Array[int]([1, 3]) + +[sub_resource type="Resource" id="Resource_obhnl"] +script = ExtResource("3_cynqk") +position = Vector2(-50, -286) +attach_types = Array[int]([2, 3]) + +[sub_resource type="Resource" id="Resource_dhqtw"] +script = ExtResource("3_cynqk") +position = Vector2(-2, 333) + +[sub_resource type="AtlasTexture" id="AtlasTexture_khbsd"] +atlas = ExtResource("4_b21au") +region = Rect2(41, 72, 237, 686) + +[sub_resource type="Resource" id="Resource_fuh2b"] +resource_name = "Base1" +script = ExtResource("2_cfiqo") +texture = SubResource("AtlasTexture_khbsd") +root = SubResource("Resource_dhqtw") +attaches = Array[ExtResource("3_cynqk")]([SubResource("Resource_10bgv"), SubResource("Resource_m78t0"), SubResource("Resource_hbwie"), SubResource("Resource_obhnl")]) + [sub_resource type="Resource" id="Resource_rt6tw"] script = ExtResource("16_c3tk3") parts = Array[ExtResource("2_cfiqo")]([ExtResource("11_fc4k8"), ExtResource("12_1b4fr"), ExtResource("13_ggcwy"), ExtResource("14_15wue"), ExtResource("29_nfxo0"), ExtResource("30_i8j71")]) @@ -109,7 +145,7 @@ metadata/_custom_type_script = "uid://hs3i48clok85" [node name="TextureBuilder" type="Node" unique_id=79184097] script = ExtResource("1_s8rsj") -bases = Array[ExtResource("2_cfiqo")]([ExtResource("3_15wue")]) +bases = Array[ExtResource("2_cfiqo")]([SubResource("Resource_fuh2b")]) baby_bases = Array[ExtResource("2_cfiqo")]([ExtResource("5_21cjy")]) branches = Array[ExtResource("2_cfiqo")]([ExtResource("4_ggud5"), ExtResource("5_ufbqh"), ExtResource("6_jbu3q"), ExtResource("7_21cjy"), ExtResource("8_qm7aw"), ExtResource("9_3e4c1"), ExtResource("11_hvwgo"), ExtResource("12_npk80"), ExtResource("13_hyb2i"), ExtResource("14_4gk8a")]) n_branches = 5 @@ -127,6 +163,6 @@ chance_to_have_part = 0.9 origin_weights_base = Dictionary[int, int]({ 0: 20, 1: 10, -2: 5 +2: 2 }) seed_texture_sets = Array[ExtResource("47_jbu3q")]([SubResource("Resource_cynqk"), SubResource("Resource_17ac3")]) diff --git a/entities/interactables/truck/recharge/scripts/truck_recharge.gd b/entities/interactables/truck/recharge/scripts/truck_recharge.gd index 71e9089..aaeb1f2 100644 --- a/entities/interactables/truck/recharge/scripts/truck_recharge.gd +++ b/entities/interactables/truck/recharge/scripts/truck_recharge.gd @@ -26,3 +26,6 @@ func interact(_p: Player) -> bool: return true return false + +func get_card_up_padding() -> float: + return 100 diff --git a/entities/interactables/truck/recharge/truck_recharge.tscn b/entities/interactables/truck/recharge/truck_recharge.tscn index 6b51659..c234e0c 100644 --- a/entities/interactables/truck/recharge/truck_recharge.tscn +++ b/entities/interactables/truck/recharge/truck_recharge.tscn @@ -8,8 +8,8 @@ [ext_resource type="Texture2D" uid="uid://c01f6ja6btsep" path="res://entities/interactables/truck/recharge/STW_Props_Batterie_TERRE.png" id="6_2okh4"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_bjhct"] -radius = 39.0 -height = 105.53573 +radius = 38.45475 +height = 76.9095 [sub_resource type="LabelSettings" id="LabelSettings_1vpbi"] font = ExtResource("4_ot7vv") @@ -70,6 +70,6 @@ offset = Vector2(0, -120) [node name="StaticBody2D" type="StaticBody2D" parent="." unique_id=1324035615] [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D" unique_id=842130596] -position = Vector2(14, -56) +position = Vector2(12.000001, -41.000004) rotation = 0.18545866 shape = SubResource("CapsuleShape2D_bjhct") diff --git a/entities/plants/plant_part_buider.tscn b/entities/plants/plant_part_buider.tscn index b896996..8266034 100644 --- a/entities/plants/plant_part_buider.tscn +++ b/entities/plants/plant_part_buider.tscn @@ -2,7 +2,7 @@ [ext_resource type="Texture2D" uid="uid://bxnm1quxhx40i" path="res://entities/plants/assets/sprites/asset-plante-fin_assemble.png" id="1_yh7e0"] [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://d01kj3twwcrmu" 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"] atlas = ExtResource("1_yh7e0") @@ -16,9 +16,8 @@ root = NodePath("Root") attaches = NodePath("Attaches") [node name="Root" type="Node2D" parent="." unique_id=1437082577] -position = Vector2(-2, 333) +position = Vector2(0, 281) script = ExtResource("3_yh7e0") -metadata/_custom_type_script = "uid://d01kj3twwcrmu" [node name="Attaches" type="Node" parent="." unique_id=1834697767] diff --git a/entities/plants/resources/plant_parts/Base1.tres b/entities/plants/resources/plant_parts/Base1.tres index aa240ba..4d518bc 100644 --- a/entities/plants/resources/plant_parts/Base1.tres +++ b/entities/plants/resources/plant_parts/Base1.tres @@ -26,7 +26,7 @@ attach_types = Array[int]([2, 3]) [sub_resource type="Resource" id="Resource_dhqtw"] script = ExtResource("1_10bgv") -position = Vector2(-2, 333) +position = Vector2(0, 281) [sub_resource type="AtlasTexture" id="AtlasTexture_khbsd"] atlas = ExtResource("3_10bgv") diff --git a/entities/plants/scripts/plant.gd b/entities/plants/scripts/plant.gd index a58001a..4a3dfb1 100644 --- a/entities/plants/scripts/plant.gd +++ b/entities/plants/scripts/plant.gd @@ -167,3 +167,13 @@ func card_info() -> CardInfo: info.sections.append(m.card_section()) return info + +func get_card_up_padding() -> float: + match data.get_state(): + PlantData.State.MATURE: + return 100.0 + PlantData.State.GROWING: + return 75 + PlantData.State.PLANTED: + return 50 + return Pointer.CARD_UP_PADDING \ No newline at end of file diff --git a/entities/plants/scripts/plant_data.gd b/entities/plants/scripts/plant_data.gd index 9cac962..33f1346 100644 --- a/entities/plants/scripts/plant_data.gd +++ b/entities/plants/scripts/plant_data.gd @@ -77,7 +77,7 @@ func get_score(state: State = get_state()) -> int: score = m.mutate_score(self , score) mult = m.mutate_score_multiplier(self , mult) - return score + return score * mult func get_state() -> State: if day >= get_lifetime(): diff --git a/entities/plants/scripts/plant_mutation/tough_mutation.gd b/entities/plants/scripts/plant_mutation/tough_mutation.gd index 5deae78..0197678 100644 --- a/entities/plants/scripts/plant_mutation/tough_mutation.gd +++ b/entities/plants/scripts/plant_mutation/tough_mutation.gd @@ -14,7 +14,7 @@ func get_mutation_name() -> String: return tr("TOUGH") func get_mutation_description() -> String: - return tr("TOUGH_EFFECT_TEXT_LEVEL_%d") % level + return tr("TOUGH_EFFECT_TEXT_LEVEL_%d") % [3 - level] func mutate_score_multiplier(_plant_data: PlantData, multiplier: int) -> int: return multiplier + 2 diff --git a/entities/plants/scripts/texture_builder/plant_texture_builder.gd b/entities/plants/scripts/texture_builder/plant_texture_builder.gd index 5458906..1187c46 100644 --- a/entities/plants/scripts/texture_builder/plant_texture_builder.gd +++ b/entities/plants/scripts/texture_builder/plant_texture_builder.gd @@ -77,24 +77,24 @@ func build_seed_texture(random_seed: int) -> Texture: rng.seed = random_seed - var texture_set : SeedTextureSet = pick_random(seed_texture_sets) - var seed_image := Image.create(SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE, false, Image.FORMAT_RGBA8) + var texture_set: SeedTextureSet = pick_random(seed_texture_sets) + var seed_image := Image.create(SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE, false, Image.FORMAT_RGBA8) - for color_texture in texture_set.color_textures: - var color_image = color_texture.get_image().duplicate() - color_image.resize(SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE) + for i in texture_set.color_textures.size(): + var color_image = texture_set.get_color_image(i).duplicate() + color_image.resize(SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE) modulate_image(color_image, pick_random(COLOR_PALETTE)) seed_image.blend_rect( color_image, - Rect2i(0,0,SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE), + Rect2i(0, 0, SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE), Vector2i.ZERO ) if texture_set.outline_texture: - var outline_image = texture_set.outline_texture.get_image().duplicate() - outline_image.resize(SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE) - seed_image.blend_rect(outline_image, Rect2i(0,0,SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE),Vector2i.ZERO) + var outline_image = texture_set.outline_image + outline_image.resize(SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE) + seed_image.blend_rect(outline_image, Rect2i(0, 0, SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE), Vector2i.ZERO) - if rng.randi()%2 == 0: + if rng.randi() % 2 == 0: seed_image.flip_x() return ImageTexture.create_from_image(seed_image) diff --git a/entities/plants/scripts/texture_builder/seed_texture_set.gd b/entities/plants/scripts/texture_builder/seed_texture_set.gd index c460c25..99989dd 100644 --- a/entities/plants/scripts/texture_builder/seed_texture_set.gd +++ b/entities/plants/scripts/texture_builder/seed_texture_set.gd @@ -4,17 +4,19 @@ class_name SeedTextureSet @export var color_textures: Array[Texture] @export var outline_texture: Texture -var color_images: Array[Image]: get = get_color_images +var color_images: Array[Image] var outline_image: Image: get = get_outline_image -func get_color_images() -> Array[Image]: - if color_images == null: - color_images = [] - for texture in color_textures: - color_images.append(texture.get_image()) - return color_images +func get_color_image(ind: int) -> Image: + if color_images.size() == 0: + color_images.resize(color_textures.size()) + if color_images[ind] == null: + print("get image") + color_images[ind] = color_textures[ind].get_image() + return color_images[ind] func get_outline_image() -> Image: if outline_image == null: + print("get image outilne") outline_image = outline_texture.get_image() return outline_image diff --git a/entities/player/inventory/scripts/items/seed.gd b/entities/player/inventory/scripts/items/seed.gd index a0665a7..f9afa55 100644 --- a/entities/player/inventory/scripts/items/seed.gd +++ b/entities/player/inventory/scripts/items/seed.gd @@ -59,7 +59,6 @@ func get_description() -> String: return tr("PLANT_%s_MUST_BE_USED_IN_DECONTAMINATED_ZONE") % plant_name func get_icon() -> Texture2D: - print("getting icon") if stored_icon == null: stored_icon = PlantTextureBuilder.build_seed_texture(plant_name.hash()) return stored_icon diff --git a/entities/scripts/inspectable_entity.gd b/entities/scripts/inspectable_entity.gd index 5df2783..30bd63d 100644 --- a/entities/scripts/inspectable_entity.gd +++ b/entities/scripts/inspectable_entity.gd @@ -51,3 +51,6 @@ func card_info() -> CardInfo: func _notification(what): if (what == NOTIFICATION_PREDELETE): Pointer.stop_inspect(self) + +func get_card_up_padding() -> float: + return Pointer.CARD_UP_PADDING diff --git a/gui/pointer/scripts/pointer.gd b/gui/pointer/scripts/pointer.gd index 341f56e..4c6c449 100644 --- a/gui/pointer/scripts/pointer.gd +++ b/gui/pointer/scripts/pointer.gd @@ -7,7 +7,7 @@ const ZONE_OPACITY = 0.4 const ZONE_ACTIVATED_COLOR = Color.TURQUOISE const ZONE_DEACTIVATED_COLOR = Color.REBECCA_PURPLE -const CARD_VISUALISATION_TIME = 0.5 +const CARD_VISUALISATION_TIME = 0.3 const CARD_UP_PADDING = 50 @export var default_cursor : Texture2D @@ -121,7 +121,7 @@ func update_card(): var camera = get_viewport().get_camera_2d() var screen_size = get_viewport().get_visible_rect().size if inspected is InspectableEntity: - %CardPosition.position = inspected.global_position - camera.global_position + screen_size / 2 + CARD_UP_PADDING * Vector2.UP + %CardPosition.position = inspected.global_position - camera.global_position + screen_size / 2 + inspected.get_card_up_padding() * Vector2.UP elif inspected is Control: %CardPosition.position = inspected.global_position + inspected.size / 2 + CARD_UP_PADDING * Vector2.UP elif inspected is Node3D: diff --git a/translation/game/gui.csv b/translation/game/gui.csv index a291265..9e126b9 100644 --- a/translation/game/gui.csv +++ b/translation/game/gui.csv @@ -84,6 +84,8 @@ SOCIABLE,Outgoing,Sociable SOCIABLE_EFFECT_TEXT_LEVEL_%d,"When mature, grants [b]%d[/b] garden points if it is nearby %d other plants","Une fois mature, donne [b]%d[/b] points de jardin si elle est à côté de %d autres plantes" STRONG,Strong,Fort STRONG_EFFECT_TEXT_LEVEL_%d,Plus [b]%d[/b]%% of the score,Augmente le score de [b]%d[/b]%% +TOUGH,Tough,Solide +TOUGH_EFFECT_TEXT_LEVEL_%d,Multiply the score by 2 but increase the growing time by [b]%d[/b] days,"Multiplie le score par 2, mais aumgent le temps de pousse de [b]%d[/b] jours" COST_%d_ENERGY,Cost %d energy,Coûte %d d’énergie ONE_TIME_USE,Single use,Usage unique BUILD_%s,Build %s,Construit %s