extends Node
#class_name BenchInteractionConnector
#
## Signals
#signal SitOnBenchTriggered(position: Vector2, sitting_direction: Enums.Directions)
#
## Exports
#@export var player: PlayerBody
#
## Private Variables
#var _benches_in_range: Array[WoodenBench] = []
#
## Private Methods
#func _ready() -> void:
	#player.interact_scanner.area_entered.connect(_on_interact_scanned)
	#player.interact_scanner.area_exited.connect(_on_interact_unscanned)
	#player.interact_scanner.InteractionActionTriggered.connect(_on_interact_triggered)
#
#
#func _on_interact_scanned(area: Area2D) -> void:
	#var parent := area.get_parent()
	#if parent == null or parent is not WoodenBench or _benches_in_range.has(parent):
		#return
	#_benches_in_range.append(parent)
#
#
#func _on_interact_unscanned(area: Area2D) -> void:
	#var parent: Node = area.get_parent()
	#if parent == null or parent is not WoodenBench or !_benches_in_range.has(parent):
		#return
	#_benches_in_range.erase(parent)
#
#
#func _on_interact_triggered() -> void:
	#if _benches_in_range.is_empty():
		#return
	#
	#var bench := _benches_in_range[0]
	#var sitting_spots_container := bench.get_node("Sitting Spots") as Node2D
	#var sitting_spot_markers := sitting_spots_container.get_children()
	#
	#var closest_marker: Marker2D
	#var distance_to_player := 9999.0
	#for node in sitting_spot_markers:
		#var marker := node as Marker2D
		#var distance := marker.global_position.distance_to(player.global_position)
		#if distance < distance_to_player:
			#closest_marker = marker
			#distance_to_player = distance
	#
	#if !closest_marker:
		#return
	#
	#player.SitOnFurnitureTriggered.emit(closest_marker.global_position, Enums.Directions.DOWN)
