é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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user