inventaire fonctionnel #13

This commit is contained in:
Altaezio
2025-08-03 19:38:46 +02:00
committed by Zacharie Guet
parent b164141d00
commit bca2300443
16 changed files with 112 additions and 46 deletions

View File

@@ -0,0 +1,8 @@
extends InteractableAction
class_name GetSeedInteraction
func action(p: Player, i : Interactable):
if i is Plant:
p.inventory.add_item(i.seed_item)
else :
printerr("No plant selected or interactable is not a plant")

View File

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

View File

@@ -1,8 +1,8 @@
extends InteractableAction
class_name WaterPlantAction
func action(_p: Player, _i : Interactable):
if _i is Plant:
_i.watered = true
func action(_p: Player, i : Interactable):
if i is Plant:
i.watered = true
else :
printerr("No plant selected or interactable is not a plant")

View File

@@ -1,7 +1,7 @@
extends Area2D
class_name Interactable
@export var actions : Array[InteractableAction] = [];
@export var actions : Array[InteractableAction] = []
func interact(p : Player):
for a in actions: