using System.Collections.Generic;
using Sandbox.ModAPI.Ingame;

namespace IngameScript
{
    partial class Program
    {
        public enum ThrusterAction
        {
            Enable,
            Disable,
        }

        public class BlockActionThruster : BlockAction
        {
            private IMyThrust _thruster;
            private ThrusterAction _action;

            public BlockActionThruster(
                IMyThrust thruster,
                ThrusterAction action
            )
            {
                _thruster = thruster;
                _action = action;
            }

            protected override IEnumerator<bool> onRun()
            {
                switch (_action)
                {
                    case ThrusterAction.Enable:
                        _thruster.Enabled = true;
                        break;
                    case ThrusterAction.Disable:
                        _thruster.Enabled = false;
                        break;
                }
                yield return true;
            }
        }
    }
}