space_engineers/Mixins/ActionGroups/BlockActionThruster.cs

43 lines
1.0 KiB
C#

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;
}
}
}
}