extends Area2D

func _on_body_entered(body: Node2D) -> void:

	if not body.is_in_group("player"):
		return

	var parent = get_parent()
	if parent.get("is_dying") != null:
		if parent.get("is_dying"):
			return

	body.set_physics_process(false)
	body.set_process(false)
	body.get_node("CollisionShape2D").set_deferred("disabled", true)

	var force_reload = parent.get("is_dying") == null
	get_tree().get_first_node_in_group("game_manager").take_damage(force_reload)
