extends Control

@onready var button_root = $"../.."
@onready var tooltip = $"../../Tooltip"

func _ready():
    connect("mouse_entered", _on_mouse_entered)
    connect("mouse_exited", _on_mouse_exited)
    connect("pressed", _on_pressed)

func _on_mouse_entered():
    tooltip.show()

func _on_mouse_exited():
    tooltip.hide()

func _on_pressed():
    var selector = get_tree().get_root().find_child("SelectedItem", true, false)
    tooltip.hide()
    selector.set_item(button_root.plant.instantiate())
