various fixes and add

This commit is contained in:
Altaezio
2026-02-27 12:23:52 +01:00
parent add394d968
commit 2f23b3fcb5
14 changed files with 86 additions and 32 deletions

View File

@@ -26,3 +26,6 @@ func interact(_p: Player) -> bool:
return true
return false
func get_card_up_padding() -> float:
return 100

View File

@@ -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")

View File

@@ -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]

View File

@@ -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")

View File

@@ -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

View File

@@ -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():

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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