Files
Dawn-Godot/scripts/Entity/OnionSprig.gd
2025-05-14 22:52:12 -05:00

22 lines
457 B
GDScript

class_name OnionSprig extends StaticBody3D
func _ready() -> void:
$Entity/EntityInteractable.onInteract.connect(
self.onEntityInteract
)
func _exit_tree() -> void:
$Entity/EntityInteractable.onInteract.disconnect(
self.onEntityInteract
)
func onEntityInteract(
interactor:EntityInteractor,
interactee:EntityInteractable
) -> void:
ITEM.PLAYER_INVENTORY.addItem(ITEM.ONION);
# Dispose self
get_parent().remove_child(self)
self.queue_free()