ajout de deux nouveaux outils, le couteau et la truelle #91

This commit is contained in:
2025-10-17 18:27:39 +02:00
parent f1ef41323a
commit 4a76cb5302
18 changed files with 283 additions and 34 deletions

36
common/icons/fork.svg Normal file
View 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

View 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
View 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

View 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
View 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

View 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

View 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()

View File

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

View 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

View File

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

View File

@@ -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()

View 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()

View File

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