équilibrages, fix et évolutions
* résolution du bug de disparition des items #94 * améliorations définitives dans le camion via compost #88 * ajout de plus d'aléatoire dans le zone de départ * suppression des récompenses de quota (pour l'instant) * équilibrage du gain en graine * ajout de la clarté dans les actions
This commit is contained in:
parent
15175921c4
commit
f1ef41323a
@ -35,8 +35,6 @@ func all_plant_types() -> Array[PlantType]:
|
||||
|
||||
func all_machines() -> Array[MachineType]:
|
||||
return [
|
||||
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"),
|
||||
]
|
||||
|
||||
|
||||
@ -4,9 +4,8 @@ class_name PlanetData
|
||||
signal quota_number_updated(quota : int)
|
||||
signal contamination_updated(decontamination_surface : float)
|
||||
|
||||
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MAX_SIZE = 200.
|
||||
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE = 50.
|
||||
const DEFAULT_BASE_SIZE = Vector2(2000,2000)
|
||||
const MAX_DEFAULT_CONTAMINATION_ZONE_SURFACE = 3000
|
||||
const DEFAULT_BASE_SIZE = Vector2(1500,1500)
|
||||
|
||||
@export var base_size : Vector2 = Vector2(2000,2000)
|
||||
@export var contamination : TerrainData
|
||||
@ -19,8 +18,7 @@ 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,
|
||||
MAX_DEFAULT_CONTAMINATION_ZONE_SURFACE,
|
||||
base_size/2
|
||||
)
|
||||
contamination_updated.emit(get_decontamination_surface())
|
||||
@ -48,7 +46,7 @@ func get_decontamination_coverage() -> float:
|
||||
return contamination.get_value_coverage()
|
||||
|
||||
func get_decontamination_surface() -> float:
|
||||
return contamination.get_value_surface() * 10
|
||||
return contamination.get_value_surface()
|
||||
#endregion
|
||||
|
||||
#region ------------------ Objectives ------------------
|
||||
@ -81,7 +79,7 @@ func get_quota(n = 0) -> int:
|
||||
50,
|
||||
]
|
||||
|
||||
if n > len(first_quotas):
|
||||
if n >= len(first_quotas):
|
||||
return pow(n, 3)
|
||||
else:
|
||||
return first_quotas[n]
|
||||
|
||||
@ -16,16 +16,15 @@ func _init(terrain_size : Vector2):
|
||||
)
|
||||
|
||||
func draw_random_zone(
|
||||
zone_max_size : float,
|
||||
zone_min_size : float,
|
||||
zone_max_surface : 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
|
||||
noise.frequency = 0.01
|
||||
|
||||
var noise_image_size : Vector2i = Vector2i.ONE * zone_max_size / UNIT_PER_PIXEL
|
||||
var noise_image_size : Vector2i = Vector2i.ONE * (image_size)
|
||||
var noise_image_center = noise_image_size / 2
|
||||
|
||||
var noise_image = noise.get_image(
|
||||
@ -34,22 +33,28 @@ func draw_random_zone(
|
||||
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)
|
||||
|
||||
ImageTools.draw_circle(
|
||||
noise_image,
|
||||
noise_image_center,
|
||||
80/UNIT_PER_PIXEL,
|
||||
Color.WHITE,
|
||||
)
|
||||
|
||||
var random_step = 1
|
||||
var zone_radius = noise_image_size.x - random_step
|
||||
print(get_value_surface(noise_image))
|
||||
while get_value_surface(noise_image) > zone_max_surface:
|
||||
zone_radius -= random_step
|
||||
ImageTools.draw_circle(
|
||||
noise_image,
|
||||
noise_image_center,
|
||||
zone_radius,
|
||||
Color.BLACK,
|
||||
true
|
||||
)
|
||||
|
||||
image.blit_rect(
|
||||
noise_image,
|
||||
Rect2i(
|
||||
@ -86,15 +91,15 @@ func get_value(point : Vector2) -> float:
|
||||
).r
|
||||
return 0
|
||||
|
||||
func get_value_coverage() -> float:
|
||||
return ImageTools.get_color_coverage(image)
|
||||
func get_value_coverage(i : Image = image) -> float:
|
||||
return ImageTools.get_color_coverage(i)
|
||||
|
||||
func get_value_surface() -> float:
|
||||
return float(ImageTools.get_color_pixel_count(image)) / UNIT_PER_PIXEL
|
||||
func get_value_surface(i : Image = image) -> float:
|
||||
return float(ImageTools.get_color_pixel_count(i)) * UNIT_PER_PIXEL
|
||||
|
||||
func get_pixel_point(point : Vector2) -> Vector2i:
|
||||
var vec : Vector2 = Vector2(point) / UNIT_PER_PIXEL - Vector2.ONE
|
||||
return Vector2i(
|
||||
roundi(vec.x),
|
||||
roundi(vec.y)
|
||||
roundi(vec.x + 0.5),
|
||||
roundi(vec.y + 0.5)
|
||||
)
|
||||
|
||||
1
common/icons/bucket.svg
Normal file
1
common/icons/bucket.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-bucket"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 7m-8 0a8 4 0 1 0 16 0a8 4 0 1 0 -16 0" /><path d="M4 7c0 .664 .088 1.324 .263 1.965l2.737 10.035c.5 1.5 2.239 2 5 2s4.5 -.5 5 -2c.333 -1 1.246 -4.345 2.737 -10.035a7.45 7.45 0 0 0 .263 -1.965" /></svg>
|
||||
|
After Width: | Height: | Size: 506 B |
43
common/icons/bucket.svg.import
Normal file
43
common/icons/bucket.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bd6qddv5ihkjr"
|
||||
path="res://.godot/imported/bucket.svg-b324d7bdd4f8d0338862c0a1b53a000b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/bucket.svg"
|
||||
dest_files=["res://.godot/imported/bucket.svg-b324d7bdd4f8d0338862c0a1b53a000b.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
|
||||
@ -22,6 +22,9 @@ func get_energy_used() -> int:
|
||||
func get_usage_zone_radius() -> int:
|
||||
return usage_zone_radius
|
||||
|
||||
func get_usage_object_affected(_i : InspectableEntity) -> bool:
|
||||
return false
|
||||
|
||||
func is_one_time_use():
|
||||
return false
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ func _init(_machine_type : MachineType = null, _machine_level : int = 1):
|
||||
|
||||
func get_item_name() -> String:
|
||||
if machine_type:
|
||||
return machine_type.name + " level " + str(machine_level)
|
||||
return machine_type.name
|
||||
return ""
|
||||
|
||||
func get_description() -> String:
|
||||
|
||||
@ -25,6 +25,9 @@ func get_energy_used() -> int:
|
||||
func get_usage_zone_radius() -> int:
|
||||
return 30
|
||||
|
||||
func get_usage_object_affected(i : InspectableEntity) -> bool:
|
||||
return i is Plant
|
||||
|
||||
func _init(
|
||||
_plant_type : PlantType = null,
|
||||
_parent_mutation : Array[PlantMutation] = []
|
||||
@ -43,7 +46,7 @@ func can_use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
return false
|
||||
|
||||
var is_there_a_plant_here = false
|
||||
for area in zone.area.get_overlapping_areas() :
|
||||
for area in zone.get_affected_areas():
|
||||
if area is Plant:
|
||||
is_there_a_plant_here = true
|
||||
|
||||
|
||||
@ -19,11 +19,14 @@ func get_energy_used() -> int:
|
||||
func get_usage_zone_radius() -> int:
|
||||
return SHOVEL_ZONE_RADIUS
|
||||
|
||||
func get_usage_object_affected(i : InspectableEntity) -> bool:
|
||||
return i is Plant or i is UndergroundLoot
|
||||
|
||||
func use_text() -> String:
|
||||
return "Dig"
|
||||
|
||||
func can_use(_player : Player, zone : Player.ActionZone) -> bool:
|
||||
var areas = zone.area.get_overlapping_areas()
|
||||
var areas = zone.get_affected_areas()
|
||||
for area in areas :
|
||||
if area is Plant or area is UndergroundLoot:
|
||||
return true
|
||||
@ -31,7 +34,7 @@ func can_use(_player : Player, zone : Player.ActionZone) -> bool:
|
||||
|
||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
dig(
|
||||
zone.area.get_overlapping_areas(),
|
||||
zone.get_affected_areas(),
|
||||
player
|
||||
)
|
||||
|
||||
@ -42,7 +45,8 @@ func dig(areas: Array[Area2D], player: Player):
|
||||
if area and area is Plant:
|
||||
player.play_sfx("harvest")
|
||||
area.harvest()
|
||||
await player.get_tree().create_timer(USE_INTERVAL).timeout
|
||||
if area and area is UndergroundLoot:
|
||||
player.play_sfx("dig")
|
||||
area.dig()
|
||||
await player.get_tree().create_timer(USE_INTERVAL).timeout
|
||||
await player.get_tree().create_timer(USE_INTERVAL).timeout
|
||||
|
||||
@ -11,12 +11,12 @@ static func get_color_pixel_count(image: Image, color: Color = Color.WHITE) -> i
|
||||
pixel_color_count += 1.
|
||||
return pixel_color_count
|
||||
|
||||
static func draw_circle(image: Image, center: Vector2i, length: int, color: Color = Color.WHITE):
|
||||
static func draw_circle(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 center_distance = Vector2i(x, y).distance_to(center)
|
||||
|
||||
if (center_distance <= length):
|
||||
if not inverse and (center_distance <= length) or inverse and (center_distance > length):
|
||||
image.set_pixel(x, y, color)
|
||||
|
||||
|
||||
|
||||
62
common/vfx/materials/shaders/outline.gdshader
Normal file
62
common/vfx/materials/shaders/outline.gdshader
Normal file
@ -0,0 +1,62 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform vec4 color : source_color = vec4(1.0);
|
||||
uniform float width : hint_range(0, 10) = 1.0;
|
||||
uniform int pattern : hint_range(0, 2) = 0; // diamond, circle, square
|
||||
uniform bool inside = false;
|
||||
uniform bool add_margins = true; // only useful when inside is false
|
||||
|
||||
void vertex() {
|
||||
if (add_margins) {
|
||||
VERTEX += (UV * 2.0 - 1.0) * width;
|
||||
}
|
||||
}
|
||||
|
||||
bool hasContraryNeighbour(vec2 uv, vec2 texture_pixel_size, sampler2D texture) {
|
||||
for (float i = -ceil(width); i <= ceil(width); i++) {
|
||||
float x = abs(i) > width ? width * sign(i) : i;
|
||||
float offset;
|
||||
|
||||
if (pattern == 0) {
|
||||
offset = width - abs(x);
|
||||
} else if (pattern == 1) {
|
||||
offset = floor(sqrt(pow(width + 0.5, 2) - x * x));
|
||||
} else if (pattern == 2) {
|
||||
offset = width;
|
||||
}
|
||||
|
||||
for (float j = -ceil(offset); j <= ceil(offset); j++) {
|
||||
float y = abs(j) > offset ? offset * sign(j) : j;
|
||||
vec2 xy = uv + texture_pixel_size * vec2(x, y);
|
||||
|
||||
if ((xy != clamp(xy, vec2(0.0), vec2(1.0)) || texture(texture, xy).a <= 0.0) == inside) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec2 uv = UV;
|
||||
|
||||
if (add_margins) {
|
||||
vec2 texture_pixel_size = vec2(1.0) / (vec2(1.0) / TEXTURE_PIXEL_SIZE + vec2(width * 2.0));
|
||||
|
||||
uv = (uv - texture_pixel_size * width) * TEXTURE_PIXEL_SIZE / texture_pixel_size;
|
||||
|
||||
if (uv != clamp(uv, vec2(0.0), vec2(1.0))) {
|
||||
COLOR.a = 0.0;
|
||||
} else {
|
||||
COLOR = texture(TEXTURE, uv);
|
||||
}
|
||||
} else {
|
||||
COLOR = texture(TEXTURE, uv);
|
||||
}
|
||||
|
||||
if ((COLOR.a > 0.0) == inside && hasContraryNeighbour(uv, TEXTURE_PIXEL_SIZE, TEXTURE)) {
|
||||
COLOR.rgb = inside ? mix(COLOR.rgb, color.rgb, color.a) : color.rgb;
|
||||
COLOR.a += (1.0 - COLOR.a) * color.a;
|
||||
}
|
||||
}
|
||||
1
common/vfx/materials/shaders/outline.gdshader.uid
Normal file
1
common/vfx/materials/shaders/outline.gdshader.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://bt4t4qrug135
|
||||
55
common/vfx/materials/shaders/skew.gdshader
Normal file
55
common/vfx/materials/shaders/skew.gdshader
Normal file
@ -0,0 +1,55 @@
|
||||
// Hey this is Hei! This shader "fakes" a 3D-camera perspective on CanvasItems.
|
||||
// License: MIT
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
// Camera FOV
|
||||
uniform float fov : hint_range(1, 179) = 90;
|
||||
uniform bool cull_back = true;
|
||||
uniform float y_rot : hint_range(-180, 180) = 0.0;
|
||||
uniform float x_rot : hint_range(-180, 180) = 0.0;
|
||||
// At 0, the image retains its size when unrotated.
|
||||
// At 1, the image is resized so that it can do a full
|
||||
// rotation without clipping inside its rect.
|
||||
uniform float inset : hint_range(0, 1) = 0.0;
|
||||
// Consider changing this to a uniform and changing it from code
|
||||
|
||||
varying flat vec2 o;
|
||||
varying vec3 p;
|
||||
|
||||
// Creates rotation matrix
|
||||
void vertex(){
|
||||
float sin_b = sin(y_rot / 180.0 * PI);
|
||||
float cos_b = cos(y_rot / 180.0 * PI);
|
||||
float sin_c = sin(x_rot / 180.0 * PI);
|
||||
float cos_c = cos(x_rot / 180.0 * PI);
|
||||
|
||||
mat3 inv_rot_mat;
|
||||
inv_rot_mat[0][0] = cos_b;
|
||||
inv_rot_mat[0][1] = 0.0;
|
||||
inv_rot_mat[0][2] = -sin_b;
|
||||
|
||||
inv_rot_mat[1][0] = sin_b * sin_c;
|
||||
inv_rot_mat[1][1] = cos_c;
|
||||
inv_rot_mat[1][2] = cos_b * sin_c;
|
||||
|
||||
inv_rot_mat[2][0] = sin_b * cos_c;
|
||||
inv_rot_mat[2][1] = -sin_c;
|
||||
inv_rot_mat[2][2] = cos_b * cos_c;
|
||||
|
||||
|
||||
float t = tan(fov / 360.0 * PI);
|
||||
p = inv_rot_mat * vec3((UV - 0.5), 0.5 / t);
|
||||
float v = (0.5 / t) + 0.5;
|
||||
p.xy *= v * inv_rot_mat[2].z;
|
||||
o = v * inv_rot_mat[2].xy;
|
||||
|
||||
VERTEX += (UV - 0.5) / TEXTURE_PIXEL_SIZE * t * (1.0 - inset);
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
if (cull_back && p.z <= 0.0) discard;
|
||||
vec2 uv = (p.xy / p.z).xy - o;
|
||||
COLOR = texture(TEXTURE, uv + 0.5);
|
||||
COLOR.a *= step(max(abs(uv.x), abs(uv.y)), 0.5);
|
||||
}
|
||||
1
common/vfx/materials/shaders/skew.gdshader.uid
Normal file
1
common/vfx/materials/shaders/skew.gdshader.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://bqjwmomh851lc
|
||||
@ -1,10 +0,0 @@
|
||||
[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_types/energy_compost.tscn" id="1_sy5wj"]
|
||||
[ext_resource type="Script" uid="uid://bhncww816fjsb" path="res://entities/interactables/machines/scripts/machine_info.gd" id="2_m8wft"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_m8wft")
|
||||
name = "Energy Compost"
|
||||
scene = ExtResource("1_sy5wj")
|
||||
description = "Can generate temporary energy in exchange of seeds."
|
||||
@ -1,65 +0,0 @@
|
||||
[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://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="CircleShape2D" id="CircleShape2D_6kmun"]
|
||||
radius = 51.884487
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_m2a0h"]
|
||||
font = ExtResource("3_y0cke")
|
||||
font_size = 23
|
||||
|
||||
[sub_resource type="Animation" id="Animation_r6435"]
|
||||
length = 0.001
|
||||
|
||||
[sub_resource type="Animation" id="Animation_1758a"]
|
||||
resource_name = "empty"
|
||||
length = 0.5
|
||||
|
||||
[sub_resource type="Animation" id="Animation_etofw"]
|
||||
resource_name = "fill"
|
||||
length = 0.3
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_etofw"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_r6435"),
|
||||
&"empty": SubResource("Animation_1758a"),
|
||||
&"fill": SubResource("Animation_etofw")
|
||||
}
|
||||
|
||||
[node name="EnergyCompost" type="Area2D"]
|
||||
script = ExtResource("1_2s0lp")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_6kmun")
|
||||
|
||||
[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="ContainerCount" type="Label" parent="."]
|
||||
unique_name_in_owner = true
|
||||
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="."]
|
||||
modulate = Color(0.140831, 0.20012599, 0.3145095, 1)
|
||||
z_index = 1
|
||||
position = Vector2(-41.999996, 36)
|
||||
scale = Vector2(0.5833337, 0.5833337)
|
||||
texture = ExtResource("3_85qj7")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_etofw")
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
[gd_resource type="Resource" script_class="MachineType" load_steps=3 format=3 uid="uid://bbaiexmnroxos"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://b13debm055r3t" path="res://entities/interactables/machines/compost/compost_types/seed_compost.tscn" id="1_vpkcm"]
|
||||
[ext_resource type="Script" uid="uid://bhncww816fjsb" path="res://entities/interactables/machines/scripts/machine_info.gd" id="2_tfoq0"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_tfoq0")
|
||||
name = "Seed Compost"
|
||||
scene = ExtResource("1_vpkcm")
|
||||
description = "Give random seed if is filled with seeds."
|
||||
metadata/_custom_type_script = "uid://bhncww816fjsb"
|
||||
@ -1,65 +0,0 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://b13debm055r3t"]
|
||||
|
||||
[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="CircleShape2D" id="CircleShape2D_6kmun"]
|
||||
radius = 51.884487
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_m2a0h"]
|
||||
font = ExtResource("3_sw66v")
|
||||
font_size = 23
|
||||
|
||||
[sub_resource type="Animation" id="Animation_r6435"]
|
||||
length = 0.001
|
||||
|
||||
[sub_resource type="Animation" id="Animation_1758a"]
|
||||
resource_name = "empty"
|
||||
length = 0.5
|
||||
|
||||
[sub_resource type="Animation" id="Animation_etofw"]
|
||||
resource_name = "fill"
|
||||
length = 0.3
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_etofw"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_r6435"),
|
||||
&"empty": SubResource("Animation_1758a"),
|
||||
&"fill": SubResource("Animation_etofw")
|
||||
}
|
||||
|
||||
[node name="SeedCompost" type="Area2D"]
|
||||
script = ExtResource("1_s8eov")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_6kmun")
|
||||
|
||||
[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
|
||||
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="."]
|
||||
modulate = Color(0.140831, 0.20012599, 0.3145095, 1)
|
||||
z_index = 1
|
||||
position = Vector2(-41.999996, 36)
|
||||
scale = Vector2(0.5833337, 0.5833337)
|
||||
texture = ExtResource("3_s8eov")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_etofw")
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
extends Machine
|
||||
class_name Compost
|
||||
|
||||
@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:
|
||||
1: return 5
|
||||
2: return 4
|
||||
3: return 3
|
||||
_: return 2
|
||||
|
||||
func interact_text():
|
||||
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 interact(p : Player) -> bool:
|
||||
if not can_interact(p):
|
||||
return false
|
||||
|
||||
p.play_sfx("harvest")
|
||||
p.inventory.remove_current_item()
|
||||
containing_seed += 1
|
||||
if containing_seed >= get_seed_needed():
|
||||
$AnimationPlayer.play("empty")
|
||||
containing_seed = 0
|
||||
product(p)
|
||||
else:
|
||||
$AnimationPlayer.play("fill")
|
||||
|
||||
return true
|
||||
|
||||
func product(player : Player):
|
||||
pass
|
||||
@ -1,12 +0,0 @@
|
||||
extends Compost
|
||||
class_name EnergyCompost
|
||||
|
||||
func get_energy_production(l : int = level) -> int:
|
||||
match l:
|
||||
1: return 1
|
||||
2: return 1
|
||||
3: return 1
|
||||
_: return 1
|
||||
|
||||
func product(player : Player):
|
||||
player.recharge(get_energy_production())
|
||||
@ -1 +0,0 @@
|
||||
uid://bw2ckthka71y8
|
||||
@ -1,17 +0,0 @@
|
||||
extends Compost
|
||||
class_name SeedCompost
|
||||
|
||||
func get_seeds_production(l : int = level) -> int:
|
||||
match l:
|
||||
1: return 2
|
||||
2: return 2
|
||||
3: return 2
|
||||
_: return 1
|
||||
|
||||
func product(player : Player):
|
||||
for i in range(get_seeds_production()):
|
||||
player.terrain.drop_item(
|
||||
Seed.new(GameInfo.game_data.unlocked_plant_types.pick_random()),
|
||||
global_position,
|
||||
100
|
||||
)
|
||||
@ -1 +0,0 @@
|
||||
uid://d0yt8pd41j2os
|
||||
@ -1,24 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://cjo6ea86rfqbe"
|
||||
path="res://.godot/imported/compost_level_up.wav-18f25f0720265f21705081af070ef8cd.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/interactables/machines/compost/sounds/compost_level_up.wav"
|
||||
dest_files=["res://.godot/imported/compost_level_up.wav-18f25f0720265f21705081af070ef8cd.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=2
|
||||
@ -16,12 +16,12 @@ func setup_machine_info(machine_type : MachineType, _level : int = 1):
|
||||
func setup_machine_sprite():
|
||||
pass
|
||||
|
||||
func pointer_text():
|
||||
func pointer_text() -> String:
|
||||
return machine_name
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text() + " level " + str(level),
|
||||
pointer_text(),
|
||||
machine_desc
|
||||
)
|
||||
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://cjo6ea86rfqbe"
|
||||
path="res://.godot/imported/compost_level_up.wav-4dc4368c9a44be31c1f804b5f6512a8a.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/interactables/truck/compost/assets/sounds/compost_level_up.wav"
|
||||
dest_files=["res://.godot/imported/compost_level_up.wav-4dc4368c9a44be31c1f804b5f6512a8a.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=2
|
||||
|
Before Width: | Height: | Size: 999 KiB After Width: | Height: | Size: 999 KiB |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://n7hhyqhhtx0q"
|
||||
path="res://.godot/imported/compost.png-af443333eb9a31de9cc4cb40ab9c40c2.ctex"
|
||||
path="res://.godot/imported/compost.png-e03e492b1de4adb6f23b4a9bd2caffe2.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"]
|
||||
source_file="res://entities/interactables/truck/compost/assets/sprites/compost.png"
|
||||
dest_files=["res://.godot/imported/compost.png-e03e492b1de4adb6f23b4a9bd2caffe2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
@ -3,21 +3,23 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://f2rte5jc0psp"
|
||||
path="res://.godot/imported/compost.svg-f43ad0f7b40754d19aa7d5ea88e80cb8.ctex"
|
||||
path="res://.godot/imported/compost.svg-db0462cb8633aba19a85cbdfc7ac658c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/interactables/machines/compost/assets/sprites/compost.svg"
|
||||
dest_files=["res://.godot/imported/compost.svg-f43ad0f7b40754d19aa7d5ea88e80cb8.ctex"]
|
||||
source_file="res://entities/interactables/truck/compost/assets/sprites/compost.svg"
|
||||
dest_files=["res://.godot/imported/compost.svg-db0462cb8633aba19a85cbdfc7ac658c.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
|
||||
@ -25,6 +27,10 @@ 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
|
||||
147
entities/interactables/truck/compost/compost.tscn
Normal file
147
entities/interactables/truck/compost/compost.tscn
Normal file
@ -0,0 +1,147 @@
|
||||
[gd_scene load_steps=16 format=3 uid="uid://p2dkmy6xs31c"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dw6jgsasb2fe1" path="res://entities/interactables/truck/compost/scripts/compost.gd" id="1_ux0j5"]
|
||||
[ext_resource type="Texture2D" uid="uid://n7hhyqhhtx0q" path="res://entities/interactables/truck/compost/assets/sprites/compost.png" id="2_grq07"]
|
||||
[ext_resource type="Shader" uid="uid://bqjwmomh851lc" path="res://common/vfx/materials/shaders/skew.gdshader" id="3_grq07"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="4_ux0j5"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="5_65b0j"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_65b0j"]
|
||||
radius = 57.0
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_grq07"]
|
||||
shader = ExtResource("3_grq07")
|
||||
shader_parameter/fov = 1.0
|
||||
shader_parameter/cull_back = true
|
||||
shader_parameter/y_rot = 73.4370120382575
|
||||
shader_parameter/x_rot = -57.169994165575005
|
||||
shader_parameter/inset = 0.0
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_4hdev"]
|
||||
viewport_path = NodePath("CountViewPort")
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_8nmxn"]
|
||||
shader = ExtResource("3_grq07")
|
||||
shader_parameter/fov = 1.0
|
||||
shader_parameter/cull_back = true
|
||||
shader_parameter/y_rot = -50.112993830367486
|
||||
shader_parameter/x_rot = -40.629993379925
|
||||
shader_parameter/inset = 0.0
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_24qh8"]
|
||||
viewport_path = NodePath("IconViewPort")
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_kgjd8"]
|
||||
font = ExtResource("4_ux0j5")
|
||||
font_size = 30
|
||||
|
||||
[sub_resource type="Animation" id="Animation_65b0j"]
|
||||
resource_name = "empty"
|
||||
|
||||
[sub_resource type="Animation" id="Animation_8nmxn"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("..:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ux0j5"]
|
||||
resource_name = "bump"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("..:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.099999994, 0.16666669, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1), Vector2(1.195, 0.915), Vector2(0.81, 1.195), Vector2(1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_8nmxn"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_8nmxn"),
|
||||
&"bump": SubResource("Animation_ux0j5"),
|
||||
&"empty": SubResource("Animation_65b0j")
|
||||
}
|
||||
|
||||
[node name="Compost" type="Area2D"]
|
||||
script = ExtResource("1_ux0j5")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -3)
|
||||
shape = SubResource("CircleShape2D_65b0j")
|
||||
|
||||
[node name="SpriteGroup" type="Node2D" parent="."]
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="SpriteGroup"]
|
||||
unique_name_in_owner = true
|
||||
scale = Vector2(0.09, 0.09)
|
||||
texture = ExtResource("2_grq07")
|
||||
|
||||
[node name="CountTexture" type="Sprite2D" parent="SpriteGroup"]
|
||||
material = SubResource("ShaderMaterial_grq07")
|
||||
position = Vector2(34.000004, 18.000002)
|
||||
scale = Vector2(1.2352942, 1.2352942)
|
||||
texture = SubResource("ViewportTexture_4hdev")
|
||||
|
||||
[node name="IconTexture" type="Sprite2D" parent="SpriteGroup"]
|
||||
material = SubResource("ShaderMaterial_8nmxn")
|
||||
position = Vector2(-34.000004, 16.000002)
|
||||
scale = Vector2(0.50000006, 0.50000006)
|
||||
texture = SubResource("ViewportTexture_24qh8")
|
||||
|
||||
[node name="CountViewPort" type="SubViewport" parent="."]
|
||||
transparent_bg = true
|
||||
size = Vector2i(163, 34)
|
||||
|
||||
[node name="Count" type="Label" parent="CountViewPort"]
|
||||
unique_name_in_owner = true
|
||||
modulate = Color(0.0627451, 0.019607844, 0.22745098, 1)
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 6
|
||||
text = "5/3"
|
||||
label_settings = SubResource("LabelSettings_kgjd8")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="IconViewPort" type="SubViewport" parent="."]
|
||||
transparent_bg = true
|
||||
size = Vector2i(64, 64)
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="IconViewPort"]
|
||||
unique_name_in_owner = true
|
||||
modulate = Color(0.0627451, 0.019607844, 0.22745098, 1)
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 6
|
||||
texture = ExtResource("5_65b0j")
|
||||
expand_mode = 3
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
root_node = NodePath("../SpriteGroup/CountTexture")
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_8nmxn")
|
||||
}
|
||||
132
entities/interactables/truck/compost/scripts/compost.gd
Normal file
132
entities/interactables/truck/compost/scripts/compost.gd
Normal file
@ -0,0 +1,132 @@
|
||||
extends Interactable
|
||||
class_name Compost
|
||||
|
||||
const FILLED_ICON = preload("res://common/icons/bucket.svg")
|
||||
|
||||
signal rewarded(c : Compost)
|
||||
|
||||
var reward : Reward = null :
|
||||
set(r):
|
||||
reward = r
|
||||
update_info()
|
||||
var containing_seed : int = 0 :
|
||||
set(c):
|
||||
containing_seed = c
|
||||
update_info()
|
||||
|
||||
func _ready():
|
||||
update_info()
|
||||
|
||||
func pointer_text() -> String:
|
||||
return "Compost"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
var info = Inspector.Info.new(
|
||||
pointer_text(),
|
||||
"Fill this machine with seeds to get an reward",
|
||||
%Sprite.texture,
|
||||
)
|
||||
|
||||
if reward != null:
|
||||
info.framed_infos.append(
|
||||
Inspector.FramedInfo.new(
|
||||
"On filled",
|
||||
reward.desc(),
|
||||
FILLED_ICON,
|
||||
)
|
||||
)
|
||||
|
||||
return info
|
||||
|
||||
func update_info():
|
||||
%Count.text = "" if reward == null else "%d/%d" % [containing_seed, reward.get_seed_needed()]
|
||||
%Icon.texture = null if reward == null else reward.icon()
|
||||
|
||||
func interact_text():
|
||||
if reward:
|
||||
return "Put a seed (%d left)" % (reward.get_seed_needed() - containing_seed)
|
||||
else:
|
||||
return ""
|
||||
|
||||
func can_interact(p : Player) -> bool:
|
||||
return reward and p.inventory.get_item() and p.inventory.get_item() is Seed
|
||||
|
||||
func interact(p : Player) -> bool:
|
||||
if not can_interact(p):
|
||||
return false
|
||||
|
||||
p.play_sfx("harvest")
|
||||
p.inventory.remove_current_item()
|
||||
containing_seed += 1
|
||||
if containing_seed >= reward.get_seed_needed():
|
||||
containing_seed = 0
|
||||
reward.reward(p)
|
||||
rewarded.emit(self)
|
||||
%AnimationPlayer.play("bump")
|
||||
|
||||
return true
|
||||
|
||||
func product(_player : Player):
|
||||
pass
|
||||
|
||||
class Reward:
|
||||
|
||||
var seed_needed : int = 1
|
||||
|
||||
func _init(_seed_needed : int):
|
||||
seed_needed = _seed_needed
|
||||
|
||||
func reward(_p: Player):
|
||||
pass
|
||||
|
||||
func get_seed_needed() -> int:
|
||||
return seed_needed
|
||||
|
||||
func desc() -> String:
|
||||
return ""
|
||||
|
||||
func icon() -> Texture:
|
||||
return null
|
||||
|
||||
class UpgradeMaxEnergyReward extends Reward:
|
||||
func reward(p: Player):
|
||||
p.upgrade_max_energy(1)
|
||||
|
||||
func desc() -> String:
|
||||
return "Upgrade max energy"
|
||||
|
||||
func icon() -> Texture:
|
||||
return preload("res://common/icons/bolt.svg")
|
||||
|
||||
class UpgradeMaxInventoryReward extends Reward:
|
||||
func reward(p: Player):
|
||||
p.upgrade_inventory_size()
|
||||
|
||||
func desc() -> String:
|
||||
return "Upgrade max inventory size"
|
||||
|
||||
func icon() -> Texture:
|
||||
return preload("res://common/icons/backpack.svg")
|
||||
|
||||
class GiveItemReward extends Reward:
|
||||
|
||||
var item : Item
|
||||
|
||||
func _init(_seed_needed : int, _item : Item):
|
||||
item = _item
|
||||
seed_needed = _seed_needed
|
||||
|
||||
func reward(p: Player):
|
||||
print(item)
|
||||
if p.inventory.is_full():
|
||||
print("drop")
|
||||
p.terrain.drop_item(item, p.global_position, 10)
|
||||
else:
|
||||
print("give")
|
||||
p.pick_item(item)
|
||||
|
||||
func desc() -> String:
|
||||
return "Give the item %s" % item.get_item_name()
|
||||
|
||||
func icon() -> Texture:
|
||||
return item.icon
|
||||
@ -13,7 +13,7 @@ func interact(_p: Player) -> bool:
|
||||
func interact_text():
|
||||
return "Recharge"
|
||||
|
||||
func pointer_text():
|
||||
func pointer_text() -> String:
|
||||
return "Recharge Station"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
|
||||
@ -7,7 +7,7 @@ const DECONTAMINATION_ICON = preload("res://common/icons/skull.svg")
|
||||
var completed : bool = false
|
||||
@export var reward : ObjectiveReward = null
|
||||
|
||||
func pointer_text():
|
||||
func pointer_text() -> String:
|
||||
return "Contamination Objective"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
@ -31,5 +31,4 @@ func _end_pass_day():
|
||||
if not planet.is_there_contamination(global_position):
|
||||
reward.reward(self)
|
||||
%AnimationPlayer.play("activate")
|
||||
%RewardInfo.visible = false
|
||||
completed = true
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
[sub_resource type="Resource" id="Resource_40c3e"]
|
||||
script = ExtResource("2_prk5s")
|
||||
level = 2
|
||||
metadata/_custom_type_script = "uid://ceqx5va1ormau"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_k7yib"]
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
[sub_resource type="Resource" id="Resource_0ofiq"]
|
||||
script = ExtResource("2_rb4mq")
|
||||
level = 1
|
||||
level = 2
|
||||
metadata/_custom_type_script = "uid://ceqx5va1ormau"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_7wddl"]
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
[sub_resource type="Resource" id="Resource_1llfc"]
|
||||
script = ExtResource("2_740j2")
|
||||
level = 2
|
||||
level = 3
|
||||
metadata/_custom_type_script = "uid://ceqx5va1ormau"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_sri3b"]
|
||||
|
||||
@ -8,15 +8,16 @@
|
||||
[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"]
|
||||
[sub_resource type="Resource" id="Resource_kidty"]
|
||||
script = ExtResource("3_26e4l")
|
||||
level = 2
|
||||
metadata/_custom_type_script = "uid://ceqx5va1ormau"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_8fstu"]
|
||||
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)
|
||||
@ -29,6 +30,6 @@ default_growing_time = 3
|
||||
seed_texture = SubResource("AtlasTexture_kidty")
|
||||
growing_texture = ExtResource("2_k4b1k")
|
||||
mature_texture = ExtResource("3_8fstu")
|
||||
default_harvest_effects = Array[ExtResource("1_8fstu")]([SubResource("Resource_kidty"), null])
|
||||
default_cyclic_effects = Array[ExtResource("1_8fstu")]([SubResource("Resource_eytxu")])
|
||||
default_harvest_effects = Array[ExtResource("1_8fstu")]([SubResource("Resource_kidty")])
|
||||
default_mature_effects = Array[ExtResource("1_8fstu")]([SubResource("Resource_8fstu")])
|
||||
metadata/_custom_type_script = "uid://jnye5pe1bgqw"
|
||||
|
||||
@ -4,16 +4,14 @@
|
||||
[ext_resource type="Script" uid="uid://ceqx5va1ormau" path="res://entities/plants/scripts/plant_effects/produce_seeds.gd" id="2_1q5bp"]
|
||||
[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="2_x4nie"]
|
||||
[ext_resource type="Texture2D" uid="uid://c00jac2jlgdfu" path="res://entities/plants/assets/sprites/solita/growing.png" id="3_j4n5p"]
|
||||
[ext_resource type="Texture2D" uid="uid://b3wom2xu26g43" path="res://entities/plants/assets/sprites/solita/mature.png" id="4_njidq"]
|
||||
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_yn0yu"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_3fdsj"]
|
||||
script = ExtResource("2_1q5bp")
|
||||
level = 1
|
||||
level = 2
|
||||
metadata/_custom_type_script = "uid://ceqx5va1ormau"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_j4n5p"]
|
||||
metadata/__load_path__ = "res://entities/plants/assets/sprites/default_plant_glowing.png"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_auuc2"]
|
||||
atlas = ExtResource("6_yn0yu")
|
||||
region = Rect2(335, 74, 134, 142)
|
||||
@ -26,6 +24,6 @@ default_growing_time = 3
|
||||
default_plant_score = 2
|
||||
seed_texture = SubResource("AtlasTexture_auuc2")
|
||||
growing_texture = ExtResource("3_j4n5p")
|
||||
mature_texture = SubResource("Resource_j4n5p")
|
||||
mature_texture = ExtResource("4_njidq")
|
||||
default_harvest_effects = Array[ExtResource("1_mksys")]([SubResource("Resource_3fdsj")])
|
||||
metadata/_custom_type_script = "uid://jnye5pe1bgqw"
|
||||
|
||||
@ -44,7 +44,7 @@ func _init(
|
||||
|
||||
plant_mutations = _plant_mutations
|
||||
|
||||
func pointer_text():
|
||||
func pointer_text() -> String:
|
||||
var state_text = "Growing"
|
||||
if state == State.MATURE: state_text = "Mature"
|
||||
return state_text + " " + plant_type.name
|
||||
|
||||
@ -2,7 +2,7 @@ extends PlantEffect
|
||||
class_name DecontaminateTerrainEffect
|
||||
|
||||
func get_decontamination_radius():
|
||||
return 100 * level
|
||||
return 50 + 50 * level
|
||||
|
||||
func get_effect_name() -> String:
|
||||
return "Decontaminate"
|
||||
|
||||
@ -2,7 +2,7 @@ extends PlantEffect
|
||||
class_name ProduceSeedsEffect
|
||||
|
||||
func get_produce_number():
|
||||
return [level - 1, level, level + 1]
|
||||
return [level - 1, level]
|
||||
|
||||
func get_effect_name() -> String:
|
||||
return "Seed Production"
|
||||
|
||||
@ -13,11 +13,12 @@ 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()
|
||||
return "When mature, 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:
|
||||
|
||||
if plant.state != Plant.State.MATURE:
|
||||
return score
|
||||
return score + floori(plant.day / get_day_factor())
|
||||
@ -8,12 +8,14 @@ func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Intolerant"
|
||||
return "Elitist"
|
||||
|
||||
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
|
||||
return "When mature, 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:
|
||||
if plant.state != Plant.State.MATURE:
|
||||
return score
|
||||
var plant_count = 0
|
||||
|
||||
for area in plant.influence_zone.get_overlapping_areas():
|
||||
|
||||
@ -13,12 +13,14 @@ 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]
|
||||
return "When mature, 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:
|
||||
if plant.state != Plant.State.MATURE:
|
||||
return score
|
||||
var plant_count = 0
|
||||
|
||||
for area in plant.influence_zone.get_overlapping_areas():
|
||||
|
||||
@ -4,6 +4,7 @@ class_name Player
|
||||
const MAX_REACH = 100
|
||||
const HOLDING_ITEM_SPRITE_SIZE = 20.
|
||||
const DEFAULT_INVENTORY_SIZE = 2
|
||||
const DEFAULT_MAX_ENERGY = 2
|
||||
|
||||
signal player_updated(player: Player)
|
||||
signal upgraded
|
||||
@ -13,7 +14,7 @@ var planet : Planet :
|
||||
get(): return terrain if terrain is Planet else null
|
||||
@export var speed = 350
|
||||
|
||||
var max_energy : int = 3
|
||||
var max_energy : int = DEFAULT_MAX_ENERGY
|
||||
var has_just_received_instruction : bool = false # pour récupérer les zones dans les action_area, une frame doit être passée depuis la création de la zone
|
||||
|
||||
var controlling_player : bool = true :
|
||||
@ -80,8 +81,8 @@ func _process(_delta):
|
||||
|
||||
func _on_inventory_updated(_inventory: Inventory):
|
||||
var item : Item = inventory.get_item()
|
||||
setup_preview_zone(item)
|
||||
if item:
|
||||
setup_preview_zone(item.usage_zone_radius)
|
||||
var item_texture = item.icon
|
||||
%ItemSprite.texture = item_texture
|
||||
%ItemSprite.scale = Vector2(
|
||||
@ -151,29 +152,37 @@ func delete_item(item: Item):
|
||||
|
||||
func try_use_item(item : Item, use_position : Vector2):
|
||||
has_just_received_instruction = true
|
||||
setup_action_zone(use_position, item.usage_zone_radius)
|
||||
setup_action_zone(use_position, item)
|
||||
instruction = ItemActionInstruction.new(
|
||||
use_position,
|
||||
item
|
||||
)
|
||||
|
||||
func preview_can_use_item(item : Item) -> bool:
|
||||
return can_use_item_on_zone(item, preview_zone)
|
||||
func preview_could_use_item(item : Item) -> bool:
|
||||
return could_use_item_on_zone(item, preview_zone)
|
||||
|
||||
func could_use_item_on_zone(item : Item, zone: ActionZone) -> bool:
|
||||
return (
|
||||
inventory.has_item(item)
|
||||
and item.can_use(self, zone)
|
||||
)
|
||||
|
||||
func can_use_item_on_zone(item : Item, zone: ActionZone) -> bool:
|
||||
return (
|
||||
inventory.has_item(item)
|
||||
and (energy - item.energy_usage) >= 0
|
||||
and item.can_use(self, zone)
|
||||
could_use_item_on_zone(item, zone)
|
||||
and has_energy_to_use_item(item)
|
||||
)
|
||||
|
||||
func has_energy_to_use_item(item : Item):
|
||||
return (energy - item.energy_usage) >= 0
|
||||
|
||||
func use_item(item : Item):
|
||||
if can_use_item_on_zone(item, action_zone):
|
||||
var is_item_used = item.use(self, action_zone)
|
||||
if is_item_used:
|
||||
energy -= item.energy_usage
|
||||
if item.is_one_time_use():
|
||||
inventory.remove_current_item()
|
||||
inventory.remove_item(item)
|
||||
|
||||
func upgrade_max_energy(amount = 1):
|
||||
max_energy += amount
|
||||
@ -192,23 +201,31 @@ func recharge(amount : int = max_energy):
|
||||
func full_recharge():
|
||||
energy = max(energy, max_energy)
|
||||
|
||||
func generate_action_zone(radius : int = 0) -> ActionZone:
|
||||
var zone = ActionZone.new(radius)
|
||||
func generate_action_zone(item : Item) -> ActionZone:
|
||||
var zone = ActionZone.new(item)
|
||||
|
||||
get_parent().add_child(zone.area)
|
||||
if zone.area:
|
||||
get_parent().add_child(zone.area)
|
||||
|
||||
return zone
|
||||
|
||||
func setup_preview_zone(zone_radius : int) -> ActionZone:
|
||||
if preview_zone:
|
||||
func setup_preview_zone(item : Item) -> ActionZone:
|
||||
if preview_zone and preview_zone.item == item:
|
||||
return preview_zone
|
||||
elif preview_zone:
|
||||
preview_zone.destroy()
|
||||
preview_zone = generate_action_zone(zone_radius)
|
||||
|
||||
if item:
|
||||
preview_zone = generate_action_zone(item)
|
||||
else:
|
||||
preview_zone = null
|
||||
|
||||
return preview_zone
|
||||
|
||||
func setup_action_zone(zone_position : Vector2, zone_radius : int) -> ActionZone:
|
||||
func setup_action_zone(zone_position : Vector2, item: Item) -> ActionZone:
|
||||
if action_zone:
|
||||
action_zone.destroy()
|
||||
action_zone = generate_action_zone(zone_radius)
|
||||
action_zone = generate_action_zone(item)
|
||||
action_zone.area.global_position = zone_position
|
||||
return action_zone
|
||||
|
||||
@ -272,20 +289,41 @@ class InteractableInstruction extends Instruction:
|
||||
interactable.interact(player)
|
||||
|
||||
class ActionZone:
|
||||
var radius : int = 10
|
||||
var item : Item = null
|
||||
var area : Area2D
|
||||
var affected_areas : Array[InspectableEntity]= []
|
||||
|
||||
func _init(_r : int):
|
||||
radius = _r
|
||||
area = Area2D.new()
|
||||
var collision_shape = CollisionShape2D.new()
|
||||
var circle_shape = CircleShape2D.new()
|
||||
func _init(_i : Item):
|
||||
item = _i
|
||||
if item and item.get_usage_zone_radius() > 0:
|
||||
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)
|
||||
circle_shape.radius = item.get_usage_zone_radius()
|
||||
collision_shape.shape = circle_shape
|
||||
area.add_child(collision_shape)
|
||||
|
||||
func clear_preview_on_affected_area():
|
||||
for a in affected_areas:
|
||||
if a:
|
||||
a.affect_preview(false)
|
||||
|
||||
func update_preview_on_affected_area():
|
||||
var detected_areas = get_affected_areas()
|
||||
clear_preview_on_affected_area()
|
||||
var new_affected_areas : Array[InspectableEntity] = []
|
||||
for a in detected_areas:
|
||||
if a is InspectableEntity and item.get_usage_object_affected(a):
|
||||
a.affect_preview(true)
|
||||
new_affected_areas.append(a)
|
||||
affected_areas = new_affected_areas
|
||||
|
||||
func get_affected_areas() -> Array[Area2D]:
|
||||
return [] if area == null else area.get_overlapping_areas()
|
||||
|
||||
func destroy():
|
||||
clear_preview_on_affected_area()
|
||||
area.queue_free()
|
||||
|
||||
func get_global_position() -> Vector2:
|
||||
@ -293,14 +331,15 @@ class ActionZone:
|
||||
|
||||
func move_to_position(pos : Vector2):
|
||||
if area:
|
||||
update_preview_on_affected_area()
|
||||
area.global_position = pos
|
||||
|
||||
func get_points_in_zone(point_factor = 10) -> Array[Vector2]:
|
||||
var points : Array[Vector2] = []
|
||||
var radius = item.get_usage_zone_radius()
|
||||
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
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ extends Area2D
|
||||
class_name InspectableEntity
|
||||
|
||||
const MODULATE_INSPECTED_COLOR = Color.GRAY
|
||||
const MODULATE_AFFECTED_COLOR = Color.RED
|
||||
|
||||
var terrain : Terrain
|
||||
var planet : Planet :
|
||||
@ -16,6 +17,9 @@ var planet : Planet :
|
||||
func inspect(is_inspected : bool = true):
|
||||
modulate = MODULATE_INSPECTED_COLOR if is_inspected else default_modulate
|
||||
|
||||
func affect_preview(is_affected : bool = true):
|
||||
modulate = MODULATE_AFFECTED_COLOR if is_affected else default_modulate
|
||||
|
||||
func setup_inspectable_signals() -> bool:
|
||||
mouse_entered.connect(_on_mouse_entered)
|
||||
mouse_exited.connect(_on_mouse_excited)
|
||||
@ -27,7 +31,7 @@ func _on_mouse_entered():
|
||||
func _on_mouse_excited():
|
||||
Pointer.stop_inspect(self)
|
||||
|
||||
func pointer_text():
|
||||
func pointer_text() -> String:
|
||||
return default_info_title
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
|
||||
@ -12,7 +12,7 @@ const SPRITE_SCENE : PackedScene = preload("res://entities/underground_loot/unde
|
||||
@onready var collision_shape: CollisionShape2D = generate_collision_shape()
|
||||
|
||||
|
||||
func pointer_text():
|
||||
func pointer_text() -> String:
|
||||
return "Buried Loot"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
[gd_scene load_steps=12 format=3 uid="uid://fnv0qhkh40mv"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://fnv0qhkh40mv"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_0ssee"]
|
||||
[ext_resource type="Script" uid="uid://bvb4v66bqteuc" path="res://gui/game/announce/scripts/announce.gd" id="1_4evne"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="2_yrhd4"]
|
||||
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="3_7nrno"]
|
||||
[ext_resource type="AudioStream" uid="uid://dxu6yqmaxxmmc" path="res://gui/game/announce/assets/sfx/alarm.wav" id="5_iwcrn"]
|
||||
[ext_resource type="AudioStream" uid="uid://ccq04ahrwr3bv" path="res://gui/game/announce/assets/sfx/alarm.wav" id="5_iwcrn"]
|
||||
[ext_resource type="AudioStream" uid="uid://d1cpi438ep0ys" path="res://gui/game/announce/assets/sfx/quota_announcement.wav" id="6_oh30d"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vbart"]
|
||||
font = ExtResource("2_yrhd4")
|
||||
@ -165,4 +166,9 @@ libraries = {
|
||||
[node name="Alarm" type="AudioStreamPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("5_iwcrn")
|
||||
pitch_scale = 2.0
|
||||
volume_db = -7.668
|
||||
|
||||
[node name="Announce" type="AudioStreamPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("6_oh30d")
|
||||
volume_db = -7.668
|
||||
|
||||
Binary file not shown.
@ -2,7 +2,7 @@
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://dxu6yqmaxxmmc"
|
||||
uid="uid://ccq04ahrwr3bv"
|
||||
path="res://.godot/imported/alarm.wav-e0f6b7b4874e69f8a83b072a97c636f4.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
Binary file not shown.
@ -2,7 +2,7 @@
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://c5ccma3y6gqtw"
|
||||
uid="uid://d1cpi438ep0ys"
|
||||
path="res://.godot/imported/quota_announcement.wav-ebdd79fb160b0596cac5cfcd6835a186.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
@ -9,4 +9,4 @@ func announce(title : String, text : String, band_color : Color = YELLOW_COLOR):
|
||||
%AnnounceText.text = text
|
||||
%AnnounceTexture.modulate = band_color
|
||||
%AnimationPlayer.play("pass")
|
||||
%Alarm.play()
|
||||
%Announce.play()
|
||||
|
||||
@ -4,6 +4,7 @@ signal inspected_changed(info : Inspector.Info)
|
||||
|
||||
const DEFAULT_ACTION_COLOR = Color.WHITE
|
||||
const ENERGY_ACTION_COLOR = Color("ffff2b")
|
||||
const NO_ENERGY_ACTION_COLOR = Color.RED
|
||||
const ZONE_OPACITY = 0.4
|
||||
const ZONE_ACTIVATED_COLOR = Color.TURQUOISE
|
||||
const ZONE_DEACTIVATED_COLOR = Color.REBECCA_PURPLE
|
||||
@ -15,6 +16,8 @@ var inspected_info : Inspector.Info = null
|
||||
var player : Player # renseigné par Player
|
||||
var can_interact : bool = false
|
||||
var current_selected_item : Item = null
|
||||
var have_energy_to_use_item : bool = false
|
||||
var could_use_item : bool = false
|
||||
var can_use_item : bool = false
|
||||
|
||||
func _ready():
|
||||
@ -53,11 +56,18 @@ func _process(_delta):
|
||||
|
||||
current_selected_item = player.inventory.get_item()
|
||||
|
||||
can_use_item = (
|
||||
could_use_item = (
|
||||
current_selected_item
|
||||
and player.preview_can_use_item(current_selected_item)
|
||||
and player.preview_could_use_item(current_selected_item)
|
||||
)
|
||||
|
||||
have_energy_to_use_item = (
|
||||
current_selected_item
|
||||
and player.has_energy_to_use_item(current_selected_item)
|
||||
)
|
||||
|
||||
can_use_item = could_use_item and have_energy_to_use_item
|
||||
|
||||
if current_selected_item:
|
||||
%ActionZone.radius = current_selected_item.usage_zone_radius
|
||||
%ActionZone.color = ZONE_ACTIVATED_COLOR if can_use_item else ZONE_DEACTIVATED_COLOR
|
||||
@ -89,10 +99,13 @@ func update_inspector():
|
||||
%ActionText.text = inspected.interact_text()
|
||||
%Action.modulate = DEFAULT_ACTION_COLOR if inspected.interaction_cost(player) == 0 else ENERGY_ACTION_COLOR
|
||||
%ActionEnergyImage.visible = inspected.interaction_cost(player) != 0
|
||||
elif can_use_item and current_selected_item:
|
||||
elif current_selected_item and current_selected_item.use_text() != "":
|
||||
%Action.visible = true
|
||||
%ActionText.text = current_selected_item.use_text()
|
||||
%Action.modulate = DEFAULT_ACTION_COLOR if current_selected_item.energy_usage == 0 else ENERGY_ACTION_COLOR
|
||||
%ActionText.text = current_selected_item.use_text() + (" (no energy left)" if not have_energy_to_use_item else "")
|
||||
if can_use_item:
|
||||
%Action.modulate = DEFAULT_ACTION_COLOR if current_selected_item.energy_usage == 0 else ENERGY_ACTION_COLOR
|
||||
else :
|
||||
%Action.modulate = NO_ENERGY_ACTION_COLOR
|
||||
%ActionEnergyImage.visible = current_selected_item.energy_usage != 0
|
||||
else:
|
||||
%Action.visible = false
|
||||
|
||||
@ -71,7 +71,7 @@ func _ready():
|
||||
days_on_last_quota = day
|
||||
|
||||
generate_loot(first_loot_number)
|
||||
generate_objectives()
|
||||
# generate_objectives()
|
||||
planet_updated.emit(self)
|
||||
|
||||
new_quota_started.emit(self)
|
||||
@ -283,7 +283,7 @@ func reach_quota():
|
||||
next_quota = planet_data.get_quota(planet_data.quota_number)
|
||||
days_on_last_quota = day
|
||||
|
||||
ask_quota_reward()
|
||||
# ask_quota_reward()
|
||||
|
||||
func ask_quota_reward():
|
||||
quota_reward_asked.emit(
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
extends Node2D
|
||||
class_name TruckEntrance
|
||||
|
||||
var terrain : Terrain
|
||||
var planet : Planet :
|
||||
get(): return terrain if terrain is Planet else null
|
||||
@ -1 +0,0 @@
|
||||
uid://byu0woo6o3af0
|
||||
@ -1,6 +1,8 @@
|
||||
extends Terrain
|
||||
class_name TruckInterior
|
||||
|
||||
@export var composts : Array[Compost]
|
||||
var rewarded_times = 0
|
||||
signal player_exited(player : Player)
|
||||
|
||||
@onready var spawn_position : Node2D = %SpawnPosition
|
||||
@ -8,3 +10,36 @@ signal player_exited(player : Player)
|
||||
|
||||
func _on_exit_interacted(p: Player):
|
||||
player_exited.emit(p)
|
||||
|
||||
func _ready():
|
||||
for c in composts:
|
||||
c.reward = generate_reward()
|
||||
c.rewarded.connect(_on_compost_rewarded)
|
||||
|
||||
func _on_compost_rewarded(c: Compost):
|
||||
rewarded_times += 1
|
||||
c.reward = generate_reward()
|
||||
|
||||
func get_compost_rewards() -> Array[Compost.Reward]:
|
||||
var rewards : Array[Compost.Reward] = []
|
||||
for c in composts:
|
||||
if c.reward:
|
||||
rewards.append(c.reward)
|
||||
return rewards
|
||||
|
||||
func get_random_reward_cost() -> int:
|
||||
return randi_range(1 + rewarded_times * 2, 3 + rewarded_times * 2)
|
||||
|
||||
func get_possible_rewards() -> Array[Compost.Reward]:
|
||||
return [
|
||||
Compost.UpgradeMaxEnergyReward.new(get_random_reward_cost() + 5),
|
||||
Compost.UpgradeMaxInventoryReward.new(get_random_reward_cost() + 2),
|
||||
Compost.GiveItemReward.new(
|
||||
get_random_reward_cost(),
|
||||
Blueprint.new(preload("res://entities/interactables/machines/solar_pannel/solar_pannel.tres"))
|
||||
)
|
||||
]
|
||||
|
||||
func generate_reward() -> Compost.Reward:
|
||||
return get_possible_rewards().pick_random()
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://ceplumcunebag"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://ceplumcunebag"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://d2p7h0aga85tn" path="res://stages/terrain/truck/assets/sprite/truck_interior.png" id="1_5c5ey"]
|
||||
[ext_resource type="Script" uid="uid://d0gmkwebxdptk" path="res://stages/terrain/truck/scripts/truck_interior.gd" id="1_fk6sc"]
|
||||
[ext_resource type="Script" uid="uid://dyprcd68fjstf" path="res://entities/interactables/scripts/interactable.gd" id="3_fk6sc"]
|
||||
[ext_resource type="Texture2D" uid="uid://dex283rx00fjb" path="res://common/icons/logout.svg" id="3_v18jm"]
|
||||
[ext_resource type="Script" uid="uid://d1nsr56bh1a1y" path="res://entities/camera/scripts/camera.gd" id="4_5di8w"]
|
||||
[ext_resource type="PackedScene" uid="uid://p2dkmy6xs31c" path="res://entities/interactables/truck/compost/compost.tscn" id="6_b7823"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_wi5be"]
|
||||
radius = 69.76956
|
||||
height = 376.0
|
||||
|
||||
[node name="TruckInterior" type="Node2D"]
|
||||
[node name="TruckInterior" type="Node2D" node_paths=PackedStringArray("composts")]
|
||||
position = Vector2(-40, -469)
|
||||
script = ExtResource("1_fk6sc")
|
||||
composts = [NodePath("Compost"), NodePath("Compost2")]
|
||||
metadata/_custom_type_script = "uid://dfl1ijmbmw57r"
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
@ -59,4 +61,10 @@ zoom = Vector2(1.18, 1.18)
|
||||
script = ExtResource("4_5di8w")
|
||||
metadata/_custom_type_script = "uid://d1nsr56bh1a1y"
|
||||
|
||||
[node name="Compost" parent="." instance=ExtResource("6_b7823")]
|
||||
position = Vector2(358, 357)
|
||||
|
||||
[node name="Compost2" parent="." instance=ExtResource("6_b7823")]
|
||||
position = Vector2(536, 365)
|
||||
|
||||
[connection signal="interacted" from="Exit" to="." method="_on_exit_interacted"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user