//The main function! This EXACT coroutine will be executed, even across frames.
    //See GameAction.cs for more information on how this function should work!
    public override IEnumerator TakeAction()
    {
        if (goals.Count == 0)
        {
            #if UNITY_EDITOR || DEVELOPMENT_BUILD
            if (caller != Player.player)
            {
                Debug.LogError("Monster should never take movement action with NO goals!");
                caller.energy -= 10;
            }
            #endif
            yield break;
        }

        Path path = Pathfinding.CreateDjikstraPath(caller.location, goals);

        if (path.Cost() < 0)
        {
            Debug.LogWarning("Monster cannot find path to location! Aborting");
            yield break;
        }

        while (path.Count() > 0)
        {
            Vector2Int next = path.Pop();
            MoveAction act  = new MoveAction(next);

            caller.UpdateLOS();

            if (caller.view.visibleMonsters.FindAll(x => (x.faction & caller.faction) == 0).Count > 0)
            {
                Debug.Log($"Monster came into sight, so don't auto move!");
                yield break;
            }

            act.Setup(caller);
            while (act.action.MoveNext())
            {
                yield return(act.action.Current);
            }

            yield return(GameAction.StateCheck);
        }
    }
    //The main function! This EXACT coroutine will be executed, even across frames.
    //See GameAction.cs for more information on how this function should work!
    public override IEnumerator TakeAction()
    {
        while (true)
        {
            if (caller.view.visibleMonsters.FindAll(x => x.IsEnemy(caller)).Count > 0)
            {
                Debug.Log("Console: You cannot auto-explore while enemies are in sight.");
                yield break;
            }

            //TODO: Rest action first!

            //Build up the points we need!
            List <Vector2Int> goals = new List <Vector2Int>();
            for (int i = 1; i < Map.current.width - 1; i++)
            {
                for (int j = 1; j < Map.current.height - 1; j++)
                {
                    Vector2Int pos = new Vector2Int(i, j);
                    if (Map.current.NeedsExploring(pos))
                    {
                        goals.Add(pos);
                    }
                }
            }

            if (goals.Count == 0)
            {
                Debug.Log("Nothing left to explore!");
                yield break;
            }

            Path path = Pathfinding.CreateDjikstraPath(caller.location, goals.ToArray());

            if (path.Count() == 0)
            {
                Debug.Log("Can't reach anymore spaces!");
                yield break;
            }

            while (path.Count() > 0)
            {
                Vector2Int next = path.Pop();
                MoveAction act  = new MoveAction(next);

                caller.UpdateLOS();

                if (caller.view.visibleMonsters.FindAll(x => x.IsEnemy(caller)).Count > 0)
                {
                    Debug.Log($"Monster came into sight, stopping auto explore!");
                    yield break;
                }

                act.Setup(caller);
                while (act.action.MoveNext())
                {
                    yield return(act.action.Current);
                }

                yield break;

                yield return(GameAction.StateCheck);
            }
        }
    }