équilibrage des quota et du jeu, changement du GUI pour rendre les objectifs de quotas plus visibles #72

This commit is contained in:
Zacharie Guet 2025-09-19 10:25:15 +02:00
parent 43bdbc3581
commit 42edc97401
24 changed files with 316 additions and 102 deletions

View File

@ -44,12 +44,13 @@ func get_decontamination_surface() -> float:
#endregion
#region ------------------ Objectives ------------------
func generate_objective_rewards(level = 1) -> Array[ObjectiveReward]:
func generate_objective_rewards(level = 0) -> Array[ObjectiveReward]:
var amount = level + 1
var possible_objective_rewards_path : Array[ObjectiveReward] = [
IncreaseDayLimitReward.new(randi_range(level + 1, level + 3)),
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] = []
@ -67,8 +68,8 @@ func generate_objective_rewards(level = 1) -> Array[ObjectiveReward]:
#region ------------------ Quotas ------------------
func get_quota(n = 0) -> int:
var first_quota = 50
var quota_adding = n * 50
var first_quota = 100
var quota_adding = n * 150
if n == 0:
return first_quota

View File

@ -1,8 +0,0 @@
[gd_resource type="Resource" script_class="IncreaseDayLimitReward" load_steps=2 format=3 uid="uid://b11qyyi8k0mua"]
[ext_resource type="Script" uid="uid://df6i1hivw4ymn" path="res://entities/objectives/scripts/rewards/increase_day_limit_reward.gd" id="1_gt31s"]
[resource]
script = ExtResource("1_gt31s")
day_limit_increase = 5
metadata/_custom_type_script = "uid://df6i1hivw4ymn"

View File

@ -1,8 +0,0 @@
[gd_resource type="Resource" script_class="LootRandomSeedsReward" load_steps=2 format=3 uid="uid://ca62vcsijbxgc"]
[ext_resource type="Script" uid="uid://bcdilfb4j7f6d" path="res://entities/objectives/scripts/rewards/loot_random_seeds_reward.gd" id="1_yjhoy"]
[resource]
script = ExtResource("1_yjhoy")
seeds_number = 5
metadata/_custom_type_script = "uid://bcdilfb4j7f6d"

View File

@ -16,4 +16,4 @@ func get_text() -> String:
return "+"+str(day_limit_increase)
func get_description() -> String:
return "Increase the day limitation by " + str(day_limit_increase)
return "Increase the day limitation by " + str(day_limit_increase) + "."

View File

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

View File

@ -0,0 +1 @@
uid://4ak4kre3emnd

View File

@ -16,4 +16,4 @@ func get_text() -> String:
return "+"+str(upgrade_amount)+" max"
func get_description() -> String:
return "Increase player max energy by " + str(upgrade_amount)
return "Increase player max energy by " + str(upgrade_amount) + "."

View File

@ -26,5 +26,4 @@ growing_texture = ExtResource("2_l2hi3")
mature_texture = ExtResource("3_y8qve")
cyclic_effect = SubResource("Resource_5hyy8")
harvest_types_path = Array[String](["uid://cxrc5wchpqm18"])
harvest_number = Array[int]([1, 2])
metadata/_custom_type_script = "uid://jnye5pe1bgqw"

View File

@ -9,8 +9,7 @@
[sub_resource type="Resource" id="Resource_c76qk"]
script = ExtResource("2_cky1j")
impact_radius = 150
improve_by_lifetime = false
improve_by_lifetime_value = 20
improve_by_lifetime_max = 300
metadata/_custom_type_script = "uid://cgscbuxe4dawb"
[sub_resource type="AtlasTexture" id="AtlasTexture_qt76e"]
@ -26,6 +25,6 @@ seed_texture = SubResource("AtlasTexture_qt76e")
growing_texture = ExtResource("1_prk5s")
mature_texture = ExtResource("3_40c3e")
mature_effect = SubResource("Resource_c76qk")
harvest_types_path = Array[String]([])
harvest_types_path = Array[String](["uid://b04vho33bl52b"])
harvest_number = Array[int]([1, 2, 1])
metadata/_custom_type_script = "uid://jnye5pe1bgqw"

View File

@ -9,8 +9,6 @@
[sub_resource type="Resource" id="Resource_q4pje"]
script = ExtResource("2_vyplc")
impact_radius = 20
improve_by_lifetime = false
improve_by_lifetime_value = 20
metadata/_custom_type_script = "uid://cgscbuxe4dawb"
[sub_resource type="AtlasTexture" id="AtlasTexture_sri3b"]

View File

@ -8,9 +8,10 @@
[sub_resource type="Resource" id="Resource_eytxu"]
script = ExtResource("1_8wi4i")
impact_radius = 0
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"]
@ -27,5 +28,4 @@ growing_texture = ExtResource("2_k4b1k")
mature_texture = ExtResource("3_8fstu")
cyclic_effect = SubResource("Resource_eytxu")
harvest_types_path = Array[String](["uid://c5oxxif3h5yxo"])
harvest_number = Array[int]([1, 2])
metadata/_custom_type_script = "uid://jnye5pe1bgqw"

View File

@ -4,13 +4,14 @@ class_name DecontaminateTerrainEffect
@export var impact_radius = 100
@export var improve_by_lifetime := false
@export var improve_by_lifetime_value := 20
@export var improve_by_lifetime_max := 200
func effect(plant):
var radius = impact_radius
if improve_by_lifetime:
radius += improve_by_lifetime_value * plant.day
radius = min(radius + improve_by_lifetime_value * plant.day, improve_by_lifetime_max)
plant.planet.impact_contamination(
plant.global_position,

View File

@ -103,10 +103,11 @@ func can_interact(interactable : Interactable):
return interactable.can_interact(self)
func try_interact(interactable : Interactable):
has_just_received_instruction = true
instruction = InteractableInstruction.new(
interactable
)
if interactable:
has_just_received_instruction = true
instruction = InteractableInstruction.new(
interactable
)
func try_move(move_to : Vector2):
instruction = MoveInstruction.new(move_to)

View File

@ -0,0 +1,159 @@
[gd_scene load_steps=11 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"]
[sub_resource type="LabelSettings" id="LabelSettings_vbart"]
font = ExtResource("2_yrhd4")
font_size = 50
[sub_resource type="Gradient" id="Gradient_id0t5"]
interpolation_mode = 1
offsets = PackedFloat32Array(0, 0.115169, 0.41573, 0.620786, 0.924157)
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_mnweq"]
gradient = SubResource("Gradient_id0t5")
fill_to = Vector2(1, 1)
repeat = 1
[sub_resource type="Animation" id="Animation_ok3ge"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("VBoxContainer/AnnounceTexture:custom_minimum_size")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("VBoxContainer:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
[sub_resource type="Animation" id="Animation_871vo"]
resource_name = "pass"
length = 3.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0333333, 2.93334, 2.96667),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [false, true, true, false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("VBoxContainer/AnnounceTexture:custom_minimum_size")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.0666667, 0.433333, 2.42651, 2.93334),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, 65), Vector2(0, 65), Vector2(0, 0)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("VBoxContainer:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.0666667, 0.133333, 2.83334, 2.93334),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_dvva5"]
_data = {
&"RESET": SubResource("Animation_ok3ge"),
&"pass": SubResource("Animation_871vo")
}
[node name="Announce" type="Control"]
visible = false
clip_contents = true
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_4evne")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
modulate = Color(1, 1, 1, 0)
clip_contents = true
layout_mode = 1
anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_top = -73.5
offset_bottom = 73.5
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_0ssee")
alignment = 1
[node name="AnnounceTitle" type="Label" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "New Quota"
label_settings = SubResource("LabelSettings_vbart")
horizontal_alignment = 1
[node name="AnnounceTexture" type="TextureRect" parent="VBoxContainer"]
unique_name_in_owner = true
modulate = Color(0.886275, 0.623529, 0.196078, 1)
layout_mode = 2
texture = SubResource("GradientTexture2D_mnweq")
expand_mode = 1
stretch_mode = 1
[node name="AnnounceText" type="Label" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Decontaminate 50 unit in 10 days"
label_settings = ExtResource("3_7nrno")
horizontal_alignment = 1
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
&"": SubResource("AnimationLibrary_dvva5")
}

View File

@ -0,0 +1,11 @@
extends Control
class_name Announce
const YELLOW_COLOR = Color("e29f32")
const RED_COLOR = Color("f20058")
func announce(title : String, text : String, band_color : Color = YELLOW_COLOR):
%AnnounceTitle.text = title
%AnnounceText.text = text
%AnnounceTexture.modulate = band_color
%AnimationPlayer.play("pass")

View File

@ -0,0 +1 @@
uid://bvb4v66bqteuc

View File

@ -1,8 +1,9 @@
[gd_scene load_steps=27 format=3 uid="uid://12nak7amd1uq"]
[gd_scene load_steps=28 format=3 uid="uid://12nak7amd1uq"]
[ext_resource type="Script" uid="uid://cqao7n800qy40" path="res://gui/game/scripts/game_gui.gd" id="1_udau0"]
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="2_nq5i2"]
[ext_resource type="Texture2D" uid="uid://cm3ehinvvj52i" path="res://gui/game/assets/texture/Interface sans boutons.png" id="3_n4kem"]
[ext_resource type="PackedScene" uid="uid://fnv0qhkh40mv" path="res://gui/game/announce/announce.tscn" id="4_h6540"]
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="4_k4juk"]
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="4_ujg5r"]
[ext_resource type="PackedScene" uid="uid://d3lff5fui1k0c" path="res://gui/game/inspector/inspector.tscn" id="6_dr1y2"]
@ -260,6 +261,10 @@ libraries = {
}
autoplay = "default"
[node name="Announce" parent="." instance=ExtResource("4_h6540")]
unique_name_in_owner = true
layout_mode = 1
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 15
@ -291,10 +296,10 @@ stretch_mode = 5
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.64095
anchor_top = 0.640625
anchor_right = 0.64095
anchor_bottom = 0.684375
anchor_left = 0.27299702
anchor_top = 0.453125
anchor_right = 0.27299702
anchor_bottom = 0.496875
offset_left = -44.0
offset_top = -12.5
offset_right = 44.0
@ -322,23 +327,22 @@ vertical_alignment = 1
[node name="QuotaInfo" type="CenterContainer" parent="MarginContainer/PlayerInfo"]
layout_mode = 0
offset_left = 55.0
offset_top = 51.0
offset_right = 126.0
offset_bottom = 101.0
offset_left = 176.0
offset_top = 83.0
offset_right = 247.0
offset_bottom = 133.0
[node name="QuotaProgressBar" type="TextureProgressBar" parent="MarginContainer/PlayerInfo/QuotaInfo"]
unique_name_in_owner = true
modulate = Color(0.1801, 0.349497, 0.456794, 1)
layout_mode = 2
value = 83.0
fill_mode = 4
texture_progress = SubResource("GradientTexture2D_h6540")
[node name="QuotaProgressText" type="Label" parent="MarginContainer/PlayerInfo/QuotaInfo"]
unique_name_in_owner = true
layout_mode = 2
text = "100%"
text = "X"
label_settings = ExtResource("4_ujg5r")
horizontal_alignment = 1
vertical_alignment = 1
@ -393,10 +397,6 @@ layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 5.0
offset_top = 2.0
offset_right = 5.0
offset_bottom = 2.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2

View File

@ -15,6 +15,33 @@ shader_parameter/mix_percentage = 0.3
font = ExtResource("3_5sqh2")
font_size = 50
[sub_resource type="Animation" id="Animation_8323k"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
[sub_resource type="Animation" id="Animation_4f1tl"]
resource_name = "show"
length = 0.3
@ -43,33 +70,6 @@ tracks/1/keys = {
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id="Animation_8323k"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7fpy7"]
_data = {
&"RESET": SubResource("Animation_8323k"),

View File

@ -13,16 +13,17 @@ func _on_player_updated(player:Player):
update_no_energy_left_info(player.energy)
func _on_planet_updated(planet:Planet):
%DayCount.text = "Day " + str(planet.day) + "/" + str(planet.day_limit)
%DayCount.text = str(planet.get_quota_remaining_days()) + " days left"
var quota_progression_percent : float = (planet.decontamination_surface - planet.surface_on_last_quota) / (planet.next_quota - planet.surface_on_last_quota) * 100
%QuotaProgressText.text = str(roundi(quota_progression_percent)) + " %"
get_tree().create_tween().tween_property(
%QuotaProgressBar,
"value",
quota_progression_percent,
0.5,
)
if planet.next_quota:
var quota_progression_percent : float = (planet.decontamination_surface - planet.last_quota) / (planet.next_quota - planet.last_quota) * 100
%QuotaProgressText.text = str(roundi(planet.decontamination_surface)) + "/" + str(roundi(planet.next_quota))
get_tree().create_tween().tween_property(
%QuotaProgressBar,
"value",
quota_progression_percent,
0.5,
)
func _on_player_action_tried_without_energy():
$AnimationPlayer.play("no_energy_left")
@ -52,3 +53,25 @@ func update_no_energy_left_info(energy):
$NoEnergyLeftAnimation.play("no_energy_left_appear")
elif energy != 0 and %NoEnergyLeft.visible:
%NoEnergyLeft.visible = false
func _on_planet_new_quota_started(planet:Planet):
%Announce.announce(
"New Quota",
"Reach " + str(roundi(planet.next_quota)) + " units before " + str(Planet.DEFAULT_DAY_LIMIT) + " days"
)
func _on_planet_pass_day_ended(planet:Planet):
var remaining_days = planet.get_quota_remaining_days()
if remaining_days == 1:
%Announce.announce(
"Last day for reaching quota",
str(roundi(planet.next_quota - planet.decontamination_surface)) + " units left to decontaminate",
Announce.RED_COLOR
)
if remaining_days == 2:
%Announce.announce(
"2 days left before quota's ending",
str(roundi(planet.next_quota - planet.decontamination_surface)) + " units left to decontaminate",
Announce.YELLOW_COLOR
)

View File

@ -3,12 +3,14 @@ extends Control
func _ready():
visible = false
func win(decontamination_surface : float):
func win(planet : Planet):
visible = true
get_tree().paused = true
%WinTitle.text = "Score : " + str(roundi(decontamination_surface)) + " m2"
%WinTitle.text = "Score : " + str(roundi(planet.decontamination_surface))
func _on_restart_pressed():
GameInfo.game_data.current_planet_data = null
get_tree().paused = false
get_tree().reload_current_scene()
func _on_quit_pressed():
@ -16,4 +18,4 @@ func _on_quit_pressed():
func _on_planet_day_limit_exceed(planet : Planet):
win(planet.decontamination_surface)
win(planet)

View File

@ -57,7 +57,7 @@ alignment = 1
[node name="WinTitle" type="Label" parent="Tutorial/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Score : 2%"
text = "Score : 10"
label_settings = SubResource("LabelSettings_eq457")
horizontal_alignment = 1

View File

@ -14,7 +14,7 @@ config/name="Seeding Planets"
config/description="Seeding planets is a survival, managment and cosy game in which you play a little gardener robot."
config/version="proto-2.0"
run/main_scene="uid://c5bruelvqbm1k"
config/features=PackedStringArray("4.4", "Forward Plus")
config/features=PackedStringArray("4.5", "Forward Plus")
config/icon="uid://df0y0s666ui4h"
[autoload]

View File

@ -59,6 +59,9 @@ following = NodePath("../Entities/Player")
[connection signal="pause_asked" from="CanvasLayer/RootGui" to="CanvasLayer/Pause" method="_on_root_gui_pause_asked"]
[connection signal="player_updated" from="Entities/Player" to="CanvasLayer/RootGui" method="_on_player_updated"]
[connection signal="upgraded" from="Entities/Player" to="CanvasLayer/RootGui" method="_on_player_upgraded"]
[connection signal="day_limit_exceed" from="Planet" to="CanvasLayer/Win" method="_on_planet_day_limit_exceed"]
[connection signal="new_quota_started" from="Planet" to="CanvasLayer/RootGui" method="_on_planet_new_quota_started"]
[connection signal="pass_day_ended" from="Planet" to="CanvasLayer/RootGui" method="_on_planet_pass_day_ended"]
[connection signal="pass_day_started" from="Planet" to="CanvasLayer/RootGui" method="_on_planet_pass_day_started"]
[connection signal="planet_updated" from="Planet" to="CanvasLayer/RootGui" method="_on_planet_updated"]
[connection signal="quota_reward_asked" from="Planet" to="CanvasLayer/RewardChoice" method="_on_planet_quota_reward_asked"]

View File

@ -7,9 +7,10 @@ signal pass_day_started(planet : Planet)
signal pass_day_proceeded(planet : Planet)
signal pass_day_ended(planet : Planet)
signal quota_reward_asked(planet : Planet, item1 : Item, item2 : Item)
signal new_quota_started(planet : Planet)
const PASS_DAY_ANIMATION_TIME : float = 1.5
const DEFAULT_DAY_LIMIT : int = 10
const DEFAULT_DAY_LIMIT : int = 7
const PLANET_TEXTURE_SCALE : float = 5.0
const OBJECTIVE_MAX_LEVEL : int = 10
const OBJECTIVE_MIN_ANGLE_DIFF = PI/2
@ -40,8 +41,9 @@ var planet_data : PlanetData
var contamination_texture : ImageTexture
var day : int = 1
var day_limit = DEFAULT_DAY_LIMIT
var surface_on_last_quota : float = 0
var next_quota : float = 1
var days_on_last_quota : int = 0
var last_quota : float = 0
var next_quota : float
var player : Player
func _ready():
@ -54,12 +56,13 @@ func _ready():
decontamination_surface = planet_data.get_decontamination_surface()
next_quota = planet_data.get_quota()
surface_on_last_quota = decontamination_surface
days_on_last_quota = day
generate_loot(first_loot_number)
generate_objectives()
planet_updated.emit(self)
new_quota_started.emit(self)
# queue_redraw()
@ -198,11 +201,11 @@ func pass_day():
e._end_pass_day()
decontamination_surface = planet_data.get_decontamination_surface()
if day + 1 > day_limit:
day_limit_exceed.emit(self)
if decontamination_surface >= next_quota:
ask_quota_reward()
reach_quota()
if get_quota_remaining_days() <= 0:
day_limit_exceed.emit(self)
planet_updated.emit(self)
@ -248,11 +251,15 @@ func generate_objective(distance : int, angle : float, reward : ObjectiveReward)
objective.position = Vector2.ONE.rotated(angle) * distance
func ask_quota_reward():
func reach_quota():
planet_data.quota_number += 1
last_quota = next_quota
next_quota = planet_data.get_quota(planet_data.quota_number)
surface_on_last_quota = decontamination_surface
days_on_last_quota = day
ask_quota_reward()
func ask_quota_reward():
quota_reward_asked.emit(
self,
generate_quota_reward(),
@ -273,6 +280,11 @@ func generate_quota_reward() -> Item:
func choose_quota_reward(item : Item):
drop_item(item, player.global_position, 100)
if decontamination_surface >= next_quota:
ask_quota_reward()
reach_quota()
else :
new_quota_started.emit(self)
func get_quota_remaining_days():
return DEFAULT_DAY_LIMIT - (day - days_on_last_quota)
#endregion