Compare commits
10 Commits
42de41c9a8
...
bc9f2f83be
| Author | SHA1 | Date | |
|---|---|---|---|
| bc9f2f83be | |||
| 3c5f328fc5 | |||
| b0a6f93971 | |||
| 42edc97401 | |||
| 43bdbc3581 | |||
| 85cd832864 | |||
| e56ec31069 | |||
| 4fd29db291 | |||
| 65385c2b16 | |||
| 655b875759 |
@ -1,5 +1,15 @@
|
||||
extends Resource
|
||||
class_name GameData
|
||||
|
||||
@export var currentTerrainData : TerrainData
|
||||
@export var current_planet_data : PlanetData
|
||||
|
||||
@export var unlocked_plant_types_path : Array[PlantType] = [
|
||||
preload("res://entities/plants/resources/plant_types/champ.tres"),
|
||||
preload("res://entities/plants/resources/plant_types/chardi.tres"),
|
||||
preload("res://entities/plants/resources/plant_types/maias.tres"),
|
||||
preload("res://entities/plants/resources/plant_types/pili.tres"),
|
||||
]
|
||||
|
||||
@export var unlocked_machines : Array[MachineType] = [
|
||||
preload("res://entities/interactables/machines/compost/compost.tres")
|
||||
]
|
||||
82
common/game_data/scripts/planet_data.gd
Normal file
@ -0,0 +1,82 @@
|
||||
extends Resource
|
||||
class_name PlanetData
|
||||
|
||||
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MAX_SIZE = 400.
|
||||
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE = 100.
|
||||
const DEFAULT_BASE_SIZE = Vector2(2000,2000)
|
||||
|
||||
@export var base_size : Vector2 = Vector2(2000,2000)
|
||||
@export var contamination : TerrainData
|
||||
@export var quota_number : int = 0
|
||||
|
||||
func _init(_base_size : Vector2 = DEFAULT_BASE_SIZE):
|
||||
base_size = _base_size
|
||||
contamination = TerrainData.new(base_size)
|
||||
contamination.draw_random_zone(
|
||||
DEFAULT_CONTAMINATION_CENTRAL_ZONE_MAX_SIZE,
|
||||
DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE,
|
||||
base_size/2
|
||||
)
|
||||
|
||||
|
||||
func impact_contamination(position : Vector2, impact_radius : float, to_value : float = 1.):
|
||||
contamination.draw_circle(
|
||||
position,
|
||||
impact_radius,
|
||||
to_value
|
||||
)
|
||||
|
||||
func is_in_base(point):
|
||||
return (
|
||||
point.x > 0
|
||||
and point.y > 0
|
||||
and point.x < base_size.x
|
||||
and point.y < base_size.y)
|
||||
|
||||
func get_contamination(point : Vector2) -> float:
|
||||
return contamination.get_value(point)
|
||||
|
||||
func get_decontamination_coverage() -> float:
|
||||
return contamination.get_value_coverage()
|
||||
|
||||
func get_decontamination_surface() -> float:
|
||||
return contamination.get_value_surface() * 10
|
||||
#endregion
|
||||
|
||||
#region ------------------ Objectives ------------------
|
||||
func generate_objective_rewards(level = 0) -> Array[ObjectiveReward]:
|
||||
var amount = level + 1
|
||||
|
||||
var possible_objective_rewards_path : Array[ObjectiveReward] = [
|
||||
UpgradePlayerMaxEnergyReward.new(),
|
||||
RechargePlayerReward.new(randi_range(level + 1, (level + 1) * 2)),
|
||||
LootRandomSeedsReward.new(randi_range(level + 1, (level + 1) * 2))
|
||||
]
|
||||
|
||||
var objectives_reward : Array[ObjectiveReward] = []
|
||||
|
||||
var i = 0
|
||||
while i < amount and len(possible_objective_rewards_path) > 0:
|
||||
var r = possible_objective_rewards_path.pick_random()
|
||||
possible_objective_rewards_path.erase(r)
|
||||
objectives_reward.append(r)
|
||||
i += 1
|
||||
|
||||
return objectives_reward
|
||||
|
||||
#endregion
|
||||
|
||||
#region ------------------ Quotas ------------------
|
||||
func get_quota(n = 0) -> int:
|
||||
var first_quota = 100
|
||||
var quota_adding = n * 150
|
||||
|
||||
if n == 0:
|
||||
return first_quota
|
||||
elif n < 0:
|
||||
return 0
|
||||
|
||||
return get_quota(n - 1) + quota_adding
|
||||
|
||||
#endregion
|
||||
|
||||
1
common/game_data/scripts/planet_data.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://cx30nvq8b34lj
|
||||
@ -1,86 +1,98 @@
|
||||
extends Resource
|
||||
class_name TerrainData
|
||||
|
||||
const TERRAIN_IMAGE_GAME_FACTOR = 40
|
||||
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MAX_SIZE = 300
|
||||
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE = 50
|
||||
const UNIT_PER_PIXEL = 30
|
||||
|
||||
@export var terrainSize : Vector2 = Vector2(1000,1000)
|
||||
@export var image : Image
|
||||
@export var image_size : Vector2i
|
||||
|
||||
@export var contamination : Image = null
|
||||
|
||||
func generate_default_contamination(
|
||||
central_zone_max_size : int = DEFAULT_CONTAMINATION_CENTRAL_ZONE_MAX_SIZE,
|
||||
central_zone_min_size : int = DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE,
|
||||
):
|
||||
var noise: Noise = FastNoiseLite.new()
|
||||
noise.seed = randi()
|
||||
noise.noise_type = FastNoiseLite.TYPE_CELLULAR
|
||||
noise.frequency = 0.005 * TERRAIN_IMAGE_GAME_FACTOR
|
||||
|
||||
var imageSize = terrainSize / TERRAIN_IMAGE_GAME_FACTOR;
|
||||
|
||||
var noise_image = noise.get_image(
|
||||
imageSize.x,
|
||||
imageSize.y,
|
||||
1.0
|
||||
)
|
||||
|
||||
ImageTools.draw_gradient(
|
||||
noise_image,
|
||||
imageSize/2,
|
||||
central_zone_min_size / TERRAIN_IMAGE_GAME_FACTOR
|
||||
)
|
||||
|
||||
ImageTools.draw_gradient(
|
||||
noise_image,
|
||||
imageSize/2,
|
||||
central_zone_max_size / TERRAIN_IMAGE_GAME_FACTOR,
|
||||
Color.BLACK,
|
||||
true
|
||||
)
|
||||
|
||||
|
||||
ImageTools.flatten(noise_image, 0.5)
|
||||
|
||||
contamination = Image.create(
|
||||
imageSize.x,
|
||||
imageSize.y,
|
||||
func _init(terrain_size : Vector2):
|
||||
image_size = terrain_size / UNIT_PER_PIXEL
|
||||
image = Image.create(
|
||||
image_size.x,
|
||||
image_size.y,
|
||||
false,
|
||||
Image.Format.FORMAT_L8
|
||||
)
|
||||
|
||||
contamination.copy_from(noise_image)
|
||||
func draw_random_zone(
|
||||
zone_max_size : float,
|
||||
zone_min_size : float,
|
||||
zone_position : Vector2i
|
||||
):
|
||||
var noise: Noise = FastNoiseLite.new()
|
||||
noise.seed = randi()
|
||||
noise.noise_type = FastNoiseLite.TYPE_CELLULAR
|
||||
noise.frequency = 0.001 / UNIT_PER_PIXEL
|
||||
|
||||
func impact_contamination(position : Vector2, impact_radius : int, to_value : float = 1.):
|
||||
var noise_image_size : Vector2i = Vector2i.ONE * zone_max_size / UNIT_PER_PIXEL
|
||||
var noise_image_center = noise_image_size / 2
|
||||
|
||||
var noise_image = noise.get_image(
|
||||
noise_image_size.x,
|
||||
noise_image_size.y,
|
||||
1.0,
|
||||
)
|
||||
|
||||
ImageTools.draw_gradient(
|
||||
noise_image,
|
||||
noise_image_center,
|
||||
roundi(zone_min_size / UNIT_PER_PIXEL)
|
||||
)
|
||||
|
||||
ImageTools.draw_gradient(
|
||||
noise_image,
|
||||
noise_image_center,
|
||||
roundi(zone_max_size / UNIT_PER_PIXEL),
|
||||
Color.BLACK,
|
||||
true
|
||||
)
|
||||
|
||||
ImageTools.flatten(noise_image, 0.5)
|
||||
|
||||
image.blit_rect(
|
||||
noise_image,
|
||||
Rect2i(
|
||||
Vector2i.ZERO,
|
||||
noise_image_size
|
||||
),
|
||||
Vector2i(zone_position / UNIT_PER_PIXEL) - noise_image_size/2
|
||||
)
|
||||
|
||||
func draw_circle(position : Vector2, impact_radius : float, to_value : float = 1.):
|
||||
ImageTools.draw_circle(
|
||||
contamination,
|
||||
position / TERRAIN_IMAGE_GAME_FACTOR,
|
||||
impact_radius / TERRAIN_IMAGE_GAME_FACTOR,
|
||||
image,
|
||||
position / UNIT_PER_PIXEL,
|
||||
roundi(impact_radius / UNIT_PER_PIXEL),
|
||||
Color(1., 1., 1., to_value)
|
||||
)
|
||||
|
||||
func is_in_image(pixel_point : Vector2, image : Image):
|
||||
func is_in_image(pixel_point : Vector2i):
|
||||
return (
|
||||
pixel_point.x > 0
|
||||
and pixel_point.y > 0
|
||||
and pixel_point.x < image.get_width()
|
||||
and pixel_point.y < image.get_height())
|
||||
|
||||
func get_contamination(point : Vector2) -> float:
|
||||
var pixel_point : Vector2 = get_pixel_point(point)
|
||||
if (is_in_image(pixel_point, contamination)):
|
||||
return contamination.get_pixel(
|
||||
int(round(pixel_point.x)),
|
||||
int(round(pixel_point.y))
|
||||
func is_in_terrain(point : Vector2):
|
||||
return is_in_image(get_pixel_point(point))
|
||||
|
||||
func get_value(point : Vector2) -> float:
|
||||
var pixel_point : Vector2i = get_pixel_point(point)
|
||||
if (is_in_image(pixel_point)):
|
||||
return image.get_pixel(
|
||||
pixel_point.x,
|
||||
pixel_point.y
|
||||
).r
|
||||
return 0
|
||||
|
||||
func get_decontamination_coverage() -> float:
|
||||
return ImageTools.get_color_coverage(contamination)
|
||||
func get_value_coverage() -> float:
|
||||
return ImageTools.get_color_coverage(image)
|
||||
|
||||
func get_pixel_point(point : Vector2) -> Vector2:
|
||||
return (
|
||||
Vector2(point) / float(TERRAIN_IMAGE_GAME_FACTOR)
|
||||
- Vector2.ONE / 2
|
||||
func get_value_surface() -> float:
|
||||
return float(ImageTools.get_color_pixel_count(image)) / UNIT_PER_PIXEL
|
||||
|
||||
func get_pixel_point(point : Vector2) -> Vector2i:
|
||||
return Vector2i(
|
||||
Vector2(point) / UNIT_PER_PIXEL
|
||||
)
|
||||
|
||||
@ -1 +1 @@
|
||||
uid://cx30nvq8b34lj
|
||||
uid://we5pyyr1n06v
|
||||
|
||||
7
common/game_info/game_info.gd
Normal file
@ -0,0 +1,7 @@
|
||||
extends Node
|
||||
|
||||
var game_data : GameData
|
||||
|
||||
func _init():
|
||||
if not game_data:
|
||||
game_data = GameData.new()
|
||||
1
common/game_info/game_info.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://dcamb3xjyfqm1
|
||||
|
Before Width: | Height: | Size: 887 B After Width: | Height: | Size: 887 B |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dcgnamu7sb3ov"
|
||||
path="res://.godot/imported/bolt.svg-71cbe0c7c38f15f305dc23930d585037.ctex"
|
||||
path="res://.godot/imported/bolt.svg-a559d5e701996c7d105fc68102331434.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/game/assets/icons/bolt.svg"
|
||||
dest_files=["res://.godot/imported/bolt.svg-71cbe0c7c38f15f305dc23930d585037.ctex"]
|
||||
source_file="res://common/icons/bolt.svg"
|
||||
dest_files=["res://.godot/imported/bolt.svg-a559d5e701996c7d105fc68102331434.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
@ -32,6 +32,6 @@ process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
1
common/icons/cube-3d-sphere.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-cube-3d-sphere"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 17.6l-2 -1.1v-2.5" /><path d="M4 10v-2.5l2 -1.1" /><path d="M10 4.1l2 -1.1l2 1.1" /><path d="M18 6.4l2 1.1v2.5" /><path d="M20 14v2.5l-2 1.12" /><path d="M14 19.9l-2 1.1l-2 -1.1" /><path d="M12 12l2 -1.1" /><path d="M18 8.6l2 -1.1" /><path d="M12 12l0 2.5" /><path d="M12 18.5l0 2.5" /><path d="M12 12l-2 -1.12" /><path d="M6 8.6l-2 -1.1" /></svg>
|
||||
|
After Width: | Height: | Size: 669 B |
37
common/icons/cube-3d-sphere.svg.import
Normal file
@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bsvxhafoxwmw0"
|
||||
path="res://.godot/imported/cube-3d-sphere.svg-f86899fe00f38af995e1752e193f1d54.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/cube-3d-sphere.svg"
|
||||
dest_files=["res://.godot/imported/cube-3d-sphere.svg-f86899fe00f38af995e1752e193f1d54.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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/hourglass-empty.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-hourglass-empty"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 20v-2a6 6 0 1 1 12 0v2a1 1 0 0 1 -1 1h-10a1 1 0 0 1 -1 -1z" /><path d="M6 4v2a6 6 0 1 0 12 0v-2a1 1 0 0 0 -1 -1h-10a1 1 0 0 0 -1 1z" /></svg>
|
||||
|
After Width: | Height: | Size: 464 B |
37
common/icons/hourglass-empty.svg.import
Normal file
@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cxkmn71f8d2hy"
|
||||
path="res://.godot/imported/hourglass-empty.svg-e7568d697204ad5aa1416ea495c59e73.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/hourglass-empty.svg"
|
||||
dest_files=["res://.godot/imported/hourglass-empty.svg-e7568d697204ad5aa1416ea495c59e73.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://djb52fosgmv4j"
|
||||
path="res://.godot/imported/left_click.svg-163ab642e0d1ce655b5b40384b3f1392.ctex"
|
||||
path="res://.godot/imported/left_click.svg-f515b89b9c254e1eacbc2bef4d187a50.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/pointer/assets/icons/left_click.svg"
|
||||
dest_files=["res://.godot/imported/left_click.svg-163ab642e0d1ce655b5b40384b3f1392.ctex"]
|
||||
source_file="res://common/icons/left_click.svg"
|
||||
dest_files=["res://.godot/imported/left_click.svg-f515b89b9c254e1eacbc2bef4d187a50.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
@ -32,6 +32,6 @@ process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
|
Before Width: | Height: | Size: 451 B After Width: | Height: | Size: 451 B |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dex283rx00fjb"
|
||||
path="res://.godot/imported/logout.svg-adb7b7ff1fadfa9220dcf694870580b9.ctex"
|
||||
path="res://.godot/imported/logout.svg-15891d2f0d875a13ef182339fdbc6039.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/game/pause/assets/icons/logout.svg"
|
||||
dest_files=["res://.godot/imported/logout.svg-adb7b7ff1fadfa9220dcf694870580b9.ctex"]
|
||||
source_file="res://common/icons/logout.svg"
|
||||
dest_files=["res://.godot/imported/logout.svg-15891d2f0d875a13ef182339fdbc6039.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
@ -32,6 +32,6 @@ process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
|
Before Width: | Height: | Size: 468 B After Width: | Height: | Size: 468 B |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://0xg54agef5gh"
|
||||
path="res://.godot/imported/package.svg-a9602fd424cfb199cd9405d02663e7df.ctex"
|
||||
path="res://.godot/imported/package.svg-0d0e7de2f6c04b754487a1f6252ee2a1.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/inventory/assets/icons/package.svg"
|
||||
dest_files=["res://.godot/imported/package.svg-a9602fd424cfb199cd9405d02663e7df.ctex"]
|
||||
source_file="res://common/icons/package.svg"
|
||||
dest_files=["res://.godot/imported/package.svg-0d0e7de2f6c04b754487a1f6252ee2a1.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
@ -32,6 +32,6 @@ process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
|
Before Width: | Height: | Size: 412 B After Width: | Height: | Size: 412 B |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b5cuxgisrsfgt"
|
||||
path="res://.godot/imported/player-pause.svg-cb8236066c72679196b716c41226079f.ctex"
|
||||
path="res://.godot/imported/player-pause.svg-8c388309845b649483858ace29fdf914.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/game/pause/assets/icons/player-pause.svg"
|
||||
dest_files=["res://.godot/imported/player-pause.svg-cb8236066c72679196b716c41226079f.ctex"]
|
||||
source_file="res://common/icons/player-pause.svg"
|
||||
dest_files=["res://.godot/imported/player-pause.svg-8c388309845b649483858ace29fdf914.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
@ -32,6 +32,6 @@ process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
|
Before Width: | Height: | Size: 326 B After Width: | Height: | Size: 326 B |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://vmsn54d1ptih"
|
||||
path="res://.godot/imported/player-play.svg-25043c6a392478c90f845ddfdfb35372.ctex"
|
||||
path="res://.godot/imported/player-play.svg-230ff7b9a6c52930be11873163a0e7de.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/game/pause/assets/icons/player-play.svg"
|
||||
dest_files=["res://.godot/imported/player-play.svg-25043c6a392478c90f845ddfdfb35372.ctex"]
|
||||
source_file="res://common/icons/player-play.svg"
|
||||
dest_files=["res://.godot/imported/player-play.svg-230ff7b9a6c52930be11873163a0e7de.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
@ -32,6 +32,6 @@ process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://y3083o1fhgn0"
|
||||
path="res://.godot/imported/right_click.svg-89ed358ede3244ca5dababdd0f091dae.ctex"
|
||||
path="res://.godot/imported/right_click.svg-1adb207c34017f29e28afdeafbacdd7f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/pointer/assets/icons/right_click.svg"
|
||||
dest_files=["res://.godot/imported/right_click.svg-89ed358ede3244ca5dababdd0f091dae.ctex"]
|
||||
source_file="res://common/icons/right_click.svg"
|
||||
dest_files=["res://.godot/imported/right_click.svg-1adb207c34017f29e28afdeafbacdd7f.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
@ -32,6 +32,6 @@ process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
|
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bewr0t1wi8pff"
|
||||
path="res://.godot/imported/rotate.svg-af6a45b9d3420200a268c1390881e44f.ctex"
|
||||
path="res://.godot/imported/rotate.svg-8b3d996ae2422076b9f55d10f0455aa8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/game/pause/assets/icons/rotate.svg"
|
||||
dest_files=["res://.godot/imported/rotate.svg-af6a45b9d3420200a268c1390881e44f.ctex"]
|
||||
source_file="res://common/icons/rotate.svg"
|
||||
dest_files=["res://.godot/imported/rotate.svg-8b3d996ae2422076b9f55d10f0455aa8.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
@ -32,6 +32,6 @@ process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
|
Before Width: | Height: | Size: 524 B After Width: | Height: | Size: 524 B |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bo3o2qf3i20ke"
|
||||
path="res://.godot/imported/scuba-diving-tank.svg-d6c94087bb8fe7a9f788baf1911a56a2.ctex"
|
||||
path="res://.godot/imported/scuba-diving-tank.svg-2724f573f5956cc7af7dbc8616ac0aa4.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/inventory/assets/icons/scuba-diving-tank.svg"
|
||||
dest_files=["res://.godot/imported/scuba-diving-tank.svg-d6c94087bb8fe7a9f788baf1911a56a2.ctex"]
|
||||
source_file="res://common/icons/scuba-diving-tank.svg"
|
||||
dest_files=["res://.godot/imported/scuba-diving-tank.svg-2724f573f5956cc7af7dbc8616ac0aa4.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
1
common/icons/seedling.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#ffffff" class="icon icon-tabler icons-tabler-filled icon-tabler-seedling"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 3a7 7 0 0 1 6.95 6.155a6.97 6.97 0 0 1 5.05 -2.155h3a1 1 0 0 1 1 1v1a7 7 0 0 1 -7 7h-2v4a1 1 0 0 1 -2 0v-7h-2a7 7 0 0 1 -7 -7v-2a1 1 0 0 1 1 -1z" /></svg>
|
||||
|
After Width: | Height: | Size: 387 B |
37
common/icons/seedling.svg.import
Normal file
@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b0wy3dbpxbnt7"
|
||||
path="res://.godot/imported/seedling.svg-86222438bce7bb2a4f266ea315728eb5.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/seedling.svg"
|
||||
dest_files=["res://.godot/imported/seedling.svg-86222438bce7bb2a4f266ea315728eb5.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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
|
||||
|
Before Width: | Height: | Size: 498 B After Width: | Height: | Size: 498 B |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bf6nw4onkhavr"
|
||||
path="res://.godot/imported/shovel.svg-f17d484b3a88170abdf08077458176fb.ctex"
|
||||
path="res://.godot/imported/shovel.svg-094c34e330000cc8ea425d6acf7556bd.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/inventory/assets/icons/shovel.svg"
|
||||
dest_files=["res://.godot/imported/shovel.svg-f17d484b3a88170abdf08077458176fb.ctex"]
|
||||
source_file="res://common/icons/shovel.svg"
|
||||
dest_files=["res://.godot/imported/shovel.svg-094c34e330000cc8ea425d6acf7556bd.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 583 B After Width: | Height: | Size: 583 B |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b38hdpsvqcwg8"
|
||||
path="res://.godot/imported/users-group.svg-65aad5cfa47be548675b81fab7ab9db6.ctex"
|
||||
path="res://.godot/imported/users-group.svg-e8465fccc5e5f0e575fcbdabcdf52e8b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/menu/assets/icons/users-group.svg"
|
||||
dest_files=["res://.godot/imported/users-group.svg-65aad5cfa47be548675b81fab7ab9db6.ctex"]
|
||||
source_file="res://common/icons/users-group.svg"
|
||||
dest_files=["res://.godot/imported/users-group.svg-e8465fccc5e5f0e575fcbdabcdf52e8b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
@ -32,6 +32,6 @@ process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
@ -1,15 +0,0 @@
|
||||
[gd_resource type="Resource" script_class="Package" load_steps=4 format=3 uid="uid://bya8sm6rm6747"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://0xg54agef5gh" path="res://common/inventory/assets/icons/package.svg" id="1_lhhdv"]
|
||||
[ext_resource type="Script" uid="uid://b6kubqgq0k7vj" path="res://common/inventory/scripts/items/package.gd" id="1_x02bb"]
|
||||
[ext_resource type="PackedScene" uid="uid://bkwh1ntvgkkrt" path="res://entities/interactables/machines/compost/compost.tscn" id="2_uulso"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_x02bb")
|
||||
scene = ExtResource("2_uulso")
|
||||
name = "Compost"
|
||||
description = "Compost"
|
||||
icon = ExtResource("1_lhhdv")
|
||||
use_zone_radius = 5
|
||||
use_energy = 1
|
||||
metadata/_custom_type_script = "uid://b6kubqgq0k7vj"
|
||||
@ -1,13 +0,0 @@
|
||||
[gd_resource type="Resource" script_class="Seed" load_steps=3 format=3 uid="uid://lrl2okkhyxmx"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://gui/game/assets/icons/bolt.svg" id="1_dy25s"]
|
||||
[ext_resource type="Script" uid="uid://bypjcvlc15gsm" path="res://common/inventory/scripts/items/seed.gd" id="2_mgcdi"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_mgcdi")
|
||||
name = "Boule"
|
||||
description = ""
|
||||
icon = ExtResource("1_dy25s")
|
||||
use_zone_radius = 5
|
||||
use_energy = 1
|
||||
metadata/_custom_type_script = "uid://bypjcvlc15gsm"
|
||||
@ -1,13 +0,0 @@
|
||||
[gd_resource type="Resource" script_class="Shovel" load_steps=3 format=3 uid="uid://ddqalo1k30i5x"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bf6nw4onkhavr" path="res://common/inventory/assets/icons/shovel.svg" id="1_7g3xd"]
|
||||
[ext_resource type="Script" uid="uid://dya38x1h1uiyg" path="res://common/inventory/scripts/items/shovel.gd" id="1_28h2r"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_28h2r")
|
||||
name = "Shovel"
|
||||
description = "Can dig burried seed, and transform mature plants to seeds."
|
||||
icon = ExtResource("1_7g3xd")
|
||||
use_zone_radius = 50
|
||||
use_energy = 1
|
||||
metadata/_custom_type_script = "uid://dya38x1h1uiyg"
|
||||
@ -1,11 +0,0 @@
|
||||
[gd_resource type="Resource" script_class="Item" load_steps=3 format=3 uid="uid://dbja8xm7ehw1v"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bo3o2qf3i20ke" path="res://common/inventory/assets/icons/scuba-diving-tank.svg" id="1_sy4rh"]
|
||||
[ext_resource type="Script" uid="uid://bq7admu4ahs5r" path="res://common/inventory/scripts/item.gd" id="2_aikyk"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_aikyk")
|
||||
name = "Water Can"
|
||||
description = "Water all plants"
|
||||
icon = ExtResource("1_sy4rh")
|
||||
metadata/_custom_type_script = "uid://bq7admu4ahs5r"
|
||||
@ -1,11 +1,26 @@
|
||||
extends Resource
|
||||
class_name Item
|
||||
|
||||
@export var name: String
|
||||
@export_multiline var description: String
|
||||
@export var icon: Texture2D
|
||||
@export var use_zone_radius: int = 5
|
||||
@export var use_energy: int = 1
|
||||
var name: String : get = get_item_name
|
||||
var description: String : get = get_description
|
||||
var icon: Texture2D : get = get_icon
|
||||
var usage_zone_radius: int = 5 : get = get_usage_zone_radius
|
||||
var energy_usage : int = 1 : get = get_energy_used
|
||||
|
||||
func get_item_name() -> String:
|
||||
return name
|
||||
|
||||
func get_description() -> String:
|
||||
return description
|
||||
|
||||
func get_icon() -> Texture2D:
|
||||
return icon
|
||||
|
||||
func get_energy_used() -> int:
|
||||
return energy_usage
|
||||
|
||||
func get_usage_zone_radius() -> int:
|
||||
return usage_zone_radius
|
||||
|
||||
func is_one_time_use():
|
||||
return false
|
||||
@ -16,8 +31,5 @@ func can_use(_player : Player, zone: Area2D) -> bool:
|
||||
func use_text() -> String:
|
||||
return ""
|
||||
|
||||
func use_requirement_text() -> String:
|
||||
return ""
|
||||
|
||||
func use(_player : Player, zone: Area2D):
|
||||
return false
|
||||
|
||||
39
common/inventory/scripts/items/blueprint.gd
Normal file
@ -0,0 +1,39 @@
|
||||
extends Item
|
||||
class_name Blueprint
|
||||
|
||||
@export var machine_type: MachineType
|
||||
@export var machine_level: int = 1
|
||||
|
||||
func _init(_machine_type : MachineType = null, _machine_level : int = 1):
|
||||
machine_type = _machine_type
|
||||
machine_level = _machine_level
|
||||
|
||||
func get_item_name() -> String:
|
||||
if machine_type:
|
||||
return machine_type.name + " level " + str(machine_level)
|
||||
return ""
|
||||
|
||||
func get_description() -> String:
|
||||
if machine_type:
|
||||
return machine_type.description
|
||||
return ""
|
||||
|
||||
func get_icon() -> Texture2D:
|
||||
return preload("res://common/icons/cube-3d-sphere.svg")
|
||||
|
||||
func use_text() -> String:
|
||||
if machine_type:
|
||||
return "Build " + machine_type.name
|
||||
return ""
|
||||
|
||||
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 use(player : Player, zone : Area2D) -> bool:
|
||||
if machine_type and machine_level:
|
||||
player.planet.instantiate_machine(machine_type, machine_level, zone.global_position)
|
||||
return true
|
||||
return false
|
||||
1
common/inventory/scripts/items/blueprint.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://dcowcvjk2m7va
|
||||
@ -2,18 +2,30 @@ extends Item
|
||||
class_name Package
|
||||
|
||||
@export var scene: PackedScene
|
||||
@export var package_name : String
|
||||
@export_multiline var package_description : String
|
||||
|
||||
|
||||
func _init(_scene : PackedScene = null):
|
||||
scene = _scene
|
||||
|
||||
func get_item_name() -> String:
|
||||
return package_name
|
||||
|
||||
func get_description() -> String:
|
||||
return package_description
|
||||
|
||||
func get_icon() -> Texture2D:
|
||||
return preload("res://common/icons/package.svg")
|
||||
|
||||
func use_text() -> String:
|
||||
return "Build " + name
|
||||
return "Open"
|
||||
|
||||
func is_one_time_use():
|
||||
return true
|
||||
|
||||
func can_use(player : Player, zone : Area2D) -> bool:
|
||||
return player.planet.is_in_zone(zone.global_position)
|
||||
return true
|
||||
|
||||
func use(player : Player, zone : Area2D) -> bool:
|
||||
player.planet.instantiate_entity(scene, zone.global_position)
|
||||
|
||||
@ -1,14 +1,19 @@
|
||||
@tool
|
||||
extends Item
|
||||
class_name Seed
|
||||
|
||||
@export var plant_type: PlantType :
|
||||
set(v):
|
||||
plant_type = v
|
||||
if plant_type:
|
||||
name = plant_type.name
|
||||
description = plant_type.description
|
||||
icon = plant_type.seed_texture
|
||||
@export var plant_type: PlantType
|
||||
|
||||
func get_item_name() -> String:
|
||||
return plant_type.name
|
||||
|
||||
func get_description() -> String:
|
||||
return plant_type.description
|
||||
|
||||
func get_icon() -> Texture2D:
|
||||
return plant_type.seed_texture
|
||||
|
||||
func get_energy_used() -> int:
|
||||
return 1
|
||||
|
||||
func _init(_plant_type : PlantType = null):
|
||||
plant_type = _plant_type
|
||||
@ -20,7 +25,12 @@ func is_one_time_use():
|
||||
return true
|
||||
|
||||
func can_use(player : Player, zone : Area2D) -> bool:
|
||||
return not player.planet.is_there_contamination(zone.global_position)
|
||||
var is_there_a_plant_here = false
|
||||
for area in zone.get_overlapping_areas() :
|
||||
if area is Plant:
|
||||
is_there_a_plant_here = true
|
||||
|
||||
return not is_there_a_plant_here and not player.planet.is_there_contamination(zone.global_position)
|
||||
|
||||
func use(player : Player, zone : Area2D) -> bool:
|
||||
player.play_sfx("dig")
|
||||
|
||||
@ -2,6 +2,22 @@ extends Item
|
||||
class_name Shovel
|
||||
|
||||
const USE_INTERVAL = 0.15
|
||||
const SHOVEL_ZONE_RADIUS = 50
|
||||
|
||||
func get_item_name() -> String:
|
||||
return "Shovel"
|
||||
|
||||
func get_description() -> String:
|
||||
return "Can dig up buried seeds and can be used to harvest mature plants."
|
||||
|
||||
func get_icon() -> Texture2D:
|
||||
return preload("res://common/icons/shovel.svg")
|
||||
|
||||
func get_energy_used() -> int:
|
||||
return 1
|
||||
|
||||
func get_usage_zone_radius() -> int:
|
||||
return SHOVEL_ZONE_RADIUS
|
||||
|
||||
func use_text() -> String:
|
||||
return "Dig"
|
||||
|
||||
@ -11,11 +11,13 @@ stream_0 = ExtResource("1_stre8")
|
||||
stream_1 = ExtResource("2_ji160")
|
||||
|
||||
[node name="Music" type="Node"]
|
||||
process_mode = 3
|
||||
|
||||
[node name="AudioStreamPlayer_music" type="AudioStreamPlayer" parent="."]
|
||||
stream = SubResource("AudioStreamPlaylist_ei6w7")
|
||||
volume_db = -5.0
|
||||
autoplay = true
|
||||
parameters/looping = false
|
||||
|
||||
[node name="AudioStreamPlayer2_ambient" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("2_n52pk")
|
||||
|
||||
@ -1,61 +1,63 @@
|
||||
class_name ImageTools
|
||||
|
||||
static func get_color_coverage(image: Image, color: Color = Color.WHITE):
|
||||
var pixel_color_count = 0.
|
||||
for x in range(image.get_width()):
|
||||
for y in range(image.get_height()):
|
||||
if image.get_pixel(x, y) == color:
|
||||
pixel_color_count += 1.
|
||||
return pixel_color_count/(image.get_width()*image.get_height())
|
||||
|
||||
static func get_color_coverage(image: Image, color: Color = Color.WHITE) -> float:
|
||||
return float(get_color_pixel_count(image, color))/(image.get_width()*image.get_height())
|
||||
|
||||
static func get_color_pixel_count(image: Image, color: Color = Color.WHITE) -> int:
|
||||
var pixel_color_count = 0.
|
||||
for x in range(image.get_width()):
|
||||
for y in range(image.get_height()):
|
||||
if image.get_pixel(x, y) == color:
|
||||
pixel_color_count += 1.
|
||||
return pixel_color_count
|
||||
|
||||
static func draw_circle(image: Image, center: Vector2i, length: int, color: Color = Color.WHITE):
|
||||
for x in range(image.get_width()):
|
||||
for y in range(image.get_height()):
|
||||
var center_distance = Vector2i(x, y).distance_to(center)
|
||||
for x in range(image.get_width()):
|
||||
for y in range(image.get_height()):
|
||||
var center_distance = Vector2i(x, y).distance_to(center)
|
||||
|
||||
if (center_distance <= length):
|
||||
image.set_pixel(x, y, color)
|
||||
|
||||
if (center_distance <= length):
|
||||
image.set_pixel(x, y, color)
|
||||
|
||||
|
||||
static func draw_gradient(image: Image, center: Vector2i, length: int, color: Color = Color.WHITE, inverse := false):
|
||||
for x in range(image.get_width()):
|
||||
for y in range(image.get_height()):
|
||||
var original_pixel_color = image.get_pixel(x, y)
|
||||
var center_distance = Vector2i(x, y).distance_to(center)
|
||||
for x in range(image.get_width()):
|
||||
for y in range(image.get_height()):
|
||||
var original_pixel_color = image.get_pixel(x, y)
|
||||
var center_distance = Vector2i(x, y).distance_to(center)
|
||||
|
||||
if (center_distance == 0):
|
||||
if not inverse:
|
||||
image.set_pixel(x, y, original_pixel_color.blend(color))
|
||||
else:
|
||||
var color_to_add = Color(color, 1 / (center_distance / length)) if not inverse else Color(color, center_distance / length)
|
||||
image.set_pixel(
|
||||
x,
|
||||
y,
|
||||
original_pixel_color.blend(color_to_add)
|
||||
)
|
||||
if (center_distance == 0):
|
||||
if not inverse:
|
||||
image.set_pixel(x, y, original_pixel_color.blend(color))
|
||||
else:
|
||||
var color_to_add = Color(color, 1 / (center_distance / length)) if not inverse else Color(color, center_distance / length)
|
||||
image.set_pixel(
|
||||
x,
|
||||
y,
|
||||
original_pixel_color.blend(color_to_add)
|
||||
)
|
||||
|
||||
static func flatten(image: Image, threshold := 0.5):
|
||||
for x in range(image.get_width()):
|
||||
for y in range(image.get_height()):
|
||||
var original_pixel_color = image.get_pixel(x, y)
|
||||
for x in range(image.get_width()):
|
||||
for y in range(image.get_height()):
|
||||
var original_pixel_color = image.get_pixel(x, y)
|
||||
|
||||
if original_pixel_color.r > threshold:
|
||||
image.set_pixel(
|
||||
x,
|
||||
y,
|
||||
Color.WHITE
|
||||
)
|
||||
else:
|
||||
image.set_pixel(
|
||||
x,
|
||||
y,
|
||||
Color.BLACK
|
||||
)
|
||||
if original_pixel_color.r > threshold:
|
||||
image.set_pixel(
|
||||
x,
|
||||
y,
|
||||
Color.WHITE
|
||||
)
|
||||
else:
|
||||
image.set_pixel(
|
||||
x,
|
||||
y,
|
||||
Color.BLACK
|
||||
)
|
||||
|
||||
static func copy(from: Image, to : Image):
|
||||
for x in range(from.get_width()):
|
||||
for y in range(from.get_height()):
|
||||
to.set_pixel(x, y, from.get_pixel(x, y))
|
||||
|
||||
|
||||
for x in range(from.get_width()):
|
||||
for y in range(from.get_height()):
|
||||
to.set_pixel(x, y, from.get_pixel(x, y))
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://bcj812ox8xv2t"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://reliyx2pg7kf" path="res://entities/interactables/item_object/script/item_object_sprite.gd" id="1_wing4"]
|
||||
[ext_resource type="Texture2D" uid="uid://bo3o2qf3i20ke" path="res://common/inventory/assets/icons/scuba-diving-tank.svg" id="2_ng3e4"]
|
||||
[ext_resource type="Texture2D" uid="uid://bo3o2qf3i20ke" path="res://common/icons/scuba-diving-tank.svg" id="2_ng3e4"]
|
||||
[ext_resource type="Texture2D" uid="uid://c1eiu5ag7lcp8" path="res://entities/interactables/item_object/assets/sprites/shadow.svg" id="2_ng201"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wing4"]
|
||||
|
||||
@ -22,13 +22,26 @@ func _ready():
|
||||
if item and object_sprite:
|
||||
object_sprite.apply_texture_to_sprite(item.icon, ITEM_SPRITE_SIZE)
|
||||
|
||||
func pointer_text():
|
||||
var name_suffix = ""
|
||||
|
||||
func inspected_text():
|
||||
return item.name + (" Seed" if item is Seed else "")
|
||||
if item is Seed:
|
||||
name_suffix = "Seed"
|
||||
if item is Package:
|
||||
name_suffix = "Package"
|
||||
|
||||
return item.name + (" " + name_suffix if name_suffix else "")
|
||||
|
||||
func interact_text():
|
||||
return "Take"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text(),
|
||||
item.description,
|
||||
item.icon
|
||||
)
|
||||
|
||||
func interact(player : Player) -> bool:
|
||||
var swapped_item = player.inventory.get_item()
|
||||
|
||||
@ -55,9 +68,10 @@ func generate_sprite() -> ItemObjectSprite:
|
||||
var spriteNode = SPRITE_SCENE.instantiate() as ItemObjectSprite
|
||||
add_child(spriteNode)
|
||||
|
||||
spriteNode.apply_texture_to_sprite(
|
||||
item.icon,
|
||||
ITEM_SPRITE_SIZE
|
||||
)
|
||||
if item:
|
||||
spriteNode.apply_texture_to_sprite(
|
||||
item.icon,
|
||||
ITEM_SPRITE_SIZE
|
||||
)
|
||||
|
||||
return spriteNode
|
||||
|
||||
10
entities/interactables/machines/compost/compost.tres
Normal file
@ -0,0 +1,10 @@
|
||||
[gd_resource type="Resource" script_class="MachineType" load_steps=3 format=3 uid="uid://cv2tf0tydqj5v"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bkwh1ntvgkkrt" path="res://entities/interactables/machines/compost/compost.tscn" id="1_8ajib"]
|
||||
[ext_resource type="Script" uid="uid://bhncww816fjsb" path="res://entities/interactables/machines/scripts/machine_info.gd" id="1_vktn1"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_vktn1")
|
||||
name = "Compost"
|
||||
scene = ExtResource("1_8ajib")
|
||||
description = "Can generate temporary energy in exchange of seeds."
|
||||
@ -1,7 +1,11 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://bkwh1ntvgkkrt"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://bkwh1ntvgkkrt"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dw6jgsasb2fe1" path="res://entities/interactables/machines/compost/scripts/compost.gd" id="1_c0pig"]
|
||||
[ext_resource type="Texture2D" uid="uid://f2rte5jc0psp" path="res://entities/interactables/machines/compost/assets/sprites/compost.svg" id="2_r6435"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="3_akkx7"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_akkx7"]
|
||||
size = Vector2(66, 84)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_etofw"]
|
||||
bg_color = Color(0.260098, 0.11665, 0.0419712, 0.231373)
|
||||
@ -95,14 +99,14 @@ _data = {
|
||||
&"fill": SubResource("Animation_etofw")
|
||||
}
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_akkx7"]
|
||||
size = Vector2(66, 84)
|
||||
|
||||
[node name="Compost" type="Area2D"]
|
||||
script = ExtResource("1_c0pig")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_akkx7")
|
||||
|
||||
[node name="Compost" type="Sprite2D" parent="."]
|
||||
modulate = Color(0.615686, 0.501961, 0.270588, 1)
|
||||
self_modulate = Color(0.729698, 0.588265, 0.105405, 1)
|
||||
scale = Vector2(0.291262, 0.291262)
|
||||
texture = ExtResource("2_r6435")
|
||||
|
||||
@ -117,10 +121,13 @@ theme_override_styles/fill = SubResource("StyleBoxFlat_3ao1n")
|
||||
fill_mode = 3
|
||||
show_percentage = false
|
||||
|
||||
[node name="Bolt" type="Sprite2D" parent="Compost"]
|
||||
z_index = 1
|
||||
position = Vector2(0, 54.9334)
|
||||
scale = Vector2(2.00278, 2.00278)
|
||||
texture = ExtResource("3_akkx7")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_etofw")
|
||||
}
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_akkx7")
|
||||
|
||||
@ -1,36 +1,41 @@
|
||||
extends Machine
|
||||
class_name Compost
|
||||
|
||||
var value_per_seed : float = 0.5
|
||||
var fill_value : float = 0.
|
||||
var containing_seed : int = 0
|
||||
|
||||
func get_seed_needed(l : int = level) -> int:
|
||||
match l:
|
||||
1: return 3
|
||||
2: return 2
|
||||
3: return 2
|
||||
_: return 1
|
||||
|
||||
func get_energy_production(l : int = level) -> int:
|
||||
match l:
|
||||
1: return 1
|
||||
2: return 1
|
||||
_: return 2
|
||||
|
||||
func _process(_delta):
|
||||
%ProgressBar.value = lerp(%ProgressBar.value, fill_value * 100, 0.5)
|
||||
|
||||
func inspected_text():
|
||||
return "Compost"
|
||||
%ProgressBar.value = lerp(%ProgressBar.value, float(containing_seed) / float(get_seed_needed()) * 100, 0.5)
|
||||
|
||||
func interact_text():
|
||||
return "Put a seed ("+str(roundi((1-fill_value)/value_per_seed))+" left)"
|
||||
return "Put a seed ("+str(get_seed_needed() - containing_seed)+" left)"
|
||||
|
||||
func can_interact(p : Player) -> bool:
|
||||
return p.inventory.get_item() and p.inventory.get_item() is Seed
|
||||
|
||||
func requirement_text() -> String:
|
||||
return "You must have a seed in hand"
|
||||
|
||||
func interact(p : Player) -> bool:
|
||||
if not can_interact(p):
|
||||
return false
|
||||
|
||||
p.play_sfx("harvest")
|
||||
p.delete_item(p.inventory.get_item())
|
||||
fill_value += value_per_seed
|
||||
if fill_value >= 1.:
|
||||
containing_seed += 1
|
||||
if containing_seed >= get_seed_needed():
|
||||
$AnimationPlayer.play("empty")
|
||||
fill_value = 0
|
||||
p.upgrade()
|
||||
value_per_seed /= 1.5
|
||||
containing_seed = 0
|
||||
p.recharge(get_energy_production())
|
||||
else:
|
||||
$AnimationPlayer.play("fill")
|
||||
return true
|
||||
|
||||
@ -1,23 +1,29 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://d324mlmgls4fs"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://d324mlmgls4fs"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bsrn3gd2a532q" path="res://entities/interactables/machines/recharge_station/scripts/recharge_station.gd" id="1_2ffjo"]
|
||||
[ext_resource type="Texture2D" uid="uid://c82ljr3in67am" path="res://entities/interactables/machines/recharge_station/assets/sprites/recharge_station.svg" id="2_58ax0"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="3_3xua0"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_bjhct"]
|
||||
radius = 15.0
|
||||
height = 72.0
|
||||
|
||||
[node name="RechargeStation" type="Area2D"]
|
||||
modulate = Color(0.615686, 0.501961, 0.270588, 1)
|
||||
script = ExtResource("1_2ffjo")
|
||||
metadata/_custom_type_script = "uid://dyprcd68fjstf"
|
||||
|
||||
[node name="RechargeStation" type="Sprite2D" parent="."]
|
||||
position = Vector2(0, -17)
|
||||
scale = Vector2(0.3, 0.3)
|
||||
texture = ExtResource("2_58ax0")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(1, -1)
|
||||
rotation = -1.5708
|
||||
shape = SubResource("CapsuleShape2D_bjhct")
|
||||
|
||||
[node name="RechargeStation" type="Sprite2D" parent="."]
|
||||
self_modulate = Color(0.729412, 0.588235, 0.105882, 1)
|
||||
position = Vector2(0, -17)
|
||||
scale = Vector2(0.3, 0.3)
|
||||
texture = ExtResource("2_58ax0")
|
||||
|
||||
[node name="Bolt" type="Sprite2D" parent="."]
|
||||
position = Vector2(0, -40)
|
||||
scale = Vector2(0.375, 0.375)
|
||||
texture = ExtResource("3_3xua0")
|
||||
|
||||
@ -10,4 +10,13 @@ func interact(_p: Player) -> bool:
|
||||
return true
|
||||
|
||||
func interact_text():
|
||||
return "Recharge"
|
||||
return "Recharge"
|
||||
|
||||
func pointer_text():
|
||||
return "Recharge Station"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text(),
|
||||
"You can recharge your robot here. When recharging, time will pass and plants may grow."
|
||||
)
|
||||
@ -1,2 +1,22 @@
|
||||
extends Interactable
|
||||
class_name Machine
|
||||
class_name Machine
|
||||
|
||||
const MAX_MACHINE_LEVEL = 5
|
||||
|
||||
var level : int = 1
|
||||
var machine_name : String = ""
|
||||
var machine_desc : String = ""
|
||||
|
||||
func setup_machine_info(machine_type : MachineType, _level : int = 1):
|
||||
level = _level
|
||||
machine_name = machine_type.name
|
||||
machine_desc = machine_type.description
|
||||
|
||||
func pointer_text():
|
||||
return machine_name
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text() + " level " + str(level),
|
||||
machine_desc
|
||||
)
|
||||
|
||||
6
entities/interactables/machines/scripts/machine_info.gd
Normal file
@ -0,0 +1,6 @@
|
||||
extends Resource
|
||||
class_name MachineType
|
||||
|
||||
@export var name : String
|
||||
@export var scene : PackedScene
|
||||
@export_multiline var description : String
|
||||
@ -0,0 +1 @@
|
||||
uid://bhncww816fjsb
|
||||
@ -22,6 +22,3 @@ func generate_collision(area_width : float) -> CollisionShape2D:
|
||||
add_child(collision)
|
||||
|
||||
return collision
|
||||
|
||||
func interact_text():
|
||||
return ""
|
||||
|
||||
BIN
entities/objectives/assets/sprites/arbre_mort.png
Normal file
|
After Width: | Height: | Size: 127 KiB |
34
entities/objectives/assets/sprites/arbre_mort.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dbednu7eygtrf"
|
||||
path="res://.godot/imported/arbre_mort.png-eea217ee3fbf6520e6fbde71f18bbeef.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/objectives/assets/sprites/arbre_mort.png"
|
||||
dest_files=["res://.godot/imported/arbre_mort.png-eea217ee3fbf6520e6fbde71f18bbeef.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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
|
||||
BIN
entities/objectives/assets/sprites/little_plant.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
34
entities/objectives/assets/sprites/little_plant.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c4pv2o7crchc0"
|
||||
path="res://.godot/imported/little_plant.png-e9ed84e9420c629c3911ff755b194643.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/objectives/assets/sprites/little_plant.png"
|
||||
dest_files=["res://.godot/imported/little_plant.png-e9ed84e9420c629c3911ff755b194643.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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
|
||||
281
entities/objectives/objective.tscn
Normal file
@ -0,0 +1,281 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://djl2le58ckgdx"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://j8fpi8rd8eyy" path="res://entities/objectives/scripts/objective.gd" id="1_3hqw5"]
|
||||
[ext_resource type="Texture2D" uid="uid://dbednu7eygtrf" path="res://entities/objectives/assets/sprites/arbre_mort.png" id="2_3hqw5"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4pv2o7crchc0" path="res://entities/objectives/assets/sprites/little_plant.png" id="3_dulsb"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="4_6uhem"]
|
||||
[ext_resource type="Texture2D" uid="uid://bo3o2qf3i20ke" path="res://common/icons/scuba-diving-tank.svg" id="5_6uhem"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_v08i5"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ArbreMort:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0.443137, 0.443137, 0.443137, 1)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("LittlePlant:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("LittlePlant:scale")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.094358, 0.094358)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("LittlePlant2:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("LittlePlant2:scale")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.094358, 0.094358)]
|
||||
}
|
||||
tracks/5/type = "value"
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/path = NodePath("LittlePlant3:visible")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/6/type = "value"
|
||||
tracks/6/imported = false
|
||||
tracks/6/enabled = true
|
||||
tracks/6/path = NodePath("LittlePlant3:scale")
|
||||
tracks/6/interp = 1
|
||||
tracks/6/loop_wrap = true
|
||||
tracks/6/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.094358, 0.094358)]
|
||||
}
|
||||
tracks/7/type = "value"
|
||||
tracks/7/imported = false
|
||||
tracks/7/enabled = true
|
||||
tracks/7/path = NodePath("ArbreMort:scale")
|
||||
tracks/7/interp = 1
|
||||
tracks/7/loop_wrap = true
|
||||
tracks/7/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.162791, 0.162791)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_6uhem"]
|
||||
resource_name = "activate"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ArbreMort:modulate")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0.443137, 0.443137, 0.443137, 1), Color(1, 1, 1, 1)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("LittlePlant:visible")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0.0333333),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("LittlePlant:scale")
|
||||
tracks/2/interp = 2
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0.433333, 0.6),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0.094358, 0.094358)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("LittlePlant2:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0.0333333),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("LittlePlant2:scale")
|
||||
tracks/4/interp = 2
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(0.6, 0.8),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0.094358, 0.094358)]
|
||||
}
|
||||
tracks/5/type = "value"
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/path = NodePath("LittlePlant3:visible")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/keys = {
|
||||
"times": PackedFloat32Array(0.0333333),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/6/type = "value"
|
||||
tracks/6/imported = false
|
||||
tracks/6/enabled = true
|
||||
tracks/6/path = NodePath("LittlePlant3:scale")
|
||||
tracks/6/interp = 2
|
||||
tracks/6/loop_wrap = true
|
||||
tracks/6/keys = {
|
||||
"times": PackedFloat32Array(0.4, 0.533333),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0.094358, 0.094358)]
|
||||
}
|
||||
tracks/7/type = "value"
|
||||
tracks/7/imported = false
|
||||
tracks/7/enabled = true
|
||||
tracks/7/path = NodePath("ArbreMort:scale")
|
||||
tracks/7/interp = 2
|
||||
tracks/7/loop_wrap = true
|
||||
tracks/7/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.266667, 0.4),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.162791, 0.162791), Vector2(0.183, 0.093), Vector2(0.123, 0.178), Vector2(0.162791, 0.162791)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_047qm"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_v08i5"),
|
||||
&"activate": SubResource("Animation_6uhem")
|
||||
}
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_bvagy"]
|
||||
radius = 24.0
|
||||
height = 160.0
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_v08i5"]
|
||||
font = ExtResource("4_6uhem")
|
||||
font_size = 18
|
||||
|
||||
[node name="Objective" type="Area2D"]
|
||||
script = ExtResource("1_3hqw5")
|
||||
metadata/_custom_type_script = "uid://d3bk52402ylvl"
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_047qm")
|
||||
}
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -20)
|
||||
rotation = 1.5708
|
||||
shape = SubResource("CapsuleShape2D_bvagy")
|
||||
|
||||
[node name="ArbreMort" type="Sprite2D" parent="."]
|
||||
modulate = Color(0.443137, 0.443137, 0.443137, 1)
|
||||
position = Vector2(5, 4)
|
||||
scale = Vector2(0.162791, 0.162791)
|
||||
texture = ExtResource("2_3hqw5")
|
||||
centered = false
|
||||
offset = Vector2(-627.055, -607.11)
|
||||
|
||||
[node name="LittlePlant" type="Sprite2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(-22, -46)
|
||||
scale = Vector2(0.094358, 0.094358)
|
||||
texture = ExtResource("3_dulsb")
|
||||
|
||||
[node name="LittlePlant2" type="Sprite2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(39, -25)
|
||||
scale = Vector2(0.094358, 0.094358)
|
||||
texture = ExtResource("3_dulsb")
|
||||
|
||||
[node name="LittlePlant3" type="Sprite2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(-49, -14)
|
||||
scale = Vector2(0.094358, 0.094358)
|
||||
texture = ExtResource("3_dulsb")
|
||||
|
||||
[node name="RewardInfo" type="HBoxContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
offset_left = -67.0
|
||||
offset_top = -34.0
|
||||
offset_right = 51.0
|
||||
offset_bottom = -15.0
|
||||
theme_override_constants/separation = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="RewardText" type="Label" parent="RewardInfo"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "bla"
|
||||
label_settings = SubResource("LabelSettings_v08i5")
|
||||
|
||||
[node name="RewardIcon" type="TextureRect" parent="RewardInfo"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
texture = ExtResource("5_6uhem")
|
||||
expand_mode = 2
|
||||
37
entities/objectives/scripts/objective.gd
Normal file
@ -0,0 +1,37 @@
|
||||
extends InspectableEntity
|
||||
class_name Objective
|
||||
|
||||
const RANDOM_MAX_OBJECTIVE_INTERVAL = 1.
|
||||
|
||||
var completed : bool = false
|
||||
var planet : Planet
|
||||
@export var reward : ObjectiveReward = null :
|
||||
set(r):
|
||||
reward = r
|
||||
update_reward_info(r)
|
||||
|
||||
func _ready():
|
||||
update_reward_info(reward)
|
||||
|
||||
func pointer_text():
|
||||
return "Contamination Objective"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text(),
|
||||
"If the zone around is decontaminated, give the following reward.\n\n" + reward.get_description(),
|
||||
)
|
||||
|
||||
func _end_pass_day():
|
||||
if planet and not completed:
|
||||
if not planet.is_there_contamination(global_position):
|
||||
reward.reward(self)
|
||||
%AnimationPlayer.play("activate")
|
||||
%RewardInfo.visible = false
|
||||
completed = true
|
||||
|
||||
func update_reward_info(r : ObjectiveReward):
|
||||
if r:
|
||||
%RewardText.text = r.get_text()
|
||||
%RewardIcon.texture = r.get_icon()
|
||||
%RewardInfo.visible = r != null
|
||||
1
entities/objectives/scripts/objective.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://j8fpi8rd8eyy
|
||||
14
entities/objectives/scripts/objective_reward.gd
Normal file
@ -0,0 +1,14 @@
|
||||
extends Resource
|
||||
class_name ObjectiveReward
|
||||
|
||||
func reward(_objective : Objective):
|
||||
pass
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return null
|
||||
|
||||
func get_text() -> String:
|
||||
return ""
|
||||
|
||||
func get_description() -> String:
|
||||
return ""
|
||||
1
entities/objectives/scripts/objective_reward.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://bsh4b8miag8w1
|
||||
@ -0,0 +1,19 @@
|
||||
extends ObjectiveReward
|
||||
class_name IncreaseDayLimitReward
|
||||
|
||||
@export var day_limit_increase = 5
|
||||
|
||||
func _init(_day_limit_increase : int):
|
||||
day_limit_increase = _day_limit_increase
|
||||
|
||||
func reward(objective : Objective):
|
||||
objective.planet.day_limit += day_limit_increase
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/hourglass-empty.svg")
|
||||
|
||||
func get_text() -> String:
|
||||
return "+"+str(day_limit_increase)
|
||||
|
||||
func get_description() -> String:
|
||||
return "Increase the day limitation by " + str(day_limit_increase) + "."
|
||||
@ -0,0 +1 @@
|
||||
uid://df6i1hivw4ymn
|
||||
25
entities/objectives/scripts/rewards/loot_item_reward.gd
Normal file
@ -0,0 +1,25 @@
|
||||
extends ObjectiveReward
|
||||
class_name LootItemReward
|
||||
|
||||
const REWARD_ITEM_RANDOM_DISPLACEMENT_FACTOR = 100
|
||||
|
||||
@export var item : Item
|
||||
|
||||
func _init(i : Item):
|
||||
item = i
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/package.svg")
|
||||
|
||||
func get_text() -> String:
|
||||
return ""
|
||||
|
||||
func get_description() -> String:
|
||||
return "Loot the following item: " + item.name + "."
|
||||
|
||||
func reward(objective : Objective):
|
||||
objective.planet.drop_item(
|
||||
item,
|
||||
objective.global_position,
|
||||
REWARD_ITEM_RANDOM_DISPLACEMENT_FACTOR
|
||||
)
|
||||
@ -0,0 +1 @@
|
||||
uid://dva05p817w00f
|
||||
@ -0,0 +1 @@
|
||||
uid://dot5gfkbm7p6s
|
||||
@ -0,0 +1,26 @@
|
||||
extends ObjectiveReward
|
||||
class_name LootRandomSeedsReward
|
||||
|
||||
const REWARD_SEED_RANDOM_DISPLACEMENT_FACTOR = 100
|
||||
|
||||
@export var seeds_number : int
|
||||
|
||||
func _init(number : int):
|
||||
seeds_number = number
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/seedling.svg")
|
||||
|
||||
func get_text() -> String:
|
||||
return str(seeds_number)
|
||||
|
||||
func get_description() -> String:
|
||||
return "Loot " + str(seeds_number) + " random seeds."
|
||||
|
||||
func reward(objective : Objective):
|
||||
for i in range(seeds_number):
|
||||
objective.planet.drop_item(
|
||||
Seed.new(GameInfo.game_data.unlocked_plant_types_path.pick_random()),
|
||||
objective.global_position,
|
||||
REWARD_SEED_RANDOM_DISPLACEMENT_FACTOR
|
||||
)
|
||||
@ -0,0 +1 @@
|
||||
uid://bcdilfb4j7f6d
|
||||
@ -0,0 +1,19 @@
|
||||
extends ObjectiveReward
|
||||
class_name RechargePlayerReward
|
||||
|
||||
@export var recharge_amount = 1
|
||||
|
||||
func _init(_recharge_amount : int = 1):
|
||||
recharge_amount = _recharge_amount
|
||||
|
||||
func reward(objective : Objective):
|
||||
objective.planet.player.recharge(recharge_amount)
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/bolt.svg")
|
||||
|
||||
func get_text() -> String:
|
||||
return "+"+str(recharge_amount)+" "
|
||||
|
||||
func get_description() -> String:
|
||||
return "Recharge player energy by " + str(recharge_amount) + "."
|
||||
@ -0,0 +1 @@
|
||||
uid://4ak4kre3emnd
|
||||
@ -0,0 +1,19 @@
|
||||
extends ObjectiveReward
|
||||
class_name UpgradePlayerMaxEnergyReward
|
||||
|
||||
@export var upgrade_amount = 1
|
||||
|
||||
func _init(_upgrade_amount : int = 1):
|
||||
upgrade_amount = _upgrade_amount
|
||||
|
||||
func reward(objective : Objective):
|
||||
objective.planet.player.upgrade_max_energy(upgrade_amount)
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/bolt.svg")
|
||||
|
||||
func get_text() -> String:
|
||||
return "+"+str(upgrade_amount)+" max"
|
||||
|
||||
func get_description() -> String:
|
||||
return "Increase player max energy by " + str(upgrade_amount) + "."
|
||||
@ -0,0 +1 @@
|
||||
uid://cflvw3bfcocnn
|
||||
BIN
entities/plants/assets/sprites/champ/growing.png
Normal file
|
After Width: | Height: | Size: 66 KiB |
@ -2,16 +2,16 @@
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cpx7bkrvttasr"
|
||||
path="res://.godot/imported/planted.png-4bf3c8ff7d8aae08d7e3691f7e49cab2.ctex"
|
||||
uid="uid://dmsls8siudy1u"
|
||||
path="res://.godot/imported/growing.png-1974f3b5dd8b515f2458ee84afbec1aa.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/plants/assets/sprites/maias/planted.png"
|
||||
dest_files=["res://.godot/imported/planted.png-4bf3c8ff7d8aae08d7e3691f7e49cab2.ctex"]
|
||||
source_file="res://entities/plants/assets/sprites/champ/growing.png"
|
||||
dest_files=["res://.godot/imported/growing.png-1974f3b5dd8b515f2458ee84afbec1aa.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
BIN
entities/plants/assets/sprites/champ/mature.png
Normal file
|
After Width: | Height: | Size: 138 KiB |
@ -2,16 +2,16 @@
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ba413oun7ry78"
|
||||
path="res://.godot/imported/planted.png-2c23372e71d0997d310374f47bb48594.ctex"
|
||||
uid="uid://crc4aop6ajiau"
|
||||
path="res://.godot/imported/mature.png-44f597dc7980e7657c7418444db3823d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/plants/assets/sprites/default/planted.png"
|
||||
dest_files=["res://.godot/imported/planted.png-2c23372e71d0997d310374f47bb48594.ctex"]
|
||||
source_file="res://entities/plants/assets/sprites/champ/mature.png"
|
||||
dest_files=["res://.godot/imported/mature.png-44f597dc7980e7657c7418444db3823d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c7mp7tkkkk6o5"
|
||||
path="res://.godot/imported/growing.png-3f6fb3171589f3a22ebfeda1a4575199.ctex"
|
||||
path="res://.godot/imported/growing.png-c0d45a498c8bfc90776eb09d341d1579.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/plants/assets/sprites/default/growing.png"
|
||||
dest_files=["res://.godot/imported/growing.png-3f6fb3171589f3a22ebfeda1a4575199.ctex"]
|
||||
source_file="res://entities/plants/assets/sprites/chardi/growing.png"
|
||||
dest_files=["res://.godot/imported/growing.png-c0d45a498c8bfc90776eb09d341d1579.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 149 KiB |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bupl1y0cfj21q"
|
||||
path="res://.godot/imported/mature.png-f8b2b72a84e90cfc6bf925d1d48f7f7e.ctex"
|
||||
path="res://.godot/imported/mature.png-a98b30ab80fe074a42994ef9926caee8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/plants/assets/sprites/default/mature.png"
|
||||
dest_files=["res://.godot/imported/mature.png-f8b2b72a84e90cfc6bf925d1d48f7f7e.ctex"]
|
||||
source_file="res://entities/plants/assets/sprites/chardi/mature.png"
|
||||
dest_files=["res://.godot/imported/mature.png-a98b30ab80fe074a42994ef9926caee8.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 16 KiB |
BIN
entities/plants/assets/sprites/pili/growing.png
Normal file
|
After Width: | Height: | Size: 124 KiB |
34
entities/plants/assets/sprites/pili/growing.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://xw47qw12d3dv"
|
||||
path="res://.godot/imported/growing.png-7be6e2a77303b5664c0684cf483c0282.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/plants/assets/sprites/pili/growing.png"
|
||||
dest_files=["res://.godot/imported/growing.png-7be6e2a77303b5664c0684cf483c0282.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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
|
||||
BIN
entities/plants/assets/sprites/pili/mature.png
Normal file
|
After Width: | Height: | Size: 142 KiB |
34
entities/plants/assets/sprites/pili/mature.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://4mh1w1f4q2sa"
|
||||
path="res://.godot/imported/mature.png-3ebeca7244c928b51a02f8a43277f4d4.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/plants/assets/sprites/pili/mature.png"
|
||||
dest_files=["res://.godot/imported/mature.png-3ebeca7244c928b51a02f8a43277f4d4.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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,14 +1,21 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://2hrg6yjk0yt0"]
|
||||
[gd_scene load_steps=10 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://b3wom2xu26g43" path="res://entities/plants/assets/sprites/default_plant_glowing.png" id="2_hyinx"]
|
||||
[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)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wyuub"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:scale")
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
@ -20,7 +27,7 @@ tracks/0/keys = {
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D:skew")
|
||||
tracks/1/path = NodePath("Sprite:skew")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
@ -32,7 +39,7 @@ tracks/1/keys = {
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Sprite2D:modulate")
|
||||
tracks/2/path = NodePath("Sprite:modulate")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
@ -44,15 +51,15 @@ tracks/2/keys = {
|
||||
|
||||
[sub_resource type="Animation" id="Animation_j6jm5"]
|
||||
resource_name = "bump"
|
||||
length = 0.5
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:scale")
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2, 0.5),
|
||||
"times": PackedFloat32Array(0, 0.1, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.15, 0.15), Vector2(0.15, 0.075), Vector2(0.15, 0.15)]
|
||||
@ -64,7 +71,7 @@ length = 0.2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:skew")
|
||||
tracks/0/path = NodePath("Sprite:skew")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
@ -76,7 +83,7 @@ tracks/0/keys = {
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D:modulate")
|
||||
tracks/1/path = NodePath("Sprite:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
@ -96,9 +103,24 @@ _data = {
|
||||
[node name="PlantSprite" type="Node2D"]
|
||||
script = ExtResource("1_pq8o7")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
scale = Vector2(0.15, 0.15)
|
||||
texture = ExtResource("2_hyinx")
|
||||
texture = SubResource("CompressedTexture2D_rbgiq")
|
||||
|
||||
[node name="PlantedSeed" type="Sprite2D" parent="Sprite"]
|
||||
unique_name_in_owner = true
|
||||
scale = Vector2(1.5, 1.5)
|
||||
texture = SubResource("AtlasTexture_wyuub")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(0, -50, 124, 135)
|
||||
region_filter_clip_enabled = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Sprite/PlantedSeed"]
|
||||
modulate = Color(0.14902, 0.172549, 0.270588, 1)
|
||||
position = Vector2(0, 62.2222)
|
||||
scale = Vector2(0.426047, 0.430108)
|
||||
texture = ExtResource("4_j6jm5")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
[gd_resource type="Resource" script_class="DecontaminateTerrainEffect" load_steps=2 format=3 uid="uid://bdddlia6qxgf2"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cgscbuxe4dawb" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="1_8l07v"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_8l07v")
|
||||
impact_radius = 50
|
||||
metadata/_custom_type_script = "uid://cgscbuxe4dawb"
|
||||
29
entities/plants/resources/plant_types/champ.tres
Normal file
@ -0,0 +1,29 @@
|
||||
[gd_resource type="Resource" script_class="PlantType" load_steps=8 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="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"]
|
||||
script = ExtResource("1_cf34j")
|
||||
produce_types_path = Array[String](["uid://cxrc5wchpqm18", "uid://b04vho33bl52b", "uid://dsctivn1vrem2", "uid://b04vho33bl52b"])
|
||||
produce_number = Array[int]([1, 2])
|
||||
metadata/_custom_type_script = "uid://ceqx5va1ormau"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_my6by"]
|
||||
atlas = ExtResource("6_liopn")
|
||||
region = Rect2(610, 315, 124, 180)
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_ipcpv")
|
||||
name = "Champ"
|
||||
description = "When mature, produce seeds every day."
|
||||
growing_time = 1
|
||||
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"])
|
||||
metadata/_custom_type_script = "uid://jnye5pe1bgqw"
|
||||
@ -1,15 +1,15 @@
|
||||
[gd_resource type="Resource" script_class="PlantType" load_steps=9 format=3 uid="uid://b04vho33bl52b"]
|
||||
[gd_resource type="Resource" script_class="PlantType" load_steps=8 format=3 uid="uid://b04vho33bl52b"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://c7mp7tkkkk6o5" path="res://entities/plants/assets/sprites/default/growing.png" id="1_fp5j6"]
|
||||
[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="1_moyj3"]
|
||||
[ext_resource type="Script" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="2_cky1j"]
|
||||
[ext_resource type="Texture2D" uid="uid://bupl1y0cfj21q" path="res://entities/plants/assets/sprites/default/mature.png" id="3_ffarr"]
|
||||
[ext_resource type="Texture2D" uid="uid://ba413oun7ry78" path="res://entities/plants/assets/sprites/default/planted.png" id="4_2s6re"]
|
||||
[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="Texture2D" uid="uid://bupl1y0cfj21q" path="res://entities/plants/assets/sprites/chardi/mature.png" id="3_40c3e"]
|
||||
[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_q68uy"]
|
||||
[sub_resource type="Resource" id="Resource_c76qk"]
|
||||
script = ExtResource("2_cky1j")
|
||||
impact_radius = 150
|
||||
improve_by_lifetime_max = 300
|
||||
metadata/_custom_type_script = "uid://cgscbuxe4dawb"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qt76e"]
|
||||
@ -22,10 +22,9 @@ name = "Chardi"
|
||||
description = "This plant remove a lot of contamination around when it becomes mature."
|
||||
growing_time = 1
|
||||
seed_texture = SubResource("AtlasTexture_qt76e")
|
||||
planted_texture = ExtResource("4_2s6re")
|
||||
growing_texture = ExtResource("1_fp5j6")
|
||||
mature_texture = ExtResource("3_ffarr")
|
||||
mature_effect = SubResource("Resource_q68uy")
|
||||
harvest_types_path = Array[String]([])
|
||||
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])
|
||||
metadata/_custom_type_script = "uid://jnye5pe1bgqw"
|
||||
@ -1,10 +1,9 @@
|
||||
[gd_resource type="Resource" script_class="PlantType" load_steps=9 format=3 uid="uid://dsctivn1vrem2"]
|
||||
[gd_resource type="Resource" script_class="PlantType" load_steps=8 format=3 uid="uid://dsctivn1vrem2"]
|
||||
|
||||
[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" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="2_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="Texture2D" uid="uid://d3apfwbqsg5ha" path="res://entities/plants/assets/sprites/maias/mature.png" id="3_pi4ie"]
|
||||
[ext_resource type="Texture2D" uid="uid://cpx7bkrvttasr" path="res://entities/plants/assets/sprites/maias/planted.png" id="4_iqcy2"]
|
||||
[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"]
|
||||
@ -19,10 +18,9 @@ region = Rect2(1697, 331, 125, 158)
|
||||
[resource]
|
||||
script = ExtResource("1_eqtut")
|
||||
name = "Maias"
|
||||
description = "This gorgeous flower produce a lot of seeds."
|
||||
description = "This gorgeous flower produce a lot of seeds of Maias and Chardi when harvested."
|
||||
growing_time = 1
|
||||
seed_texture = SubResource("AtlasTexture_sri3b")
|
||||
planted_texture = ExtResource("4_iqcy2")
|
||||
growing_texture = ExtResource("1_vyplc")
|
||||
mature_texture = ExtResource("3_pi4ie")
|
||||
mature_effect = SubResource("Resource_q4pje")
|
||||
|
||||
31
entities/plants/resources/plant_types/pili.tres
Normal file
@ -0,0 +1,31 @@
|
||||
[gd_resource type="Resource" script_class="PlantType" load_steps=8 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://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="1_vn146"]
|
||||
[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="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
|
||||
improve_by_lifetime_max = 300
|
||||
metadata/_custom_type_script = "uid://cgscbuxe4dawb"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_kidty"]
|
||||
atlas = ExtResource("5_26e4l")
|
||||
region = Rect2(1415, 91, 149, 102)
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_vn146")
|
||||
name = "Pili"
|
||||
description = "Pili slowly decontaminate each day when mature."
|
||||
growing_time = 1
|
||||
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"])
|
||||
metadata/_custom_type_script = "uid://jnye5pe1bgqw"
|
||||
@ -2,7 +2,7 @@ extends InspectableEntity
|
||||
class_name Plant
|
||||
|
||||
const PLANT_AREA_WIDTH = 20
|
||||
const HARVESTED_SEED_POSITION_RANGE = 100
|
||||
const HARVESTED_SEED_DISPLACEMENT_FACTOR = 100
|
||||
|
||||
const RANDOM_MAX_GROW_INTERVAL = Planet.PASS_DAY_ANIMATION_TIME/2. - 0.1
|
||||
|
||||
@ -23,19 +23,23 @@ func _init(_plant_type = null, _planet = null):
|
||||
plant_type = _plant_type
|
||||
planet = _planet
|
||||
|
||||
func inspected_text():
|
||||
func pointer_text():
|
||||
var state_text = "Growing"
|
||||
if state == State.MATURE: state_text = "Mature"
|
||||
return state_text + " " + plant_type.name
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text(),
|
||||
plant_type.description,
|
||||
plant_type.mature_texture
|
||||
)
|
||||
|
||||
func generate_sprite() -> PlantSprite:
|
||||
var spriteObject : PlantSprite = SPRITE_SCENE.instantiate()
|
||||
|
||||
add_child(spriteObject)
|
||||
spriteObject.apply_texture_to_sprite(
|
||||
get_state_texture(state),
|
||||
false
|
||||
)
|
||||
spriteObject.update_plant_sprite(self)
|
||||
|
||||
return spriteObject
|
||||
|
||||
@ -52,6 +56,10 @@ func generate_collision_shape() -> CollisionShape2D:
|
||||
# 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)
|
||||
|
||||
day += 1
|
||||
|
||||
func set_day(d):
|
||||
@ -71,19 +79,7 @@ func change_state(_state: State):
|
||||
if state == State.MATURE and plant_type.mature_effect:
|
||||
plant_type.mature_effect.effect(self)
|
||||
|
||||
plant_sprite.apply_texture_to_sprite(
|
||||
get_state_texture(state)
|
||||
)
|
||||
|
||||
func get_state_texture(s: State) -> Texture2D:
|
||||
match s:
|
||||
State.PLANTED:
|
||||
return plant_type.planted_texture
|
||||
State.GROWING:
|
||||
return plant_type.growing_texture
|
||||
State.MATURE:
|
||||
return plant_type.mature_texture
|
||||
return null
|
||||
plant_sprite.update_plant_sprite(self, true)
|
||||
|
||||
func harvest():
|
||||
if state == State.MATURE:
|
||||
@ -92,20 +88,11 @@ func harvest():
|
||||
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())
|
||||
var item_object = planet.drop_item(
|
||||
Seed.new(seed_plant_type),
|
||||
global_position
|
||||
)
|
||||
var tween : Tween = get_tree().create_tween()
|
||||
tween.tween_property(
|
||||
item_object,
|
||||
"position",
|
||||
Vector2(
|
||||
item_object.position.x + randi()%HARVESTED_SEED_POSITION_RANGE,
|
||||
item_object.position.y + randi()%HARVESTED_SEED_POSITION_RANGE
|
||||
),
|
||||
0.2
|
||||
)
|
||||
planet.drop_item(
|
||||
Seed.new(seed_plant_type),
|
||||
global_position,
|
||||
HARVESTED_SEED_DISPLACEMENT_FACTOR,
|
||||
)
|
||||
|
||||
plant_sprite.start_harvest_animation()
|
||||
await plant_sprite.harvest_animation_finished
|
||||
|
||||
@ -1,10 +1,19 @@
|
||||
extends PlantEffect
|
||||
class_name DecontaminateTerrainEffect
|
||||
|
||||
@export var impact_radius = 50
|
||||
@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 effect(plant):
|
||||
|
||||
var radius = impact_radius
|
||||
|
||||
if improve_by_lifetime:
|
||||
radius = min(radius + improve_by_lifetime_value * plant.day, improve_by_lifetime_max)
|
||||
|
||||
plant.planet.impact_contamination(
|
||||
plant.global_position,
|
||||
impact_radius
|
||||
radius
|
||||
)
|
||||