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