gros dev pre proto
* Changement de l'UI, ajouts de l'inspecteur par carte et changement de police * Ajout d'un semblant d'exploration * Ajout de la sauvegarde des entités * Restructuration mineure de l'arborescence * Fix divers et réécriture des textes
This commit is contained in:
44
entities/player/inventory/scripts/items/fork.gd
Normal file
44
entities/player/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()
|
||||
Reference in New Issue
Block a user