inventaire fonctionnel #13
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
[gd_resource type="Resource" script_class="GetSeedInteraction" load_steps=2 format=3 uid="uid://chmmu2jlo2eu0"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://j5xvcabrspyb" path="res://entities/interactables/scripts/actions/get_seed.gd" id="1_ys78p"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_ys78p")
|
||||
metadata/_custom_type_script = "uid://j5xvcabrspyb"
|
||||
8
entities/interactables/scripts/actions/get_seed.gd
Normal file
8
entities/interactables/scripts/actions/get_seed.gd
Normal 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")
|
||||
1
entities/interactables/scripts/actions/get_seed.gd.uid
Normal file
1
entities/interactables/scripts/actions/get_seed.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://j5xvcabrspyb
|
||||
@@ -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")
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user