extends Area2D
class_name InteractionZone

@export var clue: BubbleClue
var clueEnabled = false
var player: Human
var hasMouseInside = false

func _unhandled_input(event: InputEvent) -> void:
	if event.is_action_pressed("touch") or event is InputEventScreenTouch:
		if event.pressed:
			if clueEnabled:
				if hasMouseInside:
					player.wants_to_interact_with = get_parent()
				
func _mouse_enter() -> void:
	hasMouseInside = true

func _mouse_exit() -> void:
	hasMouseInside = false

func enable_interaction_clue(h: Human):
	player = h
	clueEnabled = true
	if clue:
		clue.setVisible(clueEnabled)
	
func disable_interaction_clue():
	clueEnabled = false
	if clue:
		clue.setVisible(clueEnabled)
