ajout de deux nouveaux outils, le couteau et la truelle #91
This commit is contained in:
parent
f1ef41323a
commit
4a76cb5302
36
common/icons/fork.svg
Normal file
36
common/icons/fork.svg
Normal file
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<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-trident"
|
||||
version="1.1"
|
||||
id="svg3"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs3" />
|
||||
<path
|
||||
stroke="none"
|
||||
d="M0 0h24v24H0z"
|
||||
fill="none"
|
||||
id="path1" />
|
||||
<g
|
||||
id="g3"
|
||||
transform="matrix(0.86451374,0,0,0.86451374,3.4597458,-2.6863331)"
|
||||
style="stroke-width:2.31344">
|
||||
<path
|
||||
d="m -0.84148875,14.121696 1.68297754,1.682977 c 2.16879471,2.168795 5.68510011,2.168792 7.85389331,-10e-7 2.1687929,-2.168793 2.1687959,-5.685099 1.6e-6,-7.8538932 L 7.0124063,6.2678012"
|
||||
id="path2"
|
||||
style="stroke-width:2.31344" />
|
||||
<path
|
||||
d="M 20.598848,27.708138 2.5244663,9.6337562"
|
||||
id="path3"
|
||||
style="stroke-width:2.31344" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
43
common/icons/fork.svg.import
Normal file
43
common/icons/fork.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b32gdiufy8wqu"
|
||||
path="res://.godot/imported/fork.svg-094546371d6c3cb5b7909733fcff911a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/fork.svg"
|
||||
dest_files=["res://.godot/imported/fork.svg-094546371d6c3cb5b7909733fcff911a.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
|
||||
1
common/icons/slice.svg
Normal file
1
common/icons/slice.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-slice"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 19l15 -15l3 3l-6 6l2 2a14 14 0 0 1 -14 4" /></svg>
|
||||
|
After Width: | Height: | Size: 353 B |
43
common/icons/slice.svg.import
Normal file
43
common/icons/slice.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cyoytbcdqm5d5"
|
||||
path="res://.godot/imported/slice.svg-c6b36b1b2516d02286320438e4fba0d4.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/slice.svg"
|
||||
dest_files=["res://.godot/imported/slice.svg-c6b36b1b2516d02286320438e4fba0d4.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
|
||||
1
common/icons/trowel.svg
Normal file
1
common/icons/trowel.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-trowel"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M14.42 9.058l-5.362 5.363a1.978 1.978 0 0 1 -3.275 -.773l-2.682 -8.044a1.978 1.978 0 0 1 2.502 -2.502l8.045 2.682a1.978 1.978 0 0 1 .773 3.274z" /><path d="M10 10l6.5 6.5" /><path d="M19.347 16.575l1.08 1.079a1.96 1.96 0 0 1 -2.773 2.772l-1.08 -1.079a1.96 1.96 0 0 1 2.773 -2.772z" /></svg>
|
||||
|
After Width: | Height: | Size: 591 B |
43
common/icons/trowel.svg.import
Normal file
43
common/icons/trowel.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dx15ft0ubv04k"
|
||||
path="res://.godot/imported/trowel.svg-08d4796611ee66ea329f68678210bbdf.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/trowel.svg"
|
||||
dest_files=["res://.godot/imported/trowel.svg-08d4796611ee66ea329f68678210bbdf.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
|
||||
44
common/inventory/scripts/items/fork.gd
Normal file
44
common/inventory/scripts/items/fork.gd
Normal file
@ -0,0 +1,44 @@
|
||||
extends Item
|
||||
class_name Fork
|
||||
|
||||
const USE_INTERVAL = 0.15
|
||||
|
||||
func get_item_name() -> String:
|
||||
return "Fork"
|
||||
|
||||
func get_description() -> String:
|
||||
return "Use it to harvest mature plants."
|
||||
|
||||
func get_icon() -> Texture2D:
|
||||
return preload("res://common/icons/fork.svg")
|
||||
|
||||
func get_energy_used() -> int:
|
||||
return 1
|
||||
|
||||
func get_usage_zone_radius() -> int:
|
||||
return 50
|
||||
|
||||
func get_usage_object_affected(i : InspectableEntity) -> bool:
|
||||
return i is Plant
|
||||
|
||||
func use_text() -> String:
|
||||
return "Harvest"
|
||||
|
||||
func can_use(_player : Player, zone : Player.ActionZone) -> bool:
|
||||
var areas = zone.get_affected_areas()
|
||||
for area in areas :
|
||||
if area is Plant:
|
||||
return true
|
||||
return false
|
||||
|
||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
for area in zone.get_affected_areas():
|
||||
if area and area is Plant:
|
||||
harvest(area, player)
|
||||
await player.get_tree().create_timer(USE_INTERVAL).timeout
|
||||
|
||||
return true
|
||||
|
||||
func harvest(p : Plant, player: Player):
|
||||
player.play_sfx("harvest")
|
||||
p.harvest()
|
||||
1
common/inventory/scripts/items/fork.gd.uid
Normal file
1
common/inventory/scripts/items/fork.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://cg5to3g2bqyks
|
||||
19
common/inventory/scripts/items/knife.gd
Normal file
19
common/inventory/scripts/items/knife.gd
Normal file
@ -0,0 +1,19 @@
|
||||
extends Fork
|
||||
class_name Knife
|
||||
|
||||
const KNIFE_ZONE_RADIUS = 10
|
||||
|
||||
func get_item_name() -> String:
|
||||
return "Knife"
|
||||
|
||||
func get_description() -> String:
|
||||
return "Use it to harvest mature plants. Do not cost energy."
|
||||
|
||||
func get_energy_used() -> int:
|
||||
return 0
|
||||
|
||||
func get_icon() -> Texture2D:
|
||||
return preload("res://common/icons/slice.svg")
|
||||
|
||||
func get_usage_zone_radius() -> int:
|
||||
return KNIFE_ZONE_RADIUS
|
||||
1
common/inventory/scripts/items/knife.gd.uid
Normal file
1
common/inventory/scripts/items/knife.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://clyixfqc8rmo
|
||||
@ -1,8 +1,7 @@
|
||||
extends Item
|
||||
extends Fork
|
||||
class_name Shovel
|
||||
|
||||
const USE_INTERVAL = 0.15
|
||||
const SHOVEL_ZONE_RADIUS = 30
|
||||
const SHOVEL_ZONE_RADIUS = 50
|
||||
|
||||
func get_item_name() -> String:
|
||||
return "Shovel"
|
||||
@ -13,9 +12,6 @@ func get_description() -> String:
|
||||
func get_icon() -> Texture2D:
|
||||
return preload("res://common/icons/shovel.svg")
|
||||
|
||||
func get_energy_used() -> int:
|
||||
return 1
|
||||
|
||||
func get_usage_zone_radius() -> int:
|
||||
return SHOVEL_ZONE_RADIUS
|
||||
|
||||
@ -33,20 +29,16 @@ func can_use(_player : Player, zone : Player.ActionZone) -> bool:
|
||||
return false
|
||||
|
||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
dig(
|
||||
zone.get_affected_areas(),
|
||||
player
|
||||
)
|
||||
for area in zone.get_affected_areas():
|
||||
if area and area is Plant:
|
||||
harvest(area, player)
|
||||
await player.get_tree().create_timer(USE_INTERVAL).timeout
|
||||
if area and area is UndergroundLoot:
|
||||
dig(area, player)
|
||||
await player.get_tree().create_timer(USE_INTERVAL).timeout
|
||||
|
||||
return true
|
||||
|
||||
func dig(areas: Array[Area2D], player: Player):
|
||||
for area in areas :
|
||||
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
|
||||
func dig(u: UndergroundLoot, player: Player):
|
||||
player.play_sfx("dig")
|
||||
u.dig()
|
||||
21
common/inventory/scripts/items/trowel.gd
Normal file
21
common/inventory/scripts/items/trowel.gd
Normal file
@ -0,0 +1,21 @@
|
||||
extends Fork
|
||||
class_name Trowel
|
||||
|
||||
const TROWEL_ZONE_RADIUS = 50
|
||||
|
||||
func get_item_name() -> String:
|
||||
return "Trowel"
|
||||
|
||||
func get_description() -> String:
|
||||
return "Use it to harvest mature plants, can get a [b]bonus seed[/b] from each plant."
|
||||
|
||||
func get_icon() -> Texture2D:
|
||||
return preload("res://common/icons/trowel.svg")
|
||||
|
||||
func get_usage_zone_radius() -> int:
|
||||
return TROWEL_ZONE_RADIUS
|
||||
|
||||
func harvest(p : Plant, player: Player):
|
||||
ProduceSeedsEffect.new(1).effect(p)
|
||||
player.play_sfx("harvest")
|
||||
p.harvest()
|
||||
1
common/inventory/scripts/items/trowel.gd.uid
Normal file
1
common/inventory/scripts/items/trowel.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://gvq5vic12srt
|
||||
@ -7,8 +7,9 @@
|
||||
[ext_resource type="Texture2D" uid="uid://crc4aop6ajiau" path="res://entities/plants/assets/sprites/champ/mature.png" id="3_y8qve"]
|
||||
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_liopn"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_l2hi3"]
|
||||
[sub_resource type="Resource" id="Resource_cf34j"]
|
||||
script = ExtResource("1_cf34j")
|
||||
level = 1
|
||||
metadata/_custom_type_script = "uid://ceqx5va1ormau"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_my6by"]
|
||||
@ -23,5 +24,5 @@ default_growing_time = 3
|
||||
seed_texture = SubResource("AtlasTexture_my6by")
|
||||
growing_texture = ExtResource("2_l2hi3")
|
||||
mature_texture = ExtResource("3_y8qve")
|
||||
default_cyclic_effects = Array[ExtResource("1_l2hi3")]([SubResource("Resource_l2hi3")])
|
||||
default_mature_effects = Array[ExtResource("1_l2hi3")]([SubResource("Resource_cf34j")])
|
||||
metadata/_custom_type_script = "uid://jnye5pe1bgqw"
|
||||
|
||||
@ -178,7 +178,7 @@ func has_energy_to_use_item(item : Item):
|
||||
|
||||
func use_item(item : Item):
|
||||
if can_use_item_on_zone(item, action_zone):
|
||||
var is_item_used = item.use(self, action_zone)
|
||||
var is_item_used = await item.use(self, action_zone)
|
||||
if is_item_used:
|
||||
energy -= item.energy_usage
|
||||
if item.is_one_time_use():
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://d3lff5fui1k0c"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://d3lff5fui1k0c"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_f5bv4"]
|
||||
[ext_resource type="Texture2D" uid="uid://lpik6kwqgmjx" path="res://gui/game/assets/texture/tablette_resized.png" id="1_qfinp"]
|
||||
@ -22,9 +22,6 @@ region = Rect2(76, 75, 124, 135)
|
||||
font = ExtResource("4_yijvw")
|
||||
font_size = 20
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_c4yiu"]
|
||||
font_size = 12
|
||||
|
||||
[node name="Inspector" type="PanelContainer"]
|
||||
offset_right = 276.0
|
||||
offset_bottom = 235.0
|
||||
@ -62,12 +59,12 @@ theme_override_constants/h_separation = 8
|
||||
theme_override_constants/v_separation = 8
|
||||
alignment = 1
|
||||
|
||||
[node name="Desc" type="Label" parent="VBoxContainer"]
|
||||
[node name="Desc" type="RichTextLabel" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
bbcode_enabled = true
|
||||
text = "Very interesting description that can be very long, like 2 or 3 lines long."
|
||||
label_settings = SubResource("LabelSettings_c4yiu")
|
||||
autowrap_mode = 3
|
||||
fit_content = true
|
||||
|
||||
[node name="FramedInfos" type="VBoxContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@ -34,8 +34,7 @@ z_index = 1000
|
||||
[node name="Win" parent="CanvasLayer" instance=ExtResource("3_6guxm")]
|
||||
visible = false
|
||||
|
||||
[node name="Tutorial" parent="CanvasLayer" node_paths=PackedStringArray("camera", "player") instance=ExtResource("5_orelw")]
|
||||
camera = NodePath("../../Camera")
|
||||
[node name="Tutorial" parent="CanvasLayer" node_paths=PackedStringArray("player") instance=ExtResource("5_orelw")]
|
||||
player = NodePath("../../Entities/Player")
|
||||
|
||||
[node name="Entities" type="Node2D" parent="."]
|
||||
@ -61,8 +60,6 @@ position = Vector2(-36, -154)
|
||||
[node name="Planet" parent="." node_paths=PackedStringArray("import_entities_from_node") instance=ExtResource("8_t31p7")]
|
||||
loot_number = Array[int]([1])
|
||||
loot_item_number = Array[int]([1])
|
||||
objective_first_distance = 150
|
||||
objective_between_distance = 150
|
||||
import_entities_from_node = NodePath("../Entities")
|
||||
|
||||
[node name="Camera" parent="." node_paths=PackedStringArray("following") instance=ExtResource("16_m18ms")]
|
||||
|
||||
@ -37,6 +37,14 @@ func get_possible_rewards() -> Array[Compost.Reward]:
|
||||
Compost.GiveItemReward.new(
|
||||
get_random_reward_cost(),
|
||||
Blueprint.new(preload("res://entities/interactables/machines/solar_pannel/solar_pannel.tres"))
|
||||
),
|
||||
Compost.GiveItemReward.new(
|
||||
get_random_reward_cost(),
|
||||
Knife.new()
|
||||
),
|
||||
Compost.GiveItemReward.new(
|
||||
get_random_reward_cost(),
|
||||
Trowel.new()
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user