#58 ajout d'un item package servant à déployer des machines

This commit is contained in:
2025-09-05 17:01:59 +02:00
parent 165a4d129b
commit 18b48f5320
29 changed files with 149 additions and 62 deletions

View File

@@ -0,0 +1,36 @@
extends Machine
class_name Compost
var value_per_seed : float = 0.5
var fill_value : float = 0.
func _process(_delta):
%ProgressBar.value = lerp(%ProgressBar.value, fill_value * 100, 0.5)
func inspected_text():
return "Compost"
func interact_text():
return "Put a seed ("+str(roundi((1-fill_value)/value_per_seed))+" left)"
func can_interact(p : Player) -> bool:
return p.inventory.get_item() and p.inventory.get_item() is Seed
func requirement_text() -> String:
return "You must have a seed in hand"
func interact(p : Player) -> bool:
if not can_interact(p):
return false
p.play_sfx("harvest")
p.delete_item(p.inventory.get_item())
fill_value += value_per_seed
if fill_value >= 1.:
$AnimationPlayer.play("empty")
fill_value = 0
p.upgrade()
value_per_seed /= 1.5
else:
$AnimationPlayer.play("fill")
return true

View File

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