extends Node

func GetAllTreasureChests() -> Array[BaseChest]:
	var nodes := get_tree().get_nodes_in_group("Treasure Chest Group")
	var arr: Array[BaseChest] = []
	
	for node in nodes:
		if node is BaseChest:
			arr.append(node as BaseChest)
	
	return arr


func GetAllInteractiveLoadingZones() -> Array[InteractiveLoadingZone]:
	var nodes := get_tree().get_nodes_in_group("Interactive Loading Zone Group")
	var arr: Array[InteractiveLoadingZone] = []
	
	for node in nodes:
		if node is InteractiveLoadingZone:
			arr.append(node)
	
	return arr


func GetAllLoadingZoneTransporters() -> Array[LoadingZoneTransporter]:
	var nodes := get_tree().get_nodes_in_group("Loading Zone Transporter Group")
	var arr: Array[LoadingZoneTransporter] = []
	
	for node in nodes:
		if node is LoadingZoneTransporter:
			arr.append(node)
	
	return arr


func GetAllDialogueTriggers() -> Array[DialogueTrigger]:
	var nodes := get_tree().get_nodes_in_group("Dialog Trigger Group")
	
	var arr: Array[DialogueTrigger] = []
	
	for node in nodes:
		if node is DialogueTrigger:
			arr.append(node)
	
	return arr


func GetPlayerBody() -> CharacterBody2D:
	var nodes := get_tree().get_nodes_in_group("Player Group")
	if nodes.is_empty():
		return null
	
	return nodes[0] as CharacterBody2D
