* Ajout d'un mode infini (pour nos hard core gamers) * Ajout d'un message de découverte d'un nouvel outil * Séparation de la pelle en deux outils : la pioche et la fourche * Amélioration de la lisibilité des capsules d'énergies * Changement léger des texture du sol et de la pierre * Correction d'un bug lors du clic frénétique sur le porte de sortie du vaisseau * Ajout d'un icône de recharge * Fix de la mutation Ancien qui ne s'améliorait pas au niveau 4 + début de dev des artefacts avec un distributeur
49 lines
1.2 KiB
GDScript
49 lines
1.2 KiB
GDScript
extends Item
|
|
class_name Fork
|
|
|
|
const USE_INTERVAL = 0.15
|
|
|
|
func get_item_name() -> String:
|
|
return tr("FORK")
|
|
|
|
func get_description() -> String:
|
|
return tr("FORK_DESC_TEXT")
|
|
|
|
func get_icon() -> Texture2D:
|
|
return preload("res://common/icons/fork.svg")
|
|
|
|
func get_item_type() -> ItemType:
|
|
return Item.ItemType.TOOL_ITEM
|
|
|
|
func get_energy_used() -> int:
|
|
return 1
|
|
|
|
func get_usage_zone_radius() -> int:
|
|
return 10
|
|
|
|
func get_usage_object_affected(i : InspectableEntity) -> bool:
|
|
return i is Plant
|
|
|
|
func use_text() -> String:
|
|
return tr("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:
|
|
var has_plant = false
|
|
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
|
|
has_plant = true
|
|
return has_plant
|
|
|
|
func harvest(p : Plant, _player: Player):
|
|
AudioManager.play_sfx("Harvest")
|
|
p.harvest()
|