using System.Linq;
using Godot;

namespace Cirno.Scripts.Controllers;

[Tool]
public partial class RogueliteDoorContainer : Node2D
{
    [ExportToolButton("Arrange Doors")] public Callable ArrangeDoorsButton => Callable.From(ArrangeDoors);

    public void ArrangeDoors()
    {
        var doors = this.GetChildren();

        foreach (var node in doors)
        {
            if (node is DoorMarker doorMarker)
            {
                GD.Print($"{doorMarker.Name} {doorMarker.Direction} {doorMarker.WallIndex}");
            }
            else
            {
                GD.Print($"Node was something else: {node}");
            }
        }
        
    }
}