extends Area2D

@export var KILL_ALL_NPCS = false
@export var LEVEL_MESSAGE : String = ''
@export var ENABLED_NODES : Array[Node] = []
@export var DISABLED_NODES : Array[Node] = []
@export var UI : Node

# Called when the node enters the scene tree for the first time.
func _ready():
	body_entered.connect(on_body_entered)


func on_body_entered(body):
	if !body.is_in_group('player'):
		return

	if KILL_ALL_NPCS:
		if body.is_in_group("npc"):
			body.queue_free()
	if LEVEL_MESSAGE:
		if UI:
			UI.show_message(LEVEL_MESSAGE)
	for node in ENABLED_NODES:
		node.set_physics_process(true)
	for node in DISABLED_NODES:
		node.set_physics_process(false)
