ajout des mutation et refonte de l'inspecteur
* ajout des mutations #86 * changement de l'objectif #85 * refonte de l'inspecteur #71 * changement léger de la plantation * les plantes ne donnent que des graines de leurs espèces * refonte partielle du code, refacto
@ -14,11 +14,12 @@ func _init():
|
||||
current_planet_data_updated.emit(v)
|
||||
|
||||
@export var unlocked_plant_types : Array[PlantType] = []
|
||||
|
||||
@export var unlocked_plant_mutations : Array[PlantMutation] = []
|
||||
@export var unlocked_machines : Array[MachineType] = []
|
||||
|
||||
func set_default_unlocked():
|
||||
unlocked_plant_types = all_plant_types()
|
||||
unlocked_plant_mutations = all_plant_mutations()
|
||||
unlocked_machines = all_machines()
|
||||
|
||||
func all_plant_types() -> Array[PlantType]:
|
||||
@ -34,4 +35,16 @@ func all_machines() -> Array[MachineType]:
|
||||
preload("res://entities/interactables/machines/compost/compost_types/energy_compost.tres"),
|
||||
preload("res://entities/interactables/machines/compost/compost_types/seed_compost.tres"),
|
||||
preload("res://entities/interactables/machines/solar_pannel/solar_pannel.tres"),
|
||||
]
|
||||
|
||||
func all_plant_mutations() -> Array[PlantMutation]:
|
||||
return [
|
||||
preload("res://entities/plants/resources/plant_mutations/ancient_mutation.tres"),
|
||||
preload("res://entities/plants/resources/plant_mutations/elitist_mutation.tres"),
|
||||
preload("res://entities/plants/resources/plant_mutations/ermit_mutation.tres"),
|
||||
preload("res://entities/plants/resources/plant_mutations/precocious_mutation.tres"),
|
||||
preload("res://entities/plants/resources/plant_mutations/quality_mutation.tres"),
|
||||
preload("res://entities/plants/resources/plant_mutations/quick_mutation.tres"),
|
||||
preload("res://entities/plants/resources/plant_mutations/sociable_mutation.tres"),
|
||||
preload("res://entities/plants/resources/plant_mutations/strong_mutation.tres"),
|
||||
]
|
||||
@ -4,8 +4,8 @@ class_name PlanetData
|
||||
signal quota_number_updated(quota : int)
|
||||
signal contamination_updated(decontamination_surface : float)
|
||||
|
||||
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MAX_SIZE = 400.
|
||||
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE = 100.
|
||||
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MAX_SIZE = 200.
|
||||
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE = 50.
|
||||
const DEFAULT_BASE_SIZE = Vector2(2000,2000)
|
||||
|
||||
@export var base_size : Vector2 = Vector2(2000,2000)
|
||||
@ -76,15 +76,17 @@ func generate_objective_rewards(level = 0) -> Array[ObjectiveReward]:
|
||||
|
||||
#region ------------------ Quotas ------------------
|
||||
func get_quota(n = 0) -> int:
|
||||
var first_quota = 50
|
||||
var quota_adding = n * 100
|
||||
var first_quotas = [
|
||||
5,
|
||||
10,
|
||||
20,
|
||||
50,
|
||||
]
|
||||
|
||||
if n == 0:
|
||||
return first_quota
|
||||
elif n < 0:
|
||||
return 0
|
||||
|
||||
return get_quota(n - 1) + quota_adding
|
||||
if n > len(first_quotas):
|
||||
return pow(n, 3)
|
||||
else:
|
||||
return first_quotas[n]
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
1
common/icons/calendar-week.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-calendar-week"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12z" /><path d="M16 3v4" /><path d="M8 3v4" /><path d="M4 11h16" /><path d="M7 14h.013" /><path d="M10.01 14h.005" /><path d="M13.01 14h.005" /><path d="M16.015 14h.005" /><path d="M13.015 17h.005" /><path d="M7.01 17h.005" /><path d="M10.01 17h.005" /></svg>
|
||||
|
After Width: | Height: | Size: 653 B |
43
common/icons/calendar-week.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d3ksdxepcjoot"
|
||||
path="res://.godot/imported/calendar-week.svg-f1d046aa939d08136bae8aa2cbcb1851.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/calendar-week.svg"
|
||||
dest_files=["res://.godot/imported/calendar-week.svg-f1d046aa939d08136bae8aa2cbcb1851.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
1
common/icons/chevrons-up.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevrons-up"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 11l5 -5l5 5" /><path d="M7 17l5 -5l5 5" /></svg>
|
||||
|
After Width: | Height: | Size: 367 B |
43
common/icons/chevrons-up.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cgmxjom200bej"
|
||||
path="res://.godot/imported/chevrons-up.svg-0e13296c91df78f04c4a0dc047c12352.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/chevrons-up.svg"
|
||||
dest_files=["res://.godot/imported/chevrons-up.svg-0e13296c91df78f04c4a0dc047c12352.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
1
common/icons/copy.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-copy"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z" /><path d="M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" /></svg>
|
||||
|
After Width: | Height: | Size: 581 B |
43
common/icons/copy.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cgefjpkvs8noj"
|
||||
path="res://.godot/imported/copy.svg-ced7a45cd1b36cd374b809aa5519b488.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/copy.svg"
|
||||
dest_files=["res://.godot/imported/copy.svg-ced7a45cd1b36cd374b809aa5519b488.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
1
common/icons/dna.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-dna"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M14.828 14.828a4 4 0 1 0 -5.656 -5.656a4 4 0 0 0 5.656 5.656z" /><path d="M9.172 20.485a4 4 0 1 0 -5.657 -5.657" /><path d="M14.828 3.515a4 4 0 0 0 5.657 5.657" /></svg>
|
||||
|
After Width: | Height: | Size: 477 B |
43
common/icons/dna.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://baaujfw8piywi"
|
||||
path="res://.godot/imported/dna.svg-0d37cb06a607035637eb8d87826b10a6.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/dna.svg"
|
||||
dest_files=["res://.godot/imported/dna.svg-0d37cb06a607035637eb8d87826b10a6.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
1
common/icons/growth.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-growth"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M16.5 15a4.5 4.5 0 0 0 -4.5 4.5m4.5 -8.5a4.5 4.5 0 0 0 -4.5 4.5m4.5 -8.5a4.5 4.5 0 0 0 -4.5 4.5m-4 3.5c2.21 0 4 2.015 4 4.5m-4 -8.5c2.21 0 4 2.015 4 4.5m-4 -8.5c2.21 0 4 2.015 4 4.5m0 -7.5v6" /></svg>
|
||||
|
After Width: | Height: | Size: 511 B |
43
common/icons/growth.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bt3g5bmar0icf"
|
||||
path="res://.godot/imported/growth.svg-48236356d5fd42c9e5085fb182bc9588.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/growth.svg"
|
||||
dest_files=["res://.godot/imported/growth.svg-48236356d5fd42c9e5085fb182bc9588.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
1
common/icons/north-star.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-north-star"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 12h18" /><path d="M12 21v-18" /><path d="M7.5 7.5l9 9" /><path d="M7.5 16.5l9 -9" /></svg>
|
||||
|
After Width: | Height: | Size: 408 B |
43
common/icons/north-star.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b671vii4ecwiu"
|
||||
path="res://.godot/imported/north-star.svg-82ea4f92d13f676657ade91e1d583997.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/north-star.svg"
|
||||
dest_files=["res://.godot/imported/north-star.svg-82ea4f92d13f676657ade91e1d583997.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
1
common/icons/rotate-rectangle.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-rotate-rectangle"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10.09 4.01l.496 -.495a2 2 0 0 1 2.828 0l7.071 7.07a2 2 0 0 1 0 2.83l-7.07 7.07a2 2 0 0 1 -2.83 0l-7.07 -7.07a2 2 0 0 1 0 -2.83l3.535 -3.535h-3.988" /><path d="M7.05 11.038v-3.988" /></svg>
|
||||
|
After Width: | Height: | Size: 510 B |
43
common/icons/rotate-rectangle.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bcjkds8n5qu6x"
|
||||
path="res://.godot/imported/rotate-rectangle.svg-b6ceae7bc4f1e7e0c15941862218ce00.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/rotate-rectangle.svg"
|
||||
dest_files=["res://.godot/imported/rotate-rectangle.svg-b6ceae7bc4f1e7e0c15941862218ce00.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
1
common/icons/seedling-off.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-seedling-off"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M11.412 7.407a6.025 6.025 0 0 0 -2.82 -2.82m-4.592 -.587h-1v2a6 6 0 0 0 6 6h3" /><path d="M12 14a6 6 0 0 1 .255 -1.736m1.51 -2.514a5.981 5.981 0 0 1 4.235 -1.75h3v1c0 2.158 -1.14 4.05 -2.85 5.107m-3.15 .893h-3" /><path d="M12 20v-8" /><path d="M3 3l18 18" /></svg>
|
||||
|
After Width: | Height: | Size: 581 B |
43
common/icons/seedling-off.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dqj5q5lhvsvys"
|
||||
path="res://.godot/imported/seedling-off.svg-8aea0c8abb5542563aa509a335639378.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/seedling-off.svg"
|
||||
dest_files=["res://.godot/imported/seedling-off.svg-8aea0c8abb5542563aa509a335639378.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
1
common/icons/skull.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-skull"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 4c4.418 0 8 3.358 8 7.5c0 1.901 -.755 3.637 -2 4.96l0 2.54a1 1 0 0 1 -1 1h-10a1 1 0 0 1 -1 -1v-2.54c-1.245 -1.322 -2 -3.058 -2 -4.96c0 -4.142 3.582 -7.5 8 -7.5z" /><path d="M10 17v3" /><path d="M14 17v3" /><path d="M9 11m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M15 11m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /></svg>
|
||||
|
After Width: | Height: | Size: 631 B |
43
common/icons/skull.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b43thuq8piv18"
|
||||
path="res://.godot/imported/skull.svg-1f3a01497295060c28293df722ed0ddd.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/skull.svg"
|
||||
dest_files=["res://.godot/imported/skull.svg-1f3a01497295060c28293df722ed0ddd.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
1
common/icons/wood.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-wood"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 5.5m-6 0a6 2.5 0 1 0 12 0a6 2.5 0 1 0 -12 0" /><path d="M18 5.5v4.626a1.415 1.415 0 0 1 1.683 2.18l-.097 .108l-1.586 1.586v4c0 1.61 -2.54 2.925 -5.725 3l-.275 0c-3.314 0 -6 -1.343 -6 -3v-2l-1.586 -1.586a1.414 1.414 0 0 1 1.586 -2.287v-6.627" /><path d="M10 12.5v1.5" /><path d="M14 16v1" /></svg>
|
||||
|
After Width: | Height: | Size: 609 B |
43
common/icons/wood.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://0hbdgalf04e"
|
||||
path="res://.godot/imported/wood.svg-8c01b6ea74bf5bfddd224ed747b01c06.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/wood.svg"
|
||||
dest_files=["res://.godot/imported/wood.svg-8c01b6ea74bf5bfddd224ed747b01c06.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
@ -25,11 +25,21 @@ func get_usage_zone_radius() -> int:
|
||||
func is_one_time_use():
|
||||
return false
|
||||
|
||||
func can_use(_player : Player, zone: Area2D) -> bool:
|
||||
func can_use(_player : Player, zone: Player.ActionZone) -> bool:
|
||||
return false
|
||||
|
||||
func use_text() -> String:
|
||||
return ""
|
||||
|
||||
func use(_player : Player, zone: Area2D):
|
||||
func use(_player : Player, zone: Player.ActionZone):
|
||||
return false
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
get_item_name(),
|
||||
get_description(),
|
||||
get_icon()
|
||||
)
|
||||
|
||||
func get_particles() -> Array[Particles.Parameters]:
|
||||
return []
|
||||
@ -29,11 +29,11 @@ func use_text() -> String:
|
||||
func is_one_time_use():
|
||||
return true
|
||||
|
||||
func can_use(player : Player, zone : Area2D) -> bool:
|
||||
return player.planet.is_in_base(zone.global_position)
|
||||
func can_use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
return player.planet.is_in_base(zone.get_global_position())
|
||||
|
||||
func use(player : Player, zone : Area2D) -> bool:
|
||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
if machine_type and machine_level:
|
||||
player.planet.instantiate_machine(machine_type, machine_level, zone.global_position)
|
||||
player.planet.instantiate_machine(machine_type, machine_level, zone.get_global_position())
|
||||
return true
|
||||
return false
|
||||
|
||||
@ -24,9 +24,9 @@ func use_text() -> String:
|
||||
func is_one_time_use():
|
||||
return true
|
||||
|
||||
func can_use(player : Player, zone : Area2D) -> bool:
|
||||
func can_use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
return true
|
||||
|
||||
func use(player : Player, zone : Area2D) -> bool:
|
||||
player.planet.instantiate_entity(scene, zone.global_position)
|
||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
player.planet.instantiate_entity(scene, zone.get_global_position())
|
||||
return true
|
||||
|
||||
@ -1,13 +1,20 @@
|
||||
extends Item
|
||||
class_name Seed
|
||||
|
||||
const MUTATION_PROBABILITY = 0.2
|
||||
|
||||
const SHOVEL_ICON = preload("res://common/icons/shovel.svg")
|
||||
const GROWING_ICON = preload("res://common/icons/chevrons-up.svg")
|
||||
const SCORE_ICON = preload("res://common/icons/growth.svg")
|
||||
|
||||
@export var plant_type: PlantType
|
||||
@export var plant_mutations: Array[PlantMutation]
|
||||
|
||||
func get_item_name() -> String:
|
||||
return plant_type.name
|
||||
|
||||
func get_description() -> String:
|
||||
return plant_type.description
|
||||
return ""
|
||||
|
||||
func get_icon() -> Texture2D:
|
||||
return plant_type.seed_texture
|
||||
@ -15,8 +22,15 @@ func get_icon() -> Texture2D:
|
||||
func get_energy_used() -> int:
|
||||
return 1
|
||||
|
||||
func _init(_plant_type : PlantType = null):
|
||||
func get_usage_zone_radius() -> int:
|
||||
return 30
|
||||
|
||||
func _init(
|
||||
_plant_type : PlantType = null,
|
||||
_parent_mutation : Array[PlantMutation] = []
|
||||
):
|
||||
plant_type = _plant_type
|
||||
plant_mutations = Seed.mutate(_parent_mutation)
|
||||
|
||||
func use_text() -> String:
|
||||
return "Plant " + plant_type.name
|
||||
@ -24,14 +38,134 @@ func use_text() -> String:
|
||||
func is_one_time_use():
|
||||
return true
|
||||
|
||||
func can_use(player : Player, zone : Area2D) -> bool:
|
||||
func can_use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
var is_there_a_plant_here = false
|
||||
for area in zone.get_overlapping_areas() :
|
||||
for area in zone.area.get_overlapping_areas() :
|
||||
if area is Plant:
|
||||
is_there_a_plant_here = true
|
||||
|
||||
var is_there_contamination_in_zone = false
|
||||
for point in zone.get_points_in_zone():
|
||||
if player.planet.is_there_contamination(point):
|
||||
is_there_contamination_in_zone = true
|
||||
|
||||
return not is_there_a_plant_here and not player.planet.is_there_contamination(zone.global_position)
|
||||
return not is_there_a_plant_here and not is_there_contamination_in_zone
|
||||
|
||||
func use(player : Player, zone : Area2D) -> bool:
|
||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
player.play_sfx("dig")
|
||||
return player.planet.plant(plant_type, zone.global_position)
|
||||
return player.planet.plant(
|
||||
plant_type,
|
||||
zone.get_global_position(),
|
||||
plant_mutations
|
||||
)
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
var info = Inspector.Info.new(
|
||||
get_item_name(),
|
||||
get_description(),
|
||||
get_icon()
|
||||
)
|
||||
|
||||
for m in plant_mutations:
|
||||
info.framed_infos.append(
|
||||
PlantMutation.get_framed_info_from_mutation(m)
|
||||
)
|
||||
|
||||
info.framed_infos.append_array(
|
||||
PlantEffect.get_framed_info_from_all_trigger_effects(
|
||||
plant_type.default_mature_effects,
|
||||
plant_type.default_harvest_effects,
|
||||
plant_type.default_cyclic_effects
|
||||
)
|
||||
)
|
||||
|
||||
info.stat_infos = [
|
||||
Inspector.StatInfo.new(
|
||||
"[b]%d[/b] points when mature" % plant_type.default_plant_score,
|
||||
SCORE_ICON
|
||||
),
|
||||
Inspector.StatInfo.new(
|
||||
"Grow in [b]%d[/b] days" % plant_type.default_growing_time,
|
||||
GROWING_ICON
|
||||
)
|
||||
]
|
||||
|
||||
return info
|
||||
|
||||
func get_particles() -> Array[Particles.Parameters]:
|
||||
var param : Array[Particles.Parameters] = []
|
||||
|
||||
for m in plant_mutations:
|
||||
param.append(
|
||||
Particles.Parameters.new(
|
||||
m.get_icon(),
|
||||
PlantMutation.get_rarity_color(m)
|
||||
)
|
||||
)
|
||||
|
||||
return param
|
||||
|
||||
static func mutate(parent_mutation : Array[PlantMutation] = []) -> Array[PlantMutation]:
|
||||
|
||||
if randf() > MUTATION_PROBABILITY:
|
||||
return parent_mutation
|
||||
|
||||
var possible_mutations : Array[MutationPossibility] = [
|
||||
AddMutation.new()
|
||||
]
|
||||
|
||||
if len(parent_mutation):
|
||||
possible_mutations.append_array( [
|
||||
UpgradeMutation.new(),
|
||||
RemoveMutation.new(),
|
||||
])
|
||||
|
||||
var chosen_mutation = possible_mutations.pick_random()
|
||||
|
||||
return chosen_mutation.mutate(parent_mutation)
|
||||
|
||||
|
||||
class MutationPossibility:
|
||||
func mutate(_parent_mutation : Array[PlantMutation] = [])-> Array[PlantMutation]:
|
||||
return []
|
||||
|
||||
class DontMutate extends MutationPossibility:
|
||||
func mutate(parent_mutation : Array[PlantMutation] = [])-> Array[PlantMutation]:
|
||||
return parent_mutation
|
||||
|
||||
class AddMutation extends MutationPossibility:
|
||||
func mutate(parent_mutation : Array[PlantMutation] = [])-> Array[PlantMutation]:
|
||||
var new_mutations = parent_mutation.duplicate_deep()
|
||||
var mut = PlantMutation.random_mutation()
|
||||
|
||||
if mut:
|
||||
var existing_mut_id = new_mutations.find_custom(func(m:PlantMutation): m.get_mutation_name() == mut.get_mutation_name())
|
||||
|
||||
if existing_mut_id >= 0:
|
||||
new_mutations[existing_mut_id].level += 1
|
||||
else :
|
||||
new_mutations.append(mut)
|
||||
|
||||
return new_mutations
|
||||
|
||||
class UpgradeMutation extends MutationPossibility:
|
||||
func mutate(
|
||||
parent_mutation : Array[PlantMutation] = []
|
||||
) -> Array[PlantMutation]:
|
||||
var new_mutations = parent_mutation.duplicate_deep()
|
||||
|
||||
new_mutations.pick_random().level += 1
|
||||
|
||||
return new_mutations
|
||||
|
||||
class RemoveMutation extends MutationPossibility:
|
||||
func mutate(parent_mutation : Array[PlantMutation] = [])-> Array[PlantMutation]:
|
||||
var new_mutations :Array[PlantMutation] = parent_mutation.duplicate_deep()
|
||||
|
||||
var mut_to_remove = new_mutations.pick_random()
|
||||
if mut_to_remove.level > 1:
|
||||
mut_to_remove.level -= 1
|
||||
else:
|
||||
new_mutations.remove_at(new_mutations.find(mut_to_remove))
|
||||
|
||||
return new_mutations
|
||||
|
||||
@ -2,7 +2,7 @@ extends Item
|
||||
class_name Shovel
|
||||
|
||||
const USE_INTERVAL = 0.15
|
||||
const SHOVEL_ZONE_RADIUS = 50
|
||||
const SHOVEL_ZONE_RADIUS = 30
|
||||
|
||||
func get_item_name() -> String:
|
||||
return "Shovel"
|
||||
@ -22,16 +22,16 @@ func get_usage_zone_radius() -> int:
|
||||
func use_text() -> String:
|
||||
return "Dig"
|
||||
|
||||
func can_use(_player : Player, zone : Area2D) -> bool:
|
||||
var areas = zone.get_overlapping_areas()
|
||||
func can_use(_player : Player, zone : Player.ActionZone) -> bool:
|
||||
var areas = zone.area.get_overlapping_areas()
|
||||
for area in areas :
|
||||
if area is Plant or area is UndergroundLoot:
|
||||
return true
|
||||
return false
|
||||
|
||||
func use(player : Player, zone : Area2D) -> bool:
|
||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
dig(
|
||||
zone.get_overlapping_areas(),
|
||||
zone.area.get_overlapping_areas(),
|
||||
player
|
||||
)
|
||||
|
||||
|
||||
17
common/vfx/circle/scripts/circle.gd
Normal file
@ -0,0 +1,17 @@
|
||||
extends Sprite2D
|
||||
class_name Circle
|
||||
|
||||
@export var radius : int = 0
|
||||
@export var color : Color = Color.WHITE
|
||||
@export var opacity : float = 1.0
|
||||
@export var fill : bool = true
|
||||
@export var width : int = -1
|
||||
|
||||
func _draw():
|
||||
draw_circle(
|
||||
Vector2.ZERO,
|
||||
radius,
|
||||
Color(color.r, color.g, color.b, color.a * opacity),
|
||||
fill,
|
||||
width
|
||||
)
|
||||
1
common/vfx/circle/scripts/circle.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://c60a1bjcuj4hd
|
||||
32
common/vfx/particles/particles.tscn
Normal file
@ -0,0 +1,32 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://bg7jmrwdgdqg4"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://baaujfw8piywi" path="res://common/icons/dna.svg" id="1_88fy1"]
|
||||
[ext_resource type="Script" uid="uid://bddlpqlfrydn8" path="res://common/vfx/particles/scripts/particles.gd" id="1_faap1"]
|
||||
|
||||
[sub_resource type="Curve" id="Curve_xmi7c"]
|
||||
_limits = [-200.0, 200.0, 0.0, 1.0]
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.2513369, 200), 0.0, 0.0, 0, 0, Vector2(0.7540107, -200), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 4
|
||||
|
||||
[sub_resource type="Curve" id="Curve_22a4c"]
|
||||
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.2620321, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_li6gc"]
|
||||
offsets = PackedFloat32Array(0, 0.80172414, 1)
|
||||
colors = PackedColorArray(1, 1, 1, 0.65882355, 1, 1, 1, 0.72156864, 1, 1, 1, 0)
|
||||
|
||||
[node name="Particles" type="CPUParticles2D"]
|
||||
amount = 1
|
||||
texture = ExtResource("1_88fy1")
|
||||
emission_shape = 1
|
||||
emission_sphere_radius = 30.0
|
||||
gravity = Vector2(0, -20)
|
||||
tangential_accel_min = -0.1
|
||||
tangential_accel_max = 0.1
|
||||
tangential_accel_curve = SubResource("Curve_xmi7c")
|
||||
scale_amount_min = 0.4
|
||||
scale_amount_max = 0.6
|
||||
scale_amount_curve = SubResource("Curve_22a4c")
|
||||
color_ramp = SubResource("Gradient_li6gc")
|
||||
script = ExtResource("1_faap1")
|
||||
18
common/vfx/particles/scripts/particles.gd
Normal file
@ -0,0 +1,18 @@
|
||||
extends CPUParticles2D
|
||||
class_name Particles
|
||||
|
||||
func setup_particles(param : Parameters):
|
||||
texture = param.texture
|
||||
modulate = param.color
|
||||
emitting = true
|
||||
|
||||
class Parameters:
|
||||
var texture : Texture
|
||||
var color : Color
|
||||
|
||||
func _init(
|
||||
_texture : Texture,
|
||||
_color : Color = Color.WHITE
|
||||
):
|
||||
texture = _texture
|
||||
color = _color
|
||||
1
common/vfx/particles/scripts/particles.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://bddlpqlfrydn8
|
||||
@ -10,6 +10,7 @@ const SPRITE_SCENE : PackedScene = preload("res://entities/interactables/item_ob
|
||||
item = _item
|
||||
if object_sprite:
|
||||
object_sprite.apply_texture_to_sprite(item.icon, ITEM_SPRITE_SIZE)
|
||||
object_sprite.generate_particles(item.get_particles())
|
||||
|
||||
@onready var object_sprite : ItemObjectSprite = generate_sprite()
|
||||
|
||||
@ -21,6 +22,7 @@ func _ready():
|
||||
generate_collision(ITEM_AREA_WIDTH)
|
||||
if item and object_sprite:
|
||||
object_sprite.apply_texture_to_sprite(item.icon, ITEM_SPRITE_SIZE)
|
||||
object_sprite.generate_particles(item.get_particles())
|
||||
|
||||
func pointer_text():
|
||||
var name_suffix = ""
|
||||
@ -36,11 +38,7 @@ func interact_text():
|
||||
return "Take"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text(),
|
||||
item.description,
|
||||
item.icon
|
||||
)
|
||||
return item.inspector_info()
|
||||
|
||||
func interact(player : Player) -> bool:
|
||||
var swapped_item = player.pick_item(item)
|
||||
@ -61,16 +59,17 @@ func pickup_animation(player : Player):
|
||||
func():
|
||||
queue_free()
|
||||
)
|
||||
object_sprite.pickup_animation()
|
||||
if object_sprite:
|
||||
object_sprite.pickup_animation()
|
||||
|
||||
func generate_sprite() -> ItemObjectSprite:
|
||||
var spriteNode = SPRITE_SCENE.instantiate() as ItemObjectSprite
|
||||
add_child(spriteNode)
|
||||
var sprite_node = SPRITE_SCENE.instantiate() as ItemObjectSprite
|
||||
add_child(sprite_node)
|
||||
|
||||
if item:
|
||||
spriteNode.apply_texture_to_sprite(
|
||||
sprite_node.apply_texture_to_sprite(
|
||||
item.icon,
|
||||
ITEM_SPRITE_SIZE
|
||||
)
|
||||
|
||||
return spriteNode
|
||||
return sprite_node
|
||||
|
||||
@ -1,15 +1,26 @@
|
||||
extends Node2D
|
||||
class_name ItemObjectSprite
|
||||
|
||||
@onready var iconSprite = $Icon
|
||||
@onready var icon_sprite = $Icon
|
||||
|
||||
const PARTICLES_SCENE : PackedScene = preload("res://common/vfx/particles/particles.tscn")
|
||||
|
||||
func apply_texture_to_sprite(texture, item_sprite_size = 50.):
|
||||
if texture:
|
||||
iconSprite.texture = texture
|
||||
iconSprite.scale = Vector2(
|
||||
icon_sprite.texture = texture
|
||||
icon_sprite.scale = Vector2(
|
||||
1./(texture.get_width()/item_sprite_size),
|
||||
1./(texture.get_height()/item_sprite_size)
|
||||
)
|
||||
|
||||
func generate_particles(particles_params : Array[Particles.Parameters]):
|
||||
for c in get_children():
|
||||
if c is Particles: queue_free()
|
||||
|
||||
for params in particles_params:
|
||||
var particles_emitter : Particles = PARTICLES_SCENE.instantiate() as Particles
|
||||
particles_emitter.setup_particles(params)
|
||||
add_child(particles_emitter)
|
||||
|
||||
func pickup_animation():
|
||||
%AnimationPlayer.play("pickup")
|
||||
|
||||
|
After Width: | Height: | Size: 999 KiB |
@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://n7hhyqhhtx0q"
|
||||
path="res://.godot/imported/compost.png-af443333eb9a31de9cc4cb40ab9c40c2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/interactables/machines/compost/assets/sprites/compost.png"
|
||||
dest_files=["res://.godot/imported/compost.png-af443333eb9a31de9cc4cb40ab9c40c2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@ -1,96 +1,27 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://bkwh1ntvgkkrt"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bw2ckthka71y8" path="res://entities/interactables/machines/compost/scripts/energy_compost.gd" id="1_2s0lp"]
|
||||
[ext_resource type="Texture2D" uid="uid://f2rte5jc0psp" path="res://entities/interactables/machines/compost/assets/sprites/compost.svg" id="2_pi0jt"]
|
||||
[ext_resource type="Texture2D" uid="uid://n7hhyqhhtx0q" path="res://entities/interactables/machines/compost/assets/sprites/compost.png" id="2_pi0jt"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="3_85qj7"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="3_y0cke"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_akkx7"]
|
||||
size = Vector2(66, 84)
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_6kmun"]
|
||||
radius = 51.884487
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_etofw"]
|
||||
bg_color = Color(0.260098, 0.11665, 0.0419712, 0.231373)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3ao1n"]
|
||||
bg_color = Color(0.270222, 0.270222, 0.270222, 1)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_m2a0h"]
|
||||
font = ExtResource("3_y0cke")
|
||||
font_size = 23
|
||||
|
||||
[sub_resource type="Animation" id="Animation_r6435"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.291262, 0.291262)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_1758a"]
|
||||
resource_name = "empty"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0, 12.605), Vector2(0, -24.56), Vector2(0, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:scale")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.291262, 0.291262), Vector2(0.291, 0.191), Vector2(0.291, 0.366), Vector2(0.291262, 0.291262)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_etofw"]
|
||||
resource_name = "fill"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.291262, 0.291262), Vector2(0.291, 0.231), Vector2(0.291262, 0.291262)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_etofw"]
|
||||
_data = {
|
||||
@ -103,29 +34,29 @@ _data = {
|
||||
script = ExtResource("1_2s0lp")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_akkx7")
|
||||
shape = SubResource("CircleShape2D_6kmun")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
self_modulate = Color(0.729698, 0.588265, 0.105405, 1)
|
||||
scale = Vector2(0.291262, 0.291262)
|
||||
[node name="Compost" type="Sprite2D" parent="."]
|
||||
position = Vector2(1.9073486e-06, 15.999998)
|
||||
scale = Vector2(0.11194731, 0.11194731)
|
||||
texture = ExtResource("2_pi0jt")
|
||||
|
||||
[node name="ProgressBar" type="ProgressBar" parent="Sprite"]
|
||||
[node name="ContainerCount" type="Label" parent="."]
|
||||
unique_name_in_owner = true
|
||||
offset_left = -62.0
|
||||
offset_top = -7.0
|
||||
offset_right = 62.0
|
||||
offset_bottom = 120.0
|
||||
theme_override_styles/background = SubResource("StyleBoxFlat_etofw")
|
||||
theme_override_styles/fill = SubResource("StyleBoxFlat_3ao1n")
|
||||
fill_mode = 3
|
||||
show_percentage = false
|
||||
modulate = Color(0.140831, 0.20012599, 0.3145095, 1)
|
||||
offset_left = 18.0
|
||||
offset_top = 37.0
|
||||
offset_right = 59.051178
|
||||
offset_bottom = 61.0
|
||||
rotation = -0.48016798
|
||||
text = "3/5"
|
||||
label_settings = SubResource("LabelSettings_m2a0h")
|
||||
|
||||
[node name="Bolt" type="Sprite2D" parent="Sprite"]
|
||||
[node name="Bolt" type="Sprite2D" parent="."]
|
||||
modulate = Color(0.140831, 0.20012599, 0.3145095, 1)
|
||||
z_index = 1
|
||||
position = Vector2(0, 54.9334)
|
||||
scale = Vector2(2.00278, 2.00278)
|
||||
position = Vector2(-41.999996, 36)
|
||||
scale = Vector2(0.5833337, 0.5833337)
|
||||
texture = ExtResource("3_85qj7")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
|
||||
@ -1,96 +1,27 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://b13debm055r3t"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d0yt8pd41j2os" path="res://entities/interactables/machines/compost/scripts/seed_compost.gd" id="1_b8mmk"]
|
||||
[ext_resource type="Texture2D" uid="uid://f2rte5jc0psp" path="res://entities/interactables/machines/compost/assets/sprites/compost.svg" id="2_s8eov"]
|
||||
[ext_resource type="Script" uid="uid://bw2ckthka71y8" path="res://entities/interactables/machines/compost/scripts/energy_compost.gd" id="1_s8eov"]
|
||||
[ext_resource type="Texture2D" uid="uid://n7hhyqhhtx0q" path="res://entities/interactables/machines/compost/assets/sprites/compost.png" id="2_c0so3"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0wy3dbpxbnt7" path="res://common/icons/seedling.svg" id="3_s8eov"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="3_sw66v"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_akkx7"]
|
||||
size = Vector2(66, 84)
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_6kmun"]
|
||||
radius = 51.884487
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_etofw"]
|
||||
bg_color = Color(0.260098, 0.11665, 0.0419712, 0.231373)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3ao1n"]
|
||||
bg_color = Color(0.270222, 0.270222, 0.270222, 1)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_m2a0h"]
|
||||
font = ExtResource("3_sw66v")
|
||||
font_size = 23
|
||||
|
||||
[sub_resource type="Animation" id="Animation_r6435"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.291262, 0.291262)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_1758a"]
|
||||
resource_name = "empty"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0, 12.605), Vector2(0, -24.56), Vector2(0, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:scale")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.291262, 0.291262), Vector2(0.291, 0.191), Vector2(0.291, 0.366), Vector2(0.291262, 0.291262)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_etofw"]
|
||||
resource_name = "fill"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.291262, 0.291262), Vector2(0.291, 0.231), Vector2(0.291262, 0.291262)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_etofw"]
|
||||
_data = {
|
||||
@ -99,33 +30,33 @@ _data = {
|
||||
&"fill": SubResource("Animation_etofw")
|
||||
}
|
||||
|
||||
[node name="Compost" type="Area2D"]
|
||||
script = ExtResource("1_b8mmk")
|
||||
[node name="SeedCompost" type="Area2D"]
|
||||
script = ExtResource("1_s8eov")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_akkx7")
|
||||
shape = SubResource("CircleShape2D_6kmun")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
[node name="Compost" type="Sprite2D" parent="."]
|
||||
position = Vector2(1.9073486e-06, 15.999998)
|
||||
scale = Vector2(0.11194731, 0.11194731)
|
||||
texture = ExtResource("2_c0so3")
|
||||
|
||||
[node name="ContainerCount" type="Label" parent="."]
|
||||
unique_name_in_owner = true
|
||||
self_modulate = Color(0.90820795, 0.68268144, 0.2216644, 1)
|
||||
scale = Vector2(0.291262, 0.291262)
|
||||
texture = ExtResource("2_s8eov")
|
||||
modulate = Color(0.140831, 0.20012599, 0.3145095, 1)
|
||||
offset_left = 18.0
|
||||
offset_top = 37.0
|
||||
offset_right = 59.051178
|
||||
offset_bottom = 61.0
|
||||
rotation = -0.48016798
|
||||
text = "3/5"
|
||||
label_settings = SubResource("LabelSettings_m2a0h")
|
||||
|
||||
[node name="ProgressBar" type="ProgressBar" parent="Sprite"]
|
||||
unique_name_in_owner = true
|
||||
offset_left = -62.0
|
||||
offset_top = -7.0
|
||||
offset_right = 62.0
|
||||
offset_bottom = 120.0
|
||||
theme_override_styles/background = SubResource("StyleBoxFlat_etofw")
|
||||
theme_override_styles/fill = SubResource("StyleBoxFlat_3ao1n")
|
||||
fill_mode = 3
|
||||
show_percentage = false
|
||||
|
||||
[node name="Bolt" type="Sprite2D" parent="Sprite"]
|
||||
[node name="Bolt" type="Sprite2D" parent="."]
|
||||
modulate = Color(0.140831, 0.20012599, 0.3145095, 1)
|
||||
z_index = 1
|
||||
position = Vector2(0, 54.9334)
|
||||
scale = Vector2(2.00278, 2.00278)
|
||||
position = Vector2(-41.999996, 36)
|
||||
scale = Vector2(0.5833337, 0.5833337)
|
||||
texture = ExtResource("3_s8eov")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
extends Machine
|
||||
class_name Compost
|
||||
|
||||
var containing_seed : int = 0
|
||||
@onready var containing_seed : int = 0 :
|
||||
set(v):
|
||||
containing_seed = v
|
||||
%ContainerCount.text = str(containing_seed) + "/" + str(get_seed_needed())
|
||||
|
||||
func get_seed_needed(l : int = level) -> int:
|
||||
match l:
|
||||
@ -10,12 +13,6 @@ func get_seed_needed(l : int = level) -> int:
|
||||
3: return 3
|
||||
_: return 2
|
||||
|
||||
func setup_machine_sprite():
|
||||
%Sprite.self_modulate = Machine.get_level_color(level)
|
||||
|
||||
func _process(_delta):
|
||||
%ProgressBar.value = lerp(%ProgressBar.value, float(containing_seed) / float(get_seed_needed()) * 100, 0.5)
|
||||
|
||||
func interact_text():
|
||||
return "Put a seed ("+str(get_seed_needed() - containing_seed)+" left)"
|
||||
|
||||
@ -35,6 +32,7 @@ func interact(p : Player) -> bool:
|
||||
product(p)
|
||||
else:
|
||||
$AnimationPlayer.play("fill")
|
||||
|
||||
return true
|
||||
|
||||
func product(player : Player):
|
||||
|
||||
@ -22,7 +22,6 @@ func get_energy_production(l : int = level) -> int:
|
||||
func _pass_day():
|
||||
if not charged:
|
||||
recharge_days += 1
|
||||
print(get_days_to_recharge())
|
||||
if recharge_days >= get_days_to_recharge():
|
||||
set_charged(true)
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ extends InspectableEntity
|
||||
class_name Objective
|
||||
|
||||
const RANDOM_MAX_OBJECTIVE_INTERVAL = 1.
|
||||
const DECONTAMINATION_ICON = preload("res://common/icons/skull.svg")
|
||||
|
||||
var completed : bool = false
|
||||
var planet : Planet
|
||||
@ -17,11 +18,21 @@ func pointer_text():
|
||||
return "Contamination Objective"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
var info : Inspector.Info = Inspector.Info.new(
|
||||
pointer_text(),
|
||||
"If the zone around is decontaminated, give the following reward.\n\n" + reward.get_description(),
|
||||
"This dead log can hide a treasure of life."
|
||||
)
|
||||
|
||||
info.framed_infos.append(
|
||||
Inspector.FramedInfo.new(
|
||||
"When decontamined",
|
||||
reward.get_description(),
|
||||
DECONTAMINATION_ICON
|
||||
)
|
||||
)
|
||||
|
||||
return info
|
||||
|
||||
func _end_pass_day():
|
||||
if planet and not completed:
|
||||
if not planet.is_there_contamination(global_position):
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://2hrg6yjk0yt0"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://2hrg6yjk0yt0"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bmjjpk4lvijws" path="res://entities/plants/scripts/plant_sprite.gd" id="1_pq8o7"]
|
||||
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="3_j6jm5"]
|
||||
[ext_resource type="Texture2D" uid="uid://bu26h0iqutnky" path="res://entities/underground_loot/assets/sprites/underground_loot.svg" id="4_j6jm5"]
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_rbgiq"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wyuub"]
|
||||
atlas = ExtResource("3_j6jm5")
|
||||
region = Rect2(76, 75, 124, 135)
|
||||
@ -106,7 +104,7 @@ script = ExtResource("1_pq8o7")
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
scale = Vector2(0.15, 0.15)
|
||||
texture = SubResource("CompressedTexture2D_rbgiq")
|
||||
offset = Vector2(0, -151.56)
|
||||
|
||||
[node name="PlantedSeed" type="Sprite2D" parent="Sprite"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
[gd_resource type="Resource" script_class="AncientMutation" load_steps=2 format=3 uid="uid://dys1ehlg4kwh7"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c7po0bstyg80u" path="res://entities/plants/scripts/plant_mutation/ancient_mutation.gd" id="1_5g2qg"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_5g2qg")
|
||||
metadata/_custom_type_script = "uid://c7po0bstyg80u"
|
||||
@ -0,0 +1,6 @@
|
||||
[gd_resource type="Resource" script_class="ElitistMutation" load_steps=2 format=3 uid="uid://d38alhstybdtf"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bt1xh7ss13e5e" path="res://entities/plants/scripts/plant_mutation/elitist_mutation.gd" id="1_jevqj"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_jevqj")
|
||||
@ -0,0 +1,6 @@
|
||||
[gd_resource type="Resource" script_class="ErmitMutation" load_steps=2 format=3 uid="uid://dktlbpira5kxb"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://domy822vgxfxs" path="res://entities/plants/scripts/plant_mutation/ermit_mutation.gd" id="1_yqhf5"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_yqhf5")
|
||||
@ -0,0 +1,7 @@
|
||||
[gd_resource type="Resource" script_class="PrecociousMutation" load_steps=2 format=3 uid="uid://c3am7s5bjy8qk"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cx5mg5vf62bia" path="res://entities/plants/scripts/plant_mutation/precocious_mutation.gd" id="1_wjcm0"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_wjcm0")
|
||||
metadata/_custom_type_script = "uid://cx5mg5vf62bia"
|
||||
@ -0,0 +1,7 @@
|
||||
[gd_resource type="Resource" script_class="QualityMutation" load_steps=2 format=3 uid="uid://uabbkvg1rciq"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bdobyk2j625lb" path="res://entities/plants/scripts/plant_mutation/quality_mutation.gd" id="1_u0ku1"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_u0ku1")
|
||||
metadata/_custom_type_script = "uid://bdobyk2j625lb"
|
||||
@ -0,0 +1,7 @@
|
||||
[gd_resource type="Resource" script_class="QuickMutation" load_steps=2 format=3 uid="uid://b04gaipu237sx"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bhtq0cbrgu58v" path="res://entities/plants/scripts/plant_mutation/quick_mutation.gd" id="1_hr7tm"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_hr7tm")
|
||||
metadata/_custom_type_script = "uid://bhtq0cbrgu58v"
|
||||
@ -0,0 +1,7 @@
|
||||
[gd_resource type="Resource" script_class="SociableMutation" load_steps=2 format=3 uid="uid://bpkvdvael2ojh"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b8q5xgvy85qeb" path="res://entities/plants/scripts/plant_mutation/sociable_mutation.gd" id="1_7u0mw"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_7u0mw")
|
||||
metadata/_custom_type_script = "uid://b8q5xgvy85qeb"
|
||||
@ -0,0 +1,7 @@
|
||||
[gd_resource type="Resource" script_class="StrongMutation" load_steps=2 format=3 uid="uid://co2r0jnkf8hyb"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cwj3k4p6ci5t4" path="res://entities/plants/scripts/plant_mutation/strong_mutation.gd" id="1_c0ieg"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_c0ieg")
|
||||
metadata/_custom_type_script = "uid://cwj3k4p6ci5t4"
|
||||
@ -1,15 +1,18 @@
|
||||
[gd_resource type="Resource" script_class="PlantType" load_steps=8 format=3 uid="uid://cxrc5wchpqm18"]
|
||||
[gd_resource type="Resource" script_class="PlantType" load_steps=10 format=3 uid="uid://cxrc5wchpqm18"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ceqx5va1ormau" path="res://entities/plants/scripts/plant_effects/produce_seeds.gd" id="1_cf34j"]
|
||||
[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="1_ipcpv"]
|
||||
[ext_resource type="Script" uid="uid://bpycohqas4hff" path="res://entities/plants/scripts/plant_effect.gd" id="1_l2hi3"]
|
||||
[ext_resource type="Texture2D" uid="uid://dmsls8siudy1u" path="res://entities/plants/assets/sprites/champ/growing.png" id="2_l2hi3"]
|
||||
[ext_resource type="Texture2D" uid="uid://crc4aop6ajiau" path="res://entities/plants/assets/sprites/champ/mature.png" id="3_y8qve"]
|
||||
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_liopn"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_5hyy8"]
|
||||
[sub_resource type="Resource" id="Resource_l2hi3"]
|
||||
script = ExtResource("1_cf34j")
|
||||
metadata/_custom_type_script = "uid://ceqx5va1ormau"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_cf34j"]
|
||||
script = ExtResource("1_cf34j")
|
||||
produce_types_path = Array[String](["uid://cxrc5wchpqm18", "uid://b04vho33bl52b", "uid://dsctivn1vrem2", "uid://c5oxxif3h5yxo"])
|
||||
produce_number = Array[int]([1, 0])
|
||||
metadata/_custom_type_script = "uid://ceqx5va1ormau"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_my6by"]
|
||||
@ -19,11 +22,11 @@ region = Rect2(610, 315, 124, 180)
|
||||
[resource]
|
||||
script = ExtResource("1_ipcpv")
|
||||
name = "Champ"
|
||||
description = "When mature, can produce one seed every day."
|
||||
growing_time = 1
|
||||
description = "A cool fluorescent plant. Some say that it has a big network of roots underground."
|
||||
default_growing_time = 3
|
||||
seed_texture = SubResource("AtlasTexture_my6by")
|
||||
growing_texture = ExtResource("2_l2hi3")
|
||||
mature_texture = ExtResource("3_y8qve")
|
||||
cyclic_effect = SubResource("Resource_5hyy8")
|
||||
harvest_types_path = Array[String](["uid://cxrc5wchpqm18"])
|
||||
default_harvest_effects = Array[ExtResource("1_l2hi3")]([SubResource("Resource_cf34j"), null])
|
||||
default_cyclic_effects = Array[ExtResource("1_l2hi3")]([SubResource("Resource_l2hi3")])
|
||||
metadata/_custom_type_script = "uid://jnye5pe1bgqw"
|
||||
|
||||
@ -1,14 +1,20 @@
|
||||
[gd_resource type="Resource" script_class="PlantType" load_steps=8 format=3 uid="uid://b04vho33bl52b"]
|
||||
[gd_resource type="Resource" script_class="PlantType" load_steps=11 format=3 uid="uid://b04vho33bl52b"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bpycohqas4hff" path="res://entities/plants/scripts/plant_effect.gd" id="1_40c3e"]
|
||||
[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="1_moyj3"]
|
||||
[ext_resource type="Texture2D" uid="uid://c7mp7tkkkk6o5" path="res://entities/plants/assets/sprites/chardi/growing.png" id="1_prk5s"]
|
||||
[ext_resource type="Script" uid="uid://cgscbuxe4dawb" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="2_cky1j"]
|
||||
[ext_resource type="Script" uid="uid://ceqx5va1ormau" path="res://entities/plants/scripts/plant_effects/produce_seeds.gd" id="2_prk5s"]
|
||||
[ext_resource type="Texture2D" uid="uid://bupl1y0cfj21q" path="res://entities/plants/assets/sprites/chardi/mature.png" id="3_40c3e"]
|
||||
[ext_resource type="Script" uid="uid://cgscbuxe4dawb" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="3_ajihu"]
|
||||
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_cky1j"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_c76qk"]
|
||||
script = ExtResource("2_cky1j")
|
||||
improve_by_lifetime_max = 300
|
||||
[sub_resource type="Resource" id="Resource_40c3e"]
|
||||
script = ExtResource("2_prk5s")
|
||||
metadata/_custom_type_script = "uid://ceqx5va1ormau"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_k7yib"]
|
||||
script = ExtResource("3_ajihu")
|
||||
level = 1
|
||||
metadata/_custom_type_script = "uid://cgscbuxe4dawb"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qt76e"]
|
||||
@ -19,11 +25,9 @@ region = Rect2(1140, 345, 141, 128)
|
||||
script = ExtResource("1_moyj3")
|
||||
name = "Chardi"
|
||||
description = "This plant remove a lot of contamination around when it becomes mature."
|
||||
growing_time = 1
|
||||
seed_texture = SubResource("AtlasTexture_qt76e")
|
||||
growing_texture = ExtResource("1_prk5s")
|
||||
mature_texture = ExtResource("3_40c3e")
|
||||
mature_effect = SubResource("Resource_c76qk")
|
||||
harvest_types_path = Array[String](["uid://b04vho33bl52b"])
|
||||
harvest_number = Array[int]([1, 2, 1])
|
||||
default_harvest_effects = Array[ExtResource("1_40c3e")]([SubResource("Resource_40c3e")])
|
||||
default_mature_effects = Array[ExtResource("1_40c3e")]([SubResource("Resource_k7yib")])
|
||||
metadata/_custom_type_script = "uid://jnye5pe1bgqw"
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
[gd_resource type="Resource" script_class="PlantType" load_steps=8 format=3 uid="uid://dsctivn1vrem2"]
|
||||
[gd_resource type="Resource" script_class="PlantType" load_steps=9 format=3 uid="uid://dsctivn1vrem2"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bpycohqas4hff" path="res://entities/plants/scripts/plant_effect.gd" id="1_740j2"]
|
||||
[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="1_eqtut"]
|
||||
[ext_resource type="Texture2D" uid="uid://dwr3c6r6piwaa" path="res://entities/plants/assets/sprites/maias/growing.png" id="1_vyplc"]
|
||||
[ext_resource type="Script" uid="uid://cgscbuxe4dawb" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="2_vyplc"]
|
||||
[ext_resource type="Script" uid="uid://ceqx5va1ormau" path="res://entities/plants/scripts/plant_effects/produce_seeds.gd" id="2_740j2"]
|
||||
[ext_resource type="Texture2D" uid="uid://d3apfwbqsg5ha" path="res://entities/plants/assets/sprites/maias/mature.png" id="3_pi4ie"]
|
||||
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_mwrj8"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_q4pje"]
|
||||
script = ExtResource("2_vyplc")
|
||||
impact_radius = 20
|
||||
metadata/_custom_type_script = "uid://cgscbuxe4dawb"
|
||||
[sub_resource type="Resource" id="Resource_1llfc"]
|
||||
script = ExtResource("2_740j2")
|
||||
level = 2
|
||||
metadata/_custom_type_script = "uid://ceqx5va1ormau"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_sri3b"]
|
||||
atlas = ExtResource("6_mwrj8")
|
||||
@ -18,12 +19,9 @@ region = Rect2(1697, 331, 125, 158)
|
||||
[resource]
|
||||
script = ExtResource("1_eqtut")
|
||||
name = "Maias"
|
||||
description = "This gorgeous flower produce a lot of seeds of Maias and Chardi when harvested."
|
||||
growing_time = 1
|
||||
description = "This gorgeous flower produce a lot of seeds when harvested."
|
||||
seed_texture = SubResource("AtlasTexture_sri3b")
|
||||
growing_texture = ExtResource("1_vyplc")
|
||||
mature_texture = ExtResource("3_pi4ie")
|
||||
mature_effect = SubResource("Resource_q4pje")
|
||||
harvest_types_path = Array[String](["uid://b04vho33bl52b", "uid://dsctivn1vrem2"])
|
||||
harvest_number = Array[int]([3, 4])
|
||||
default_harvest_effects = Array[ExtResource("1_740j2")]([SubResource("Resource_1llfc")])
|
||||
metadata/_custom_type_script = "uid://jnye5pe1bgqw"
|
||||
|
||||
@ -1,18 +1,22 @@
|
||||
[gd_resource type="Resource" script_class="PlantType" load_steps=8 format=3 uid="uid://c5oxxif3h5yxo"]
|
||||
[gd_resource type="Resource" script_class="PlantType" load_steps=11 format=3 uid="uid://c5oxxif3h5yxo"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cgscbuxe4dawb" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="1_8wi4i"]
|
||||
[ext_resource type="Script" uid="uid://bpycohqas4hff" path="res://entities/plants/scripts/plant_effect.gd" id="1_8fstu"]
|
||||
[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="1_vn146"]
|
||||
[ext_resource type="Script" uid="uid://cgscbuxe4dawb" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="2_8fstu"]
|
||||
[ext_resource type="Texture2D" uid="uid://xw47qw12d3dv" path="res://entities/plants/assets/sprites/pili/growing.png" id="2_k4b1k"]
|
||||
[ext_resource type="Texture2D" uid="uid://4mh1w1f4q2sa" path="res://entities/plants/assets/sprites/pili/mature.png" id="3_8fstu"]
|
||||
[ext_resource type="Script" uid="uid://ceqx5va1ormau" path="res://entities/plants/scripts/plant_effects/produce_seeds.gd" id="3_26e4l"]
|
||||
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="5_26e4l"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_eytxu"]
|
||||
script = ExtResource("1_8wi4i")
|
||||
impact_radius = 50
|
||||
improve_by_lifetime = true
|
||||
improve_by_lifetime_value = 50
|
||||
script = ExtResource("2_8fstu")
|
||||
level = 2
|
||||
metadata/_custom_type_script = "uid://cgscbuxe4dawb"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_kidty"]
|
||||
script = ExtResource("3_26e4l")
|
||||
metadata/_custom_type_script = "uid://ceqx5va1ormau"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_kidty"]
|
||||
atlas = ExtResource("5_26e4l")
|
||||
region = Rect2(1415, 91, 149, 102)
|
||||
@ -21,10 +25,11 @@ region = Rect2(1415, 91, 149, 102)
|
||||
script = ExtResource("1_vn146")
|
||||
name = "Pili"
|
||||
description = "Pili slowly decontaminate each day when mature. Effect end in four days."
|
||||
growing_time = 1
|
||||
default_growing_time = 4
|
||||
default_plant_score = 2
|
||||
seed_texture = SubResource("AtlasTexture_kidty")
|
||||
growing_texture = ExtResource("2_k4b1k")
|
||||
mature_texture = ExtResource("3_8fstu")
|
||||
cyclic_effect = SubResource("Resource_eytxu")
|
||||
harvest_types_path = Array[String](["uid://c5oxxif3h5yxo"])
|
||||
default_harvest_effects = Array[ExtResource("1_8fstu")]([SubResource("Resource_kidty"), null])
|
||||
default_cyclic_effects = Array[ExtResource("1_8fstu")]([SubResource("Resource_eytxu")])
|
||||
metadata/_custom_type_script = "uid://jnye5pe1bgqw"
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
extends InspectableEntity
|
||||
class_name Plant
|
||||
|
||||
const PLANT_AREA_WIDTH = 20
|
||||
const PLANT_AREA_RADIUS = 20
|
||||
const PLANT_INFLUENCE_RADIUS = 100
|
||||
const HARVESTED_SEED_DISPLACEMENT_FACTOR = 100
|
||||
|
||||
const RANDOM_MAX_GROW_INTERVAL = Planet.PASS_DAY_ANIMATION_TIME/2. - 0.1
|
||||
const PLANT_POINT_ICON = preload("res://common/icons/growth.svg")
|
||||
const LIFETIME_ICON = preload("res://common/icons/calendar-week.svg")
|
||||
const SHOVEL_ICON = preload("res://common/icons/shovel.svg")
|
||||
const GROWING_ICON = preload("res://common/icons/chevrons-up.svg")
|
||||
|
||||
const SPRITE_SCENE : PackedScene = preload("res://entities/plants/plant_sprite.tscn")
|
||||
|
||||
@ -18,82 +23,167 @@ var state: State = State.PLANTED: set = change_state
|
||||
|
||||
@onready var plant_sprite: PlantSprite = generate_sprite()
|
||||
@onready var collision_shape: CollisionShape2D = generate_collision_shape()
|
||||
@onready var influence_zone : PlantInfluenceZone = generate_influence_zone()
|
||||
|
||||
func _init(_plant_type = null, _planet = null):
|
||||
var harvest_effects = []
|
||||
var mature_effects = []
|
||||
var cyclic_effects = []
|
||||
var plant_score = 0
|
||||
var plant_mutations : Array[PlantMutation] = []
|
||||
|
||||
func _init(
|
||||
_plant_type : PlantType,
|
||||
_planet : Planet,
|
||||
_plant_mutations : Array[PlantMutation] = []
|
||||
):
|
||||
plant_type = _plant_type
|
||||
harvest_effects = plant_type.default_harvest_effects.duplicate_deep()
|
||||
mature_effects = plant_type.default_mature_effects.duplicate_deep()
|
||||
cyclic_effects = plant_type.default_cyclic_effects.duplicate_deep()
|
||||
|
||||
planet = _planet
|
||||
|
||||
plant_mutations = _plant_mutations
|
||||
|
||||
func pointer_text():
|
||||
var state_text = "Growing"
|
||||
if state == State.MATURE: state_text = "Mature"
|
||||
return state_text + " " + plant_type.name
|
||||
|
||||
func inspect(is_inspected : bool = true):
|
||||
modulate = MODULATE_INSPECTED_COLOR if is_inspected else default_modulate
|
||||
influence_zone.show_influence = is_inspected
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
var info = Inspector.Info.new(
|
||||
pointer_text(),
|
||||
plant_type.description,
|
||||
"",
|
||||
plant_type.mature_texture
|
||||
)
|
||||
|
||||
for m in plant_mutations:
|
||||
info.framed_infos.append(
|
||||
PlantMutation.get_framed_info_from_mutation(m)
|
||||
)
|
||||
|
||||
info.framed_infos.append_array(
|
||||
PlantEffect.get_framed_info_from_all_trigger_effects(
|
||||
mature_effects, harvest_effects, cyclic_effects
|
||||
)
|
||||
)
|
||||
|
||||
info.stat_infos.append(
|
||||
Inspector.StatInfo.new(
|
||||
"Day [b]%d[/b]" % day,
|
||||
LIFETIME_ICON
|
||||
)
|
||||
)
|
||||
|
||||
if state != State.MATURE:
|
||||
info.stat_infos.append_array([
|
||||
Inspector.StatInfo.new(
|
||||
"Mature on day [b]%d[/b]" % calculate_grow_time(),
|
||||
GROWING_ICON,
|
||||
),
|
||||
Inspector.StatInfo.new(
|
||||
"[b]%d[/b]" % [
|
||||
calculate_plant_score()
|
||||
],
|
||||
PLANT_POINT_ICON
|
||||
),
|
||||
])
|
||||
else:
|
||||
info.stat_infos.append(
|
||||
Inspector.StatInfo.new(
|
||||
"[b]%d[/b] point%s" % [
|
||||
calculate_plant_score(),
|
||||
"s" if calculate_plant_score() > 0 else ""
|
||||
],
|
||||
PLANT_POINT_ICON
|
||||
),
|
||||
)
|
||||
|
||||
return info
|
||||
|
||||
func generate_sprite() -> PlantSprite:
|
||||
var spriteObject : PlantSprite = SPRITE_SCENE.instantiate()
|
||||
var sprite_object : PlantSprite = SPRITE_SCENE.instantiate()
|
||||
|
||||
add_child(spriteObject)
|
||||
spriteObject.update_plant_sprite(self)
|
||||
add_child(sprite_object)
|
||||
sprite_object.update_plant_sprite(self)
|
||||
sprite_object.generate_mutation_effects(self)
|
||||
|
||||
return spriteObject
|
||||
return sprite_object
|
||||
|
||||
func generate_collision_shape() -> CollisionShape2D:
|
||||
var collision = CollisionShape2D.new()
|
||||
var shape = CircleShape2D.new()
|
||||
shape.radius = PLANT_AREA_WIDTH
|
||||
shape.radius = PLANT_AREA_RADIUS
|
||||
|
||||
collision.shape = shape
|
||||
add_child(collision)
|
||||
|
||||
return collision
|
||||
|
||||
func generate_influence_zone() -> PlantInfluenceZone:
|
||||
var zone = PlantInfluenceZone.new(PLANT_INFLUENCE_RADIUS)
|
||||
|
||||
add_child(zone)
|
||||
|
||||
return zone
|
||||
|
||||
# Méthode déclenchée par la classe planet
|
||||
func _pass_day():
|
||||
await get_tree().create_timer(randf_range(0., RANDOM_MAX_GROW_INTERVAL)).timeout
|
||||
|
||||
if state == State.MATURE and plant_type.cyclic_effect:
|
||||
plant_type.cyclic_effect.effect(self)
|
||||
if state == State.MATURE and len(cyclic_effects):
|
||||
for effect in cyclic_effects:
|
||||
effect.effect(self)
|
||||
|
||||
day += 1
|
||||
|
||||
func set_day(d):
|
||||
day = d
|
||||
if day == 0:
|
||||
change_state(State.PLANTED)
|
||||
if day > plant_type.growing_time:
|
||||
if day + 1 > calculate_grow_time():
|
||||
if state != State.MATURE:
|
||||
change_state(State.MATURE)
|
||||
elif day == 0:
|
||||
change_state(State.PLANTED)
|
||||
else:
|
||||
if state != State.GROWING:
|
||||
change_state(State.GROWING)
|
||||
|
||||
func calculate_plant_score() -> int:
|
||||
var mutated_plant_score = plant_type.default_plant_score if state == State.MATURE else 0
|
||||
|
||||
for m in plant_mutations:
|
||||
mutated_plant_score = m.mutate_score(self, mutated_plant_score)
|
||||
|
||||
return mutated_plant_score
|
||||
|
||||
func calculate_grow_time() -> int:
|
||||
var mutated_grow_time = plant_type.default_growing_time
|
||||
|
||||
for m in plant_mutations:
|
||||
mutated_grow_time = m.mutate_grow_time(self, mutated_grow_time)
|
||||
|
||||
return mutated_grow_time
|
||||
|
||||
func change_state(_state: State):
|
||||
state = _state
|
||||
|
||||
if state == State.MATURE and plant_type.mature_effect:
|
||||
plant_type.mature_effect.effect(self)
|
||||
if state == State.MATURE and len(mature_effects):
|
||||
for effect in mature_effects:
|
||||
if effect : effect.effect(self)
|
||||
for effect in cyclic_effects:
|
||||
if effect : effect.effect(self)
|
||||
|
||||
plant_sprite.update_plant_sprite(self, true)
|
||||
|
||||
func harvest():
|
||||
if state == State.MATURE:
|
||||
var seed_number = plant_type.harvest_number.pick_random()
|
||||
for i in range(seed_number):
|
||||
var seed_plant_type : PlantType = plant_type
|
||||
if len(plant_type.harvest_types_path):
|
||||
seed_plant_type = load(plant_type.harvest_types_path.pick_random())
|
||||
planet.drop_item(
|
||||
Seed.new(seed_plant_type),
|
||||
global_position,
|
||||
HARVESTED_SEED_DISPLACEMENT_FACTOR,
|
||||
)
|
||||
|
||||
for effect in harvest_effects:
|
||||
if effect : effect.effect(self)
|
||||
|
||||
plant_sprite.start_harvest_animation()
|
||||
await plant_sprite.harvest_animation_finished
|
||||
queue_free()
|
||||
|
||||
@ -2,6 +2,87 @@
|
||||
extends Resource
|
||||
class_name PlantEffect
|
||||
|
||||
func effect(plant):
|
||||
printerr("Classe abstraite PlantEffect appelée")
|
||||
const HARVEST_EFFECT_ICON = preload("res://common/icons/shovel.svg")
|
||||
const MATURE_EFFECT_ICON = preload("res://common/icons/chevrons-up.svg")
|
||||
const CYCLIC_EFFECT_ICON = preload("res://common/icons/rotate-rectangle.svg")
|
||||
|
||||
@export var level : int
|
||||
|
||||
func _init(_level : int = 1):
|
||||
level = _level
|
||||
|
||||
func get_effect_name() -> String:
|
||||
printerr("Classe abstraite PlantEffect appelée")
|
||||
return ""
|
||||
|
||||
func get_effect_description() -> String:
|
||||
printerr("Classe abstraite PlantEffect appelée")
|
||||
return ""
|
||||
|
||||
func effect(plant):
|
||||
printerr("Classe abstraite PlantEffect appelée")
|
||||
|
||||
static func get_framed_info_from_effects(
|
||||
effects : Array[PlantEffect],
|
||||
trigger_text = "",
|
||||
trigger_icon: Texture = null
|
||||
) -> Array[Inspector.FramedInfo]:
|
||||
if len(effects) == 0 : return []
|
||||
|
||||
var desc = "%s %s" % [PlantEffect.get_framed_info_effect_name(effects[0]), effects[0].get_effect_description()]
|
||||
|
||||
for i in range(1, len(effects)):
|
||||
if effects[i]:
|
||||
desc += "\n%s %s" % [PlantEffect.get_framed_info_effect_name(effects[i]), effects[i].get_effect_description()]
|
||||
|
||||
return [Inspector.FramedInfo.new(
|
||||
trigger_text,
|
||||
desc,
|
||||
trigger_icon
|
||||
)]
|
||||
|
||||
static func get_framed_info_effect_name(e : PlantEffect):
|
||||
var levels_bbcode = [
|
||||
"[color=#ffffff][b]%s[/b][/color]",
|
||||
"[color=#FFBE0B][b]%s %d[/b][/color]",
|
||||
"[color=#FB5607][b]%s %d[/b][/color]",
|
||||
"[color=#3A86FF][b]%s %d[/b][/color]",
|
||||
"[color=#8338EC][b]%s %d[/b][/color]",
|
||||
"[color=#FF006E][b]%s %d[/b][/color]",
|
||||
"[rainbow][b]%s %d[/b][/rainbow]"
|
||||
]
|
||||
|
||||
if e.level == 1:
|
||||
return levels_bbcode[0] % e.get_effect_name()
|
||||
else :
|
||||
return levels_bbcode[min(e.level - 1, len(levels_bbcode) - 1)] % [e.get_effect_name(), e.level]
|
||||
|
||||
static func get_framed_info_from_all_trigger_effects(
|
||||
mature_effects : Array[PlantEffect],
|
||||
harvest_effects : Array[PlantEffect],
|
||||
cyclic_effects : Array[PlantEffect],
|
||||
) -> Array[Inspector.FramedInfo] :
|
||||
var framed_infos : Array[Inspector.FramedInfo] = []
|
||||
framed_infos.append_array(
|
||||
PlantEffect.get_framed_info_from_effects(
|
||||
mature_effects,
|
||||
"On maturation",
|
||||
MATURE_EFFECT_ICON
|
||||
)
|
||||
)
|
||||
framed_infos.append_array(
|
||||
PlantEffect.get_framed_info_from_effects(
|
||||
harvest_effects,
|
||||
"When harvested",
|
||||
HARVEST_EFFECT_ICON
|
||||
)
|
||||
)
|
||||
framed_infos.append_array(
|
||||
PlantEffect.get_framed_info_from_effects(
|
||||
cyclic_effects,
|
||||
"Each days",
|
||||
CYCLIC_EFFECT_ICON
|
||||
)
|
||||
)
|
||||
|
||||
return framed_infos
|
||||
|
||||
@ -1,17 +1,18 @@
|
||||
extends PlantEffect
|
||||
class_name DecontaminateTerrainEffect
|
||||
|
||||
@export var impact_radius = 100
|
||||
@export var improve_by_lifetime := false
|
||||
@export var improve_by_lifetime_value := 20
|
||||
@export var improve_by_lifetime_max := 200
|
||||
func get_decontamination_radius():
|
||||
return 100 * level
|
||||
|
||||
func get_effect_name() -> String:
|
||||
return "Decontaminate"
|
||||
|
||||
func get_effect_description() -> String:
|
||||
var ret = "Decontaminate %d unit around it" % [get_decontamination_radius()]
|
||||
return ret
|
||||
|
||||
func effect(plant):
|
||||
|
||||
var radius = impact_radius
|
||||
|
||||
if improve_by_lifetime:
|
||||
radius = min(radius + improve_by_lifetime_value * plant.day, improve_by_lifetime_max)
|
||||
var radius = get_decontamination_radius()
|
||||
|
||||
plant.planet.impact_contamination(
|
||||
plant.global_position,
|
||||
|
||||
@ -1,15 +1,29 @@
|
||||
extends PlantEffect
|
||||
class_name ProduceSeedsEffect
|
||||
|
||||
@export_file var produce_types_path : Array[String] = []
|
||||
@export var produce_number : Array[int] = [1]
|
||||
func get_produce_number():
|
||||
return [level - 1, level, level + 1]
|
||||
|
||||
func get_effect_name() -> String:
|
||||
return "Seed Production"
|
||||
|
||||
func get_effect_description() -> String:
|
||||
var number_str = ""
|
||||
|
||||
for i in range(len(get_produce_number())):
|
||||
if i != 0:
|
||||
if i == len(get_produce_number()) - 1:
|
||||
number_str += " or "
|
||||
else :
|
||||
number_str += ", "
|
||||
number_str += str(get_produce_number()[i])
|
||||
|
||||
return "Produce %s seeds" % [number_str]
|
||||
|
||||
func effect(plant):
|
||||
for _i in range(produce_number.pick_random()):
|
||||
if len(produce_types_path):
|
||||
var seed_plant_type = load(produce_types_path.pick_random())
|
||||
plant.planet.drop_item(
|
||||
Seed.new(seed_plant_type),
|
||||
plant.global_position,
|
||||
plant.HARVESTED_SEED_DISPLACEMENT_FACTOR,
|
||||
)
|
||||
for _i in range(get_produce_number().pick_random()):
|
||||
plant.planet.drop_item(
|
||||
Seed.new(plant.plant_type, plant.plant_mutations),
|
||||
plant.global_position,
|
||||
plant.HARVESTED_SEED_DISPLACEMENT_FACTOR,
|
||||
)
|
||||
|
||||
31
entities/plants/scripts/plant_influence_zone.gd
Normal file
@ -0,0 +1,31 @@
|
||||
extends Area2D
|
||||
class_name PlantInfluenceZone
|
||||
|
||||
var radius : int
|
||||
var sprite : Circle
|
||||
var collision_shape : CollisionShape2D
|
||||
var show_influence : bool = false :
|
||||
set(v):
|
||||
show_influence = v
|
||||
if sprite:
|
||||
sprite.visible = v
|
||||
print(sprite.visible)
|
||||
|
||||
func _init(_radius = 100):
|
||||
radius = _radius
|
||||
|
||||
func _ready():
|
||||
sprite = Circle.new()
|
||||
# sprite.z_index = 100
|
||||
sprite.radius = 100
|
||||
sprite.fill = false
|
||||
sprite.width = 1
|
||||
sprite.opacity = 0.2
|
||||
sprite.visible = show_influence
|
||||
add_child(sprite)
|
||||
|
||||
collision_shape = CollisionShape2D.new()
|
||||
var circle_shape : CircleShape2D = CircleShape2D.new()
|
||||
circle_shape.radius = radius
|
||||
collision_shape.shape = circle_shape
|
||||
add_child(collision_shape)
|
||||
1
entities/plants/scripts/plant_influence_zone.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://cmm3ar0ikkvkb
|
||||
111
entities/plants/scripts/plant_mutation.gd
Normal file
@ -0,0 +1,111 @@
|
||||
extends Resource
|
||||
class_name PlantMutation
|
||||
|
||||
const BASE_RARITY_CHANCE : Array[float] = [
|
||||
0.6,
|
||||
0.8,
|
||||
0.9,
|
||||
0.95,
|
||||
1
|
||||
]
|
||||
|
||||
@export var level : int = 1
|
||||
|
||||
func _init(_level : int = 1):
|
||||
level = _level
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/dna.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
printerr("Classe abstraite PlantMutation appelée")
|
||||
return ""
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
printerr("Classe abstraite PlantMutation appelée")
|
||||
return ""
|
||||
|
||||
func mutate_score(_plant : Plant, score) -> int:
|
||||
return score
|
||||
|
||||
func mutate_grow_time(_plant : Plant, grow_time : int) -> int:
|
||||
return grow_time
|
||||
|
||||
func mutate_plant(_plant : Plant):
|
||||
pass
|
||||
|
||||
func get_level_for_rarity(rarity : int) -> int :
|
||||
return rarity - get_base_rarity() + 1
|
||||
|
||||
static func get_rarity(mutation : PlantMutation) -> int:
|
||||
return mutation.get_base_rarity() + mutation.level - 1
|
||||
|
||||
static func get_rarity_text(mutation : PlantMutation) -> String:
|
||||
var rarity_text : Array[String] = [
|
||||
"Common",
|
||||
"Rare",
|
||||
"Very rare",
|
||||
"Impossible",
|
||||
"Absurd",
|
||||
]
|
||||
|
||||
var rarity = PlantMutation.get_rarity(mutation)
|
||||
|
||||
if rarity < len(rarity_text):
|
||||
return rarity_text[rarity]
|
||||
else :
|
||||
return rarity_text[len(rarity_text) - 1] + " " + str(rarity - len(rarity_text) + 2)
|
||||
|
||||
static func get_rarity_bg_color(mutation : PlantMutation) -> Color:
|
||||
var rarity_colors : Array[Color] = [
|
||||
Color("4b3700"),
|
||||
Color("6d2300"),
|
||||
Color("001f50"),
|
||||
Color("311558"),
|
||||
Color("780235"),
|
||||
]
|
||||
|
||||
return rarity_colors[min(PlantMutation.get_rarity(mutation), len(rarity_colors) - 1)]
|
||||
|
||||
static func get_rarity_color(mutation : PlantMutation) -> Color:
|
||||
var rarity_colors : Array[Color] = [
|
||||
Color("FFBE0B"),
|
||||
Color("FB5607"),
|
||||
Color("3A86FF"),
|
||||
Color("8338EC"),
|
||||
Color("FF006E"),
|
||||
]
|
||||
|
||||
return rarity_colors[min(PlantMutation.get_rarity(mutation), len(rarity_colors) - 1)]
|
||||
|
||||
static func get_framed_info_from_mutation(
|
||||
mutation : PlantMutation
|
||||
) -> Inspector.FramedInfo:
|
||||
return Inspector.FramedInfo.new(
|
||||
mutation.get_mutation_name() + (" %d" % mutation.level if mutation.level > 1 else ""),
|
||||
"[b]%s[/b] %s" % [PlantMutation.get_rarity_text(mutation), mutation.get_mutation_description()],
|
||||
mutation.get_icon(),
|
||||
PlantMutation.get_rarity_bg_color(mutation)
|
||||
)
|
||||
|
||||
static func random_rarity() -> int:
|
||||
var random_float = randf()
|
||||
|
||||
for i in range(len(BASE_RARITY_CHANCE) - 1):
|
||||
if random_float < BASE_RARITY_CHANCE[i]:
|
||||
return i
|
||||
return len(BASE_RARITY_CHANCE) - 1
|
||||
|
||||
static func random_mutation(rarity = PlantMutation.random_rarity()) -> PlantMutation:
|
||||
var all_mutations = GameInfo.game_data.unlocked_plant_mutations.duplicate_deep()
|
||||
all_mutations.shuffle()
|
||||
for new_mutation in all_mutations:
|
||||
var level_for_rarity = new_mutation.get_level_for_rarity(rarity)
|
||||
if level_for_rarity >= 1:
|
||||
new_mutation.level = level_for_rarity
|
||||
return new_mutation
|
||||
return null
|
||||
|
||||
1
entities/plants/scripts/plant_mutation.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://c1lsjc2cwjupa
|
||||
23
entities/plants/scripts/plant_mutation/ancient_mutation.gd
Normal file
@ -0,0 +1,23 @@
|
||||
extends PlantMutation
|
||||
class_name AncientMutation
|
||||
|
||||
const DEFAULT_DAY_FACTOR = 5
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/wood.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Ancient"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Add [b]1[/b] to the score for each [b]%d[/b] days passed" % get_day_factor()
|
||||
|
||||
func get_day_factor():
|
||||
return max(1, DEFAULT_DAY_FACTOR - level + 1)
|
||||
|
||||
func mutate_score(plant : Plant, score) -> int:
|
||||
|
||||
return score + floori(plant.day / get_day_factor())
|
||||
@ -0,0 +1 @@
|
||||
uid://c7po0bstyg80u
|
||||
26
entities/plants/scripts/plant_mutation/elitist_mutation.gd
Normal file
@ -0,0 +1,26 @@
|
||||
extends PlantMutation
|
||||
class_name ElitistMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/copy.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Intolerant"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Add [b]%d[/b] to the score for each plant of the same species around, but score become 0 if none is around." % level
|
||||
|
||||
func mutate_score(plant : Plant, score) -> int:
|
||||
var plant_count = 0
|
||||
|
||||
for area in plant.influence_zone.get_overlapping_areas():
|
||||
if area is Plant and area.plant_type.name == plant.plant_type.name:
|
||||
plant_count += 1
|
||||
|
||||
if plant_count == 0:
|
||||
return 0
|
||||
else :
|
||||
return score + level * plant_count
|
||||
@ -0,0 +1 @@
|
||||
uid://bt1xh7ss13e5e
|
||||
21
entities/plants/scripts/plant_mutation/ermit_mutation.gd
Normal file
@ -0,0 +1,21 @@
|
||||
extends PlantMutation
|
||||
class_name ErmitMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/seedling-off.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Ermit"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Multiply the score by %d if no plant is near, but set it to 0 otherwise." % level
|
||||
|
||||
func mutate_score(plant : Plant, score) -> int:
|
||||
for area in plant.influence_zone.get_overlapping_areas():
|
||||
if area is Plant:
|
||||
return 0
|
||||
|
||||
return score * 2
|
||||
@ -0,0 +1 @@
|
||||
uid://domy822vgxfxs
|
||||
@ -0,0 +1,17 @@
|
||||
extends PlantMutation
|
||||
class_name PrecociousMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/hourglass-empty.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Precocious"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Add [b]%d[/b] to the score while the plant is growing" % level
|
||||
|
||||
func mutate_score(plant : Plant, score) -> int:
|
||||
return score + (0 if plant.state == Plant.State.MATURE else level)
|
||||
@ -0,0 +1 @@
|
||||
uid://cx5mg5vf62bia
|
||||
17
entities/plants/scripts/plant_mutation/quality_mutation.gd
Normal file
@ -0,0 +1,17 @@
|
||||
extends PlantMutation
|
||||
class_name QualityMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/north-star.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Quality"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Add [b]%d[/b] to the score if the plant is mature." % level
|
||||
|
||||
func mutate_score(plant : Plant, score : int) -> int:
|
||||
return score + (level if plant.state == Plant.State.MATURE else 0)
|
||||
@ -0,0 +1 @@
|
||||
uid://bdobyk2j625lb
|
||||
17
entities/plants/scripts/plant_mutation/quick_mutation.gd
Normal file
@ -0,0 +1,17 @@
|
||||
extends PlantMutation
|
||||
class_name QuickMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/chevrons-up.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Quick"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Reduce the grow time by %d" % level
|
||||
|
||||
func mutate_grow_time(_plant : Plant, grow_time : int) -> int:
|
||||
return max(grow_time - level, 0)
|
||||
@ -0,0 +1 @@
|
||||
uid://bhtq0cbrgu58v
|
||||
28
entities/plants/scripts/plant_mutation/sociable_mutation.gd
Normal file
@ -0,0 +1,28 @@
|
||||
extends PlantMutation
|
||||
class_name SociableMutation
|
||||
|
||||
const NEAR_PLANT_NEEDED = 2
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/seedling.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Sociable"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Add [b]%d[/b] to the score if near %d other plants" % [get_score_bonus(), NEAR_PLANT_NEEDED]
|
||||
|
||||
func get_score_bonus():
|
||||
return (level + 2)
|
||||
|
||||
func mutate_score(plant : Plant, score) -> int:
|
||||
var plant_count = 0
|
||||
|
||||
for area in plant.influence_zone.get_overlapping_areas():
|
||||
if area is Plant:
|
||||
plant_count += 1
|
||||
|
||||
return score + (get_score_bonus() if plant_count >= NEAR_PLANT_NEEDED else 0)
|
||||
@ -0,0 +1 @@
|
||||
uid://b8q5xgvy85qeb
|
||||
20
entities/plants/scripts/plant_mutation/strong_mutation.gd
Normal file
@ -0,0 +1,20 @@
|
||||
extends PlantMutation
|
||||
class_name StrongMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/dna.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Strong"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Plus [b]%d[/b] percent of the score" % roundi(get_score_multiplier() * 100)
|
||||
|
||||
func get_score_multiplier():
|
||||
return float(level)/2.
|
||||
|
||||
func mutate_score(_plant : Plant, score: int) -> int:
|
||||
return score + roundi(score * get_score_multiplier())
|
||||
@ -0,0 +1 @@
|
||||
uid://cwj3k4p6ci5t4
|
||||
@ -2,7 +2,9 @@ extends Node2D
|
||||
class_name PlantSprite
|
||||
|
||||
const PLANTED_SEED_CROP_WIDTH = 50
|
||||
const PLANTED_SEED_POS_Y = -50
|
||||
const PLANTED_SEED_POS_Y = 0
|
||||
|
||||
const PARTICLES_SCENE : PackedScene = preload("res://common/vfx/particles/particles.tscn")
|
||||
|
||||
signal harvest_animation_finished
|
||||
|
||||
@ -35,6 +37,16 @@ func get_state_texture(s: Plant.State, plant_type : PlantType) -> Texture2D:
|
||||
return plant_type.mature_texture
|
||||
return null
|
||||
|
||||
func generate_mutation_effects(plant : Plant):
|
||||
for m in plant.plant_mutations:
|
||||
var particles_emitter : Particles = PARTICLES_SCENE.instantiate() as CPUParticles2D
|
||||
particles_emitter.setup_particles(
|
||||
Particles.Parameters.new(
|
||||
m.get_icon(),
|
||||
PlantMutation.get_rarity_color(m)
|
||||
)
|
||||
)
|
||||
add_child(particles_emitter)
|
||||
|
||||
func start_harvest_animation():
|
||||
$AnimationPlayer.play("harvest")
|
||||
|
||||
@ -4,14 +4,13 @@ class_name PlantType
|
||||
@export var name : String
|
||||
@export_multiline var description : String
|
||||
|
||||
@export var growing_time : int
|
||||
@export var default_growing_time : int = 2
|
||||
@export var default_plant_score : int = 1
|
||||
|
||||
@export var seed_texture : Texture
|
||||
@export var growing_texture : Texture
|
||||
@export var mature_texture : Texture
|
||||
|
||||
@export var mature_effect : PlantEffect
|
||||
@export var cyclic_effect : PlantEffect
|
||||
|
||||
@export_file var harvest_types_path : Array[String] = []
|
||||
@export var harvest_number : Array[int] = [1,2]
|
||||
@export var default_harvest_effects : Array[PlantEffect] = []
|
||||
@export var default_mature_effects : Array[PlantEffect] = []
|
||||
@export var default_cyclic_effects : Array[PlantEffect] = []
|
||||
|
||||
@ -27,8 +27,8 @@ var energy : int = max_energy :
|
||||
player_updated.emit(self)
|
||||
|
||||
@onready var inventory : Inventory = Inventory.new(DEFAULT_INVENTORY_SIZE)
|
||||
@onready var preview_zone : Area2D = null
|
||||
@onready var action_zone : Area2D = null
|
||||
@onready var preview_zone : ActionZone = null
|
||||
@onready var action_zone : ActionZone = null
|
||||
|
||||
func _ready():
|
||||
player_updated.emit(self)
|
||||
@ -126,9 +126,9 @@ func try_move(move_to : Vector2):
|
||||
func pick_item(item : Item) -> Item:
|
||||
play_sfx("pick")
|
||||
if inventory.length() >= inventory.size:
|
||||
var currentItem : Item = inventory.get_item()
|
||||
var current_item : Item = inventory.get_item()
|
||||
inventory.set_item(item, inventory.current_item_ind)
|
||||
return currentItem
|
||||
return current_item
|
||||
else :
|
||||
inventory.add_item(item)
|
||||
return null
|
||||
@ -153,7 +153,7 @@ func try_use_item(item : Item, use_position : Vector2):
|
||||
func preview_can_use_item(item : Item) -> bool:
|
||||
return can_use_item_on_zone(item, preview_zone)
|
||||
|
||||
func can_use_item_on_zone(item : Item, zone: Area2D) -> bool:
|
||||
func can_use_item_on_zone(item : Item, zone: ActionZone) -> bool:
|
||||
return (
|
||||
inventory.has_item(item)
|
||||
and (energy - item.energy_usage) >= 0
|
||||
@ -185,43 +185,29 @@ func recharge(amount : int = max_energy):
|
||||
func full_recharge():
|
||||
energy = max(energy, max_energy)
|
||||
|
||||
func generate_action_zone(radius : int = 0) -> Area2D:
|
||||
var area2D = Area2D.new()
|
||||
var collision_shape = CollisionShape2D.new()
|
||||
var circle_shape = CircleShape2D.new()
|
||||
func generate_action_zone(radius : int = 0) -> ActionZone:
|
||||
var zone = ActionZone.new(radius)
|
||||
|
||||
circle_shape.radius = radius
|
||||
collision_shape.shape = circle_shape
|
||||
area2D.add_child(collision_shape)
|
||||
get_parent().add_child(zone.area)
|
||||
|
||||
get_parent().add_child(area2D)
|
||||
return zone
|
||||
|
||||
return area2D
|
||||
|
||||
func setup_preview_zone(zone_radius : int) -> Area2D:
|
||||
func setup_preview_zone(zone_radius : int) -> ActionZone:
|
||||
if preview_zone:
|
||||
preview_zone.queue_free()
|
||||
preview_zone.destroy()
|
||||
preview_zone = generate_action_zone(zone_radius)
|
||||
return preview_zone
|
||||
|
||||
func setup_action_zone(zone_position : Vector2, zone_radius : int) -> Area2D:
|
||||
func setup_action_zone(zone_position : Vector2, zone_radius : int) -> ActionZone:
|
||||
if action_zone:
|
||||
action_zone.queue_free()
|
||||
action_zone.destroy()
|
||||
action_zone = generate_action_zone(zone_radius)
|
||||
action_zone.global_position = zone_position
|
||||
action_zone.area.global_position = zone_position
|
||||
return action_zone
|
||||
|
||||
func move_preview_zone(zone_position : Vector2):
|
||||
if preview_zone:
|
||||
preview_zone.global_position = zone_position
|
||||
|
||||
func detect_area_in_preview_zone() -> Array:
|
||||
return preview_zone.get_overlapping_areas()
|
||||
|
||||
func detect_area_in_action_zone() -> Array:
|
||||
if action_zone:
|
||||
return action_zone.get_overlapping_areas()
|
||||
return []
|
||||
preview_zone.move_to_position(zone_position)
|
||||
|
||||
func play_sfx(sound : String):
|
||||
match sound:
|
||||
@ -277,3 +263,37 @@ class InteractableInstruction extends Instruction:
|
||||
|
||||
func do(player : Player):
|
||||
interactable.interact(player)
|
||||
|
||||
class ActionZone:
|
||||
var radius : int = 10
|
||||
var area : Area2D
|
||||
|
||||
func _init(_r : int):
|
||||
radius = _r
|
||||
area = Area2D.new()
|
||||
var collision_shape = CollisionShape2D.new()
|
||||
var circle_shape = CircleShape2D.new()
|
||||
|
||||
circle_shape.radius = radius
|
||||
collision_shape.shape = circle_shape
|
||||
area.add_child(collision_shape)
|
||||
|
||||
func destroy():
|
||||
area.queue_free()
|
||||
|
||||
func get_global_position() -> Vector2:
|
||||
return Vector2.ZERO if area == null else area.global_position
|
||||
|
||||
func move_to_position(pos : Vector2):
|
||||
if area:
|
||||
area.global_position = pos
|
||||
|
||||
func get_points_in_zone(point_factor = 10) -> Array[Vector2]:
|
||||
var points : Array[Vector2] = []
|
||||
for x in range(-radius, radius, point_factor):
|
||||
for y in range(-radius, radius, point_factor):
|
||||
if Vector2(x, y).length() <= radius:
|
||||
points.append(area.global_position + Vector2(x, y))
|
||||
|
||||
return points
|
||||
|
||||
|
||||
@ -41,3 +41,5 @@ progressive_web_app/icon_144x144=""
|
||||
progressive_web_app/icon_180x180=""
|
||||
progressive_web_app/icon_512x512=""
|
||||
progressive_web_app/background_color=Color(0, 0, 0, 1)
|
||||
threads/emscripten_pool_size=8
|
||||
threads/godot_pool_size=4
|
||||
|
||||
@ -114,6 +114,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
script = ExtResource("1_4evne")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
@ -128,6 +129,7 @@ offset_top = -73.5
|
||||
offset_bottom = 73.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("1_0ssee")
|
||||
alignment = 1
|
||||
|
||||
@ -142,6 +144,7 @@ horizontal_alignment = 1
|
||||
unique_name_in_owner = true
|
||||
modulate = Color(0.886275, 0.623529, 0.196078, 1)
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
texture = SubResource("GradientTexture2D_mnweq")
|
||||
expand_mode = 1
|
||||
stretch_mode = 1
|
||||
|
||||
BIN
gui/game/assets/texture/tablette_resized.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
40
gui/game/assets/texture/tablette_resized.png.import
Normal file
@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://lpik6kwqgmjx"
|
||||
path="res://.godot/imported/tablette_resized.png-1e695efa0d8b0701c7cf825b333995f0.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/game/assets/texture/tablette_resized.png"
|
||||
dest_files=["res://.godot/imported/tablette_resized.png-1e695efa0d8b0701c7cf825b333995f0.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=29 format=3 uid="uid://12nak7amd1uq"]
|
||||
[gd_scene load_steps=30 format=3 uid="uid://12nak7amd1uq"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cqao7n800qy40" path="res://gui/game/scripts/game_gui.gd" id="1_udau0"]
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="2_nq5i2"]
|
||||
@ -7,6 +7,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="4_k4juk"]
|
||||
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="4_ujg5r"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3lff5fui1k0c" path="res://gui/game/inspector/inspector.tscn" id="6_dr1y2"]
|
||||
[ext_resource type="Texture2D" uid="uid://bt3g5bmar0icf" path="res://common/icons/growth.svg" id="7_id0t5"]
|
||||
[ext_resource type="Texture2D" uid="uid://b5cuxgisrsfgt" path="res://common/icons/player-pause.svg" id="9_2wykm"]
|
||||
[ext_resource type="PackedScene" uid="uid://clicjf8ts51h8" path="res://gui/game/inventory_gui/inventory_gui.tscn" id="9_id0t5"]
|
||||
|
||||
@ -340,7 +341,11 @@ layout_mode = 2
|
||||
fill_mode = 4
|
||||
texture_progress = SubResource("GradientTexture2D_h6540")
|
||||
|
||||
[node name="QuotaProgressText" type="Label" parent="MarginContainer/PlayerInfo/QuotaInfo"]
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/PlayerInfo/QuotaInfo"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 2
|
||||
|
||||
[node name="QuotaProgressText" type="Label" parent="MarginContainer/PlayerInfo/QuotaInfo/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "X"
|
||||
@ -348,10 +353,12 @@ label_settings = ExtResource("4_ujg5r")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Inspector" parent="MarginContainer" instance=ExtResource("6_dr1y2")]
|
||||
unique_name_in_owner = true
|
||||
[node name="TextureRect" type="TextureRect" parent="MarginContainer/PlayerInfo/QuotaInfo/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(30, 30)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
texture = ExtResource("7_id0t5")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="TopRightContent" type="HBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
@ -382,6 +389,13 @@ layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 8
|
||||
|
||||
[node name="Inspector" parent="MarginContainer" instance=ExtResource("6_dr1y2")]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(250, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 8
|
||||
|
||||
[node name="PassDayFade" type="ColorRect" parent="."]
|
||||
physics_interpolation_mode = 0
|
||||
layout_mode = 1
|
||||
|
||||
57
gui/game/inspector/framed_info/framed_info.tscn
Normal file
@ -0,0 +1,57 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://dinju2m0oja38"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_1ddv5"]
|
||||
[ext_resource type="Script" uid="uid://ymn5layeoat8" path="res://gui/game/inspector/framed_info/scripts/framed_info.gd" id="1_7tmbd"]
|
||||
[ext_resource type="Texture2D" uid="uid://bsvxhafoxwmw0" path="res://common/icons/cube-3d-sphere.svg" id="2_7tmbd"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="3_1ddv5"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7tmbd"]
|
||||
bg_color = Color(1, 1, 1, 0.78431374)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_1ddv5"]
|
||||
font = ExtResource("3_1ddv5")
|
||||
font_size = 18
|
||||
|
||||
[node name="FramedInfo" type="PanelContainer"]
|
||||
self_modulate = Color(0.043137256, 0.07450981, 0.14901961, 1)
|
||||
offset_right = 275.0
|
||||
offset_bottom = 94.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 0
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_7tmbd")
|
||||
script = ExtResource("1_7tmbd")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_1ddv5")
|
||||
|
||||
[node name="HFlowContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/HFlowContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="MarginContainer/HFlowContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(20, 20)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_7tmbd")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Title" type="Label" parent="MarginContainer/HFlowContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "On mature"
|
||||
label_settings = SubResource("LabelSettings_1ddv5")
|
||||
|
||||
[node name="Desc" type="RichTextLabel" parent="MarginContainer/HFlowContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme = ExtResource("1_1ddv5")
|
||||
bbcode_enabled = true
|
||||
text = "On mature, do this and that and do this and that and do this and that"
|
||||
fit_content = true
|
||||
10
gui/game/inspector/framed_info/scripts/framed_info.gd
Normal file
@ -0,0 +1,10 @@
|
||||
extends PanelContainer
|
||||
|
||||
var framed_info :Inspector.FramedInfo = null : set = update_framed_info
|
||||
|
||||
func update_framed_info(f: Inspector.FramedInfo):
|
||||
framed_info = f
|
||||
%Icon.texture = f.icon
|
||||
%Title.text = f.title
|
||||
%Desc.text = f.description
|
||||
self_modulate = f.bg_color
|
||||
@ -0,0 +1 @@
|
||||
uid://ymn5layeoat8
|
||||
@ -1,11 +1,19 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://d3lff5fui1k0c"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://d3lff5fui1k0c"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_f5bv4"]
|
||||
[ext_resource type="Texture2D" uid="uid://c2pgaklnj5w3d" path="res://gui/game/assets/texture/Tablette info.png" id="2_a8c2j"]
|
||||
[ext_resource type="Texture2D" uid="uid://lpik6kwqgmjx" path="res://gui/game/assets/texture/tablette_resized.png" id="1_qfinp"]
|
||||
[ext_resource type="Script" uid="uid://b36bjfq4sng36" path="res://gui/game/inspector/scripts/inspector.gd" id="3_a8c2j"]
|
||||
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="3_qfinp"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="4_yijvw"]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_yijvw"]
|
||||
texture = ExtResource("1_qfinp")
|
||||
texture_margin_left = 30.0
|
||||
texture_margin_top = 10.0
|
||||
texture_margin_right = 30.0
|
||||
texture_margin_bottom = 50.0
|
||||
region_rect = Rect2(18, 31, 240, 334)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ek73b"]
|
||||
atlas = ExtResource("3_qfinp")
|
||||
region = Rect2(76, 75, 124, 135)
|
||||
@ -14,44 +22,32 @@ region = Rect2(76, 75, 124, 135)
|
||||
font = ExtResource("4_yijvw")
|
||||
font_size = 20
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_n4kem"]
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_c4yiu"]
|
||||
font_size = 12
|
||||
|
||||
[node name="Inspector" type="TextureRect"]
|
||||
custom_minimum_size = Vector2(0, 300)
|
||||
[node name="Inspector" type="PanelContainer"]
|
||||
offset_right = 276.0
|
||||
offset_bottom = 235.0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 8
|
||||
theme = ExtResource("1_f5bv4")
|
||||
texture = ExtResource("2_a8c2j")
|
||||
expand_mode = 3
|
||||
stretch_mode = 4
|
||||
size_flags_vertical = 0
|
||||
theme_override_styles/panel = SubResource("StyleBoxTexture_yijvw")
|
||||
script = ExtResource("3_a8c2j")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 40
|
||||
theme_override_constants/margin_top = 40
|
||||
theme_override_constants/margin_right = 25
|
||||
theme_override_constants/margin_bottom = 75
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
theme = ExtResource("1_f5bv4")
|
||||
|
||||
[node name="Texture" type="TextureRect" parent="MarginContainer/VBoxContainer"]
|
||||
[node name="Texture" type="TextureRect" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 50)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
texture = SubResource("AtlasTexture_ek73b")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Title" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
[node name="Title" type="Label" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "fdqsd dqsdq dsqdqsd"
|
||||
@ -59,11 +55,20 @@ label_settings = SubResource("LabelSettings_ek73b")
|
||||
horizontal_alignment = 1
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="Desc" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
[node name="StatInfos" type="HFlowContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
text = "Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. "
|
||||
label_settings = SubResource("LabelSettings_n4kem")
|
||||
theme_override_constants/h_separation = 8
|
||||
theme_override_constants/v_separation = 8
|
||||
alignment = 1
|
||||
|
||||
[node name="Desc" type="Label" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Very interesting description that can be very long, like 2 or 3 lines long."
|
||||
label_settings = SubResource("LabelSettings_c4yiu")
|
||||
autowrap_mode = 3
|
||||
clip_text = true
|
||||
|
||||
[node name="FramedInfos" type="VBoxContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
extends Control
|
||||
class_name Inspector
|
||||
|
||||
const FRAMED_INFO_SCENE : PackedScene = preload("res://gui/game/inspector/framed_info/framed_info.tscn")
|
||||
const STAT_INFO_SCENE : PackedScene = preload("res://gui/game/inspector/stat_info/stat_info.tscn")
|
||||
|
||||
var info : Info = null :
|
||||
set(i):
|
||||
info = i
|
||||
@ -19,11 +22,33 @@ func update_info(i : Info):
|
||||
%Texture.visible = i.texture != null
|
||||
%Title.text = i.title
|
||||
%Desc.text = i.description
|
||||
%Desc.visible = i.description != ""
|
||||
update_framed_infos(info.framed_infos)
|
||||
update_stat_info(info.stat_infos)
|
||||
|
||||
func update_framed_infos(framed_infos : Array[FramedInfo]):
|
||||
for c in %FramedInfos.get_children() :
|
||||
c.queue_free()
|
||||
for i in range(len(framed_infos)):
|
||||
var frame_info_object = FRAMED_INFO_SCENE.instantiate()
|
||||
%FramedInfos.add_child(frame_info_object)
|
||||
frame_info_object.framed_info = framed_infos[i]
|
||||
|
||||
func update_stat_info(stat_infos):
|
||||
%StatInfos.visible = len(stat_infos) != 0
|
||||
for c in %StatInfos.get_children() :
|
||||
c.queue_free()
|
||||
for i in range(len(stat_infos)):
|
||||
var stat_inof_object = STAT_INFO_SCENE.instantiate()
|
||||
%StatInfos.add_child(stat_inof_object)
|
||||
stat_inof_object.stat_info = stat_infos[i]
|
||||
|
||||
class Info:
|
||||
var title : String
|
||||
var texture: Texture
|
||||
var description : String
|
||||
var title : String = ""
|
||||
var texture: Texture = null
|
||||
var description : String = ""
|
||||
var framed_infos : Array[Inspector.FramedInfo] = []
|
||||
var stat_infos = []
|
||||
|
||||
func _init(
|
||||
_title : String = "",
|
||||
@ -32,4 +57,39 @@ class Info:
|
||||
):
|
||||
title = _title
|
||||
description = _description
|
||||
texture = _texture
|
||||
texture = _texture
|
||||
|
||||
func add_framed_info(framed_info : Inspector.FramedInfo):
|
||||
framed_infos.push_front(framed_info)
|
||||
|
||||
func add_stat_info(s_info : Inspector.StatInfo):
|
||||
stat_infos.push_front(s_info)
|
||||
|
||||
|
||||
class FramedInfo:
|
||||
var title : String
|
||||
var icon: Texture
|
||||
var description : String
|
||||
var bg_color : Color
|
||||
|
||||
func _init(
|
||||
_title : String = "",
|
||||
_desc : String = "",
|
||||
_icon : Texture = null,
|
||||
_bg_color : Color = Color("0B1326")
|
||||
):
|
||||
title = _title
|
||||
description = _desc
|
||||
icon = _icon
|
||||
bg_color = _bg_color
|
||||
|
||||
class StatInfo:
|
||||
var text : String
|
||||
var icon: Texture
|
||||
|
||||
func _init(
|
||||
_text : String = "",
|
||||
_icon : Texture = null,
|
||||
):
|
||||
text = _text
|
||||
icon = _icon
|
||||
|
||||
9
gui/game/inspector/stat_info/scripts/stat_info.gd
Normal file
@ -0,0 +1,9 @@
|
||||
extends HBoxContainer
|
||||
|
||||
var stat_info : Inspector.StatInfo = null : set = update_stat_info
|
||||
|
||||
func update_stat_info(s_info : Inspector.StatInfo):
|
||||
stat_info = s_info
|
||||
%Icon.texture = stat_info.icon
|
||||
%Text.text = str(stat_info.text)
|
||||
|
||||
1
gui/game/inspector/stat_info/scripts/stat_info.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://yghu53hja4xj
|
||||
28
gui/game/inspector/stat_info/stat_info.tscn
Normal file
@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://djihfgtjuhqwy"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://yghu53hja4xj" path="res://gui/game/inspector/stat_info/scripts/stat_info.gd" id="1_4pua2"]
|
||||
[ext_resource type="Texture2D" uid="uid://bsvxhafoxwmw0" path="res://common/icons/cube-3d-sphere.svg" id="2_pdlch"]
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="3_pdlch"]
|
||||
|
||||
[node name="StatInfo" type="HBoxContainer"]
|
||||
theme_override_constants/separation = 4
|
||||
alignment = 1
|
||||
script = ExtResource("1_4pua2")
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="."]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(20, 20)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_pdlch")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Text" type="RichTextLabel" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme = ExtResource("3_pdlch")
|
||||
bbcode_enabled = true
|
||||
text = "6"
|
||||
fit_content = true
|
||||
scroll_active = false
|
||||
autowrap_mode = 0
|
||||
@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://dadihouw8o3jx"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://dadihouw8o3jx"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c8qfny4dlg7ql" path="res://gui/game/inventory_gui/inventory_item/scripts/inventory_gui_item.gd" id="2_m0ja8"]
|
||||
[ext_resource type="Texture2D" uid="uid://bf6nw4onkhavr" path="res://common/icons/shovel.svg" id="2_xs0u7"]
|
||||
[ext_resource type="Texture2D" uid="uid://baaujfw8piywi" path="res://common/icons/dna.svg" id="3_m0ja8"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_046xr"]
|
||||
length = 0.001
|
||||
@ -33,7 +34,7 @@ tracks/0/keys = {
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("CenterContainer/TextureRect:modulate")
|
||||
tracks/1/path = NodePath("CenterContainer/ItemTexture:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
@ -61,7 +62,7 @@ tracks/0/keys = {
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("CenterContainer/TextureRect:modulate")
|
||||
tracks/1/path = NodePath("CenterContainer/ItemTexture:modulate")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
@ -119,7 +120,7 @@ texture = SubResource("GradientTexture2D_vgckh")
|
||||
expand_mode = 2
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="CenterContainer"]
|
||||
[node name="ItemTexture" type="TextureRect" parent="CenterContainer"]
|
||||
unique_name_in_owner = true
|
||||
modulate = Color(0.27058825, 0.27058825, 0.27058825, 1)
|
||||
custom_minimum_size = Vector2(48, 48)
|
||||
@ -128,5 +129,16 @@ texture = ExtResource("2_xs0u7")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="ParticleTexture" type="TextureRect" parent="CenterContainer/ItemTexture"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_left = 26.0
|
||||
offset_top = 27.0
|
||||
offset_right = 48.0
|
||||
offset_bottom = 49.0
|
||||
texture = ExtResource("3_m0ja8")
|
||||
expand_mode = 1
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="BottomSpace" type="Control" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
@ -26,11 +26,7 @@ func _on_mouse_excited():
|
||||
Pointer.stop_inspect(self)
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
current_item.name,
|
||||
current_item.description,
|
||||
current_item.icon
|
||||
)
|
||||
return current_item.inspector_info()
|
||||
|
||||
func update(item: Item, selected : bool):
|
||||
if selected and not was_selected:
|
||||
@ -41,9 +37,15 @@ func update(item: Item, selected : bool):
|
||||
if item != current_item:
|
||||
%SquishAnimation.play("squish")
|
||||
if item and item.icon:
|
||||
%TextureRect.texture = item.icon
|
||||
%TextureRect.visible = item != null
|
||||
%ItemTexture.texture = item.icon
|
||||
var particles = item.get_particles()
|
||||
if len(particles):
|
||||
%ParticleTexture.texture = particles[0].texture
|
||||
%ParticleTexture.modulate = particles[0].color
|
||||
%ItemTexture.visible = item != null
|
||||
%NoItemTextureRect.visible = item == null
|
||||
%ParticleTexture.visible = item and len(item.get_particles())
|
||||
|
||||
|
||||
current_item = item
|
||||
was_selected = selected
|
||||
|
||||
@ -18,8 +18,8 @@ func _on_planet_updated(planet:Planet):
|
||||
%DayCount.text = str(planet.get_quota_remaining_days()) + " days left"
|
||||
|
||||
if planet.next_quota:
|
||||
var quota_progression_percent : float = (planet.decontamination_surface - planet.last_quota) / (planet.next_quota - planet.last_quota) * 100
|
||||
%QuotaProgressText.text = str(roundi(planet.decontamination_surface)) + "/" + str(roundi(planet.next_quota))
|
||||
var quota_progression_percent : float = (planet.garden_score - planet.last_quota) / (planet.next_quota - planet.last_quota) * 100
|
||||
%QuotaProgressText.text = str(roundi(planet.garden_score)) + "/" + str(roundi(planet.next_quota))
|
||||
get_tree().create_tween().tween_property(
|
||||
%QuotaProgressBar,
|
||||
"value",
|
||||
|
||||
@ -21,6 +21,7 @@ script = ExtResource("2_kij5i")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("1_ga3ae")
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
@ -38,6 +39,7 @@ unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(50, 50)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("2_kc1j1")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
@ -59,7 +59,7 @@ class Step:
|
||||
|
||||
class TakeShovelStep extends Step:
|
||||
func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]:
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
for entity in p.planet.entity_container.get_children():
|
||||
if entity is ItemObject and entity.item is Shovel:
|
||||
var indicator = generate_indicator(cam, "Take the Shovel")
|
||||
indicator.follow_entity(entity)
|
||||
@ -75,7 +75,7 @@ class TakeShovelStep extends Step:
|
||||
class DigLootStep extends Step:
|
||||
func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]:
|
||||
var indicators : Array[InGameIndicator] = []
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
for entity in p.planet.entity_container.get_children():
|
||||
if entity is UndergroundLoot:
|
||||
var indicator = generate_indicator(cam, "Dig Underground Loot")
|
||||
indicator.follow_entity(entity)
|
||||
@ -85,7 +85,7 @@ class DigLootStep extends Step:
|
||||
return indicators
|
||||
|
||||
func is_step_over(p : Player) -> bool:
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
for entity in p.planet.entity_container.get_children():
|
||||
if entity is ItemObject and entity.item is Seed:
|
||||
return true
|
||||
return false
|
||||
@ -93,7 +93,7 @@ class DigLootStep extends Step:
|
||||
class TakeSeedStep extends Step:
|
||||
func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]:
|
||||
var indicators : Array[InGameIndicator] = []
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
for entity in p.planet.entity_container.get_children():
|
||||
if entity is ItemObject and entity.item is Seed:
|
||||
var indicator = generate_indicator(cam, "Take a seed")
|
||||
indicator.follow_entity(entity)
|
||||
@ -111,18 +111,18 @@ class TakeSeedStep extends Step:
|
||||
class PlantSeedStep extends Step:
|
||||
func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]:
|
||||
var indicator = generate_indicator(cam, "Plant the seed in decontamined zone")
|
||||
indicator.follow_game_position(Vector2(60,60) + p.planet.entityContainer.global_position)
|
||||
indicator.follow_game_position(Vector2(0,0) + p.planet.entity_container.global_position)
|
||||
return [indicator]
|
||||
|
||||
func is_step_over(p : Player) -> bool:
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
for entity in p.planet.entity_container.get_children():
|
||||
if entity is Plant:
|
||||
return true
|
||||
return false
|
||||
|
||||
class RechargeStep extends Step:
|
||||
func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]:
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
for entity in p.planet.entity_container.get_children():
|
||||
var indicator = generate_indicator(cam, "Recharge to pass days")
|
||||
indicator.follow_entity(entity)
|
||||
if entity is RechargeStation:
|
||||
@ -140,7 +140,7 @@ class WaitMaturePlant extends Step:
|
||||
return []
|
||||
|
||||
func is_step_over(p : Player) -> bool:
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
for entity in p.planet.entity_container.get_children():
|
||||
if entity is Plant and entity.state == Plant.State.MATURE:
|
||||
return true
|
||||
return false
|
||||
@ -151,7 +151,7 @@ class HarvestMaturePlant extends Step:
|
||||
|
||||
func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]:
|
||||
var indicators : Array[InGameIndicator] = []
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
for entity in p.planet.entity_container.get_children():
|
||||
if entity is Plant and entity.state == Plant.State.MATURE:
|
||||
var indicator = generate_indicator(cam, "Harvest mature plants with shovel")
|
||||
indicator.follow_entity(entity)
|
||||
@ -163,7 +163,7 @@ class HarvestMaturePlant extends Step:
|
||||
|
||||
func is_step_over(p : Player) -> bool:
|
||||
var actual_mature_plant_number = 0
|
||||
for entity in p.planet.entityContainer.get_children():
|
||||
for entity in p.planet.entity_container.get_children():
|
||||
if entity is Plant and entity.state == Plant.State.MATURE:
|
||||
actual_mature_plant_number += 1
|
||||
return mature_plant_number != actual_mature_plant_number
|
||||
@ -5,7 +5,7 @@
|
||||
[ext_resource type="AudioStream" uid="uid://bym03qp4n6vep" path="res://gui/pointer/assets/sounds/click.wav" id="3_kj0cm"]
|
||||
[ext_resource type="Texture2D" uid="uid://djb52fosgmv4j" path="res://common/icons/left_click.svg" id="3_pshoq"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="4_b4uwv"]
|
||||
[ext_resource type="Script" uid="uid://c2en2hc6a7ils" path="res://gui/pointer/scripts/action_zone.gd" id="4_pshoq"]
|
||||
[ext_resource type="Script" uid="uid://c60a1bjcuj4hd" path="res://common/vfx/circle/scripts/circle.gd" id="5_b4uwv"]
|
||||
|
||||
[node name="Pointer" type="Node"]
|
||||
process_mode = 3
|
||||
@ -63,8 +63,10 @@ horizontal_alignment = 1
|
||||
|
||||
[node name="ActionZone" type="Sprite2D" parent="CanvasLayer/Inspector"]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(0, -1)
|
||||
script = ExtResource("4_pshoq")
|
||||
z_index = 4096
|
||||
script = ExtResource("5_b4uwv")
|
||||
opacity = 0.4
|
||||
metadata/_custom_type_script = "uid://c60a1bjcuj4hd"
|
||||
|
||||
[node name="Audio" type="Node" parent="."]
|
||||
|
||||
|
||||