@tool
class_name GameSoundListener extends StaticBody3D
## Receives alerts from intersecting GameSoundEmitters

signal sound_detected(source: Vector3)

const SOUND_COLLISION_LAYER := 16


func _set_collision() -> void:
	collision_layer = SOUND_COLLISION_LAYER
	collision_mask = 0


func _ready() -> void:
	_set_collision()


func _process(_delta: float) -> void:
	if Engine.is_editor_hint():
		_set_collision()


func detect_sound(source: Vector3) -> void:
	sound_detected.emit(source)
