internal void TakeNextAIAction()
    //Does the next available AI action, or if none remain, passes turn to the player. This is called every time the game is idle during the AI turn
    {
        bool allActionsComplete = true;

        foreach (EnemyProgram program in GetAIControlledPrograms())
        {
            if (!program.hasUsedAIAction)
            {
                if (program.HasTarget())
                {
                    program.HandleAIAttack();
                    allActionsComplete = false;
                    break;
                }
                else if (program.movesLeft > 0)
                {
                    program.ExecuteAIMovement();
                    allActionsComplete = false;
                    break;
                }
                Consumer consumer = program.GetComponent <Consumer>();
                if (consumer && program.GetState() == EnemyProgram.State.Attack)
                {
                    consumer.SelectConsumeTarget();
                    consumer.AttemptConsume();
                }
            }
        }
        if (allActionsComplete)
        {
            EndTurn();
        }
    }