static void CreateTerminalControls() { if (MyTerminalControlFactory.AreControlsCreated <MyGyro>()) { return; } var gyroPower = new MyTerminalControlSlider <MyGyro>("Power", MySpaceTexts.BlockPropertyTitle_GyroPower, MySpaceTexts.BlockPropertyDescription_GyroPower); gyroPower.Getter = (x) => x.GyroPower; gyroPower.Setter = (x, v) => { x.GyroPower = v; }; gyroPower.Writer = (x, result) => result.AppendInt32((int)(x.GyroPower * 100)).Append(" %"); gyroPower.DefaultValue = 1; gyroPower.EnableActions(MyTerminalActionIcons.INCREASE, MyTerminalActionIcons.DECREASE); MyTerminalControlFactory.AddControl(gyroPower); if (MyFakes.ENABLE_GYRO_OVERRIDE) { var gyroOverride = new MyTerminalControlCheckbox <MyGyro>("Override", MySpaceTexts.BlockPropertyTitle_GyroOverride, MySpaceTexts.BlockPropertyDescription_GyroOverride); gyroOverride.Getter = (x) => x.GyroOverride; gyroOverride.Setter = (x, v) => { x.GyroOverride = v; }; gyroOverride.EnableAction(); MyTerminalControlFactory.AddControl(gyroOverride); // Pitch = X axis, Yaw = Y axis, Roll = Z axis var gyroOverrideSliderY = new MyTerminalControlSlider <MyGyro>("Yaw", MySpaceTexts.BlockPropertyTitle_GyroYawOverride, MySpaceTexts.BlockPropertyDescription_GyroYawOverride); gyroOverrideSliderY.Getter = (x) => - x.m_gyroOverrideVelocity.Value.Y; gyroOverrideSliderY.Setter = (x, v) => { SetGyroTorqueYaw(x, -v); }; gyroOverrideSliderY.Writer = (x, result) => result.AppendDecimal(-x.m_gyroOverrideVelocity.Value.Y * MathHelper.RadiansPerSecondToRPM, 2).Append(" RPM"); gyroOverrideSliderY.Enabled = (x) => x.GyroOverride; gyroOverrideSliderY.DefaultValue = 0; gyroOverrideSliderY.SetDualLogLimits((x) => 0.01f * MathHelper.RPMToRadiansPerSecond, MaxAngularRadiansPerSecond, 0.05f); gyroOverrideSliderY.EnableActions(MyTerminalActionIcons.INCREASE, MyTerminalActionIcons.DECREASE); MyTerminalControlFactory.AddControl(gyroOverrideSliderY); var gyroOverrideSliderX = new MyTerminalControlSlider <MyGyro>("Pitch", MySpaceTexts.BlockPropertyTitle_GyroPitchOverride, MySpaceTexts.BlockPropertyDescription_GyroPitchOverride); gyroOverrideSliderX.Getter = (x) => x.m_gyroOverrideVelocity.Value.X; gyroOverrideSliderX.Setter = (x, v) => { SetGyroTorquePitch(x, v); }; gyroOverrideSliderX.Writer = (x, result) => result.AppendDecimal(x.m_gyroOverrideVelocity.Value.X * MathHelper.RadiansPerSecondToRPM, 2).Append(" RPM"); gyroOverrideSliderX.Enabled = (x) => x.GyroOverride; gyroOverrideSliderX.DefaultValue = 0; gyroOverrideSliderX.SetDualLogLimits((x) => 0.01f * MathHelper.RPMToRadiansPerSecond, MaxAngularRadiansPerSecond, 0.05f); gyroOverrideSliderX.EnableActions(MyTerminalActionIcons.INCREASE, MyTerminalActionIcons.DECREASE); MyTerminalControlFactory.AddControl(gyroOverrideSliderX); var gyroOverrideSliderZ = new MyTerminalControlSlider <MyGyro>("Roll", MySpaceTexts.BlockPropertyTitle_GyroRollOverride, MySpaceTexts.BlockPropertyDescription_GyroRollOverride); gyroOverrideSliderZ.Getter = (x) => - x.m_gyroOverrideVelocity.Value.Z; gyroOverrideSliderZ.Setter = (x, v) => { SetGyroTorqueRoll(x, -v); }; gyroOverrideSliderZ.Writer = (x, result) => result.AppendDecimal(-x.m_gyroOverrideVelocity.Value.Z * MathHelper.RadiansPerSecondToRPM, 2).Append(" RPM"); gyroOverrideSliderZ.Enabled = (x) => x.GyroOverride; gyroOverrideSliderZ.DefaultValue = 0; gyroOverrideSliderZ.SetDualLogLimits((x) => 0.01f * MathHelper.RPMToRadiansPerSecond, MaxAngularRadiansPerSecond, 0.05f); gyroOverrideSliderZ.EnableActions(MyTerminalActionIcons.INCREASE, MyTerminalActionIcons.DECREASE); MyTerminalControlFactory.AddControl(gyroOverrideSliderZ); } }
static void CreateTerminalControls() { if (MyTerminalControlFactory.AreControlsCreated<MyGyro>()) return; var gyroPower = new MyTerminalControlSlider<MyGyro>("Power", MySpaceTexts.BlockPropertyTitle_GyroPower, MySpaceTexts.BlockPropertyDescription_GyroPower); gyroPower.Getter = (x) => x.GyroPower; gyroPower.Setter = (x, v) => { x.GyroPower = v; }; gyroPower.Writer = (x, result) => result.AppendInt32((int)(x.GyroPower * 100)).Append(" %"); gyroPower.DefaultValue = 1; gyroPower.EnableActions(MyTerminalActionIcons.INCREASE, MyTerminalActionIcons.DECREASE); MyTerminalControlFactory.AddControl(gyroPower); if (MyFakes.ENABLE_GYRO_OVERRIDE) { var gyroOverride = new MyTerminalControlCheckbox<MyGyro>("Override", MySpaceTexts.BlockPropertyTitle_GyroOverride, MySpaceTexts.BlockPropertyDescription_GyroOverride); gyroOverride.Getter = (x) => x.GyroOverride; gyroOverride.Setter = (x, v) => { x.GyroOverride = v; }; gyroOverride.EnableAction(); MyTerminalControlFactory.AddControl(gyroOverride); // Pitch = X axis, Yaw = Y axis, Roll = Z axis var gyroOverrideSliderY = new MyTerminalControlSlider<MyGyro>("Yaw", MySpaceTexts.BlockPropertyTitle_GyroYawOverride, MySpaceTexts.BlockPropertyDescription_GyroYawOverride); gyroOverrideSliderY.Getter = (x) => -x.m_gyroOverrideVelocity.Value.Y; gyroOverrideSliderY.Setter = (x, v) => { SetGyroTorqueYaw(x, -v); }; gyroOverrideSliderY.Writer = (x, result) => result.AppendDecimal(-x.m_gyroOverrideVelocity.Value.Y * MathHelper.RadiansPerSecondToRPM, 2).Append(" RPM"); gyroOverrideSliderY.Enabled = (x) => x.GyroOverride; gyroOverrideSliderY.DefaultValue = 0; gyroOverrideSliderY.SetDualLogLimits((x) => 0.01f * MathHelper.RPMToRadiansPerSecond, MaxAngularRadiansPerSecond, 0.05f); gyroOverrideSliderY.EnableActions(MyTerminalActionIcons.INCREASE, MyTerminalActionIcons.DECREASE); MyTerminalControlFactory.AddControl(gyroOverrideSliderY); var gyroOverrideSliderX = new MyTerminalControlSlider<MyGyro>("Pitch", MySpaceTexts.BlockPropertyTitle_GyroPitchOverride, MySpaceTexts.BlockPropertyDescription_GyroPitchOverride); gyroOverrideSliderX.Getter = (x) => x.m_gyroOverrideVelocity.Value.X; gyroOverrideSliderX.Setter = (x, v) => { SetGyroTorquePitch(x, v); }; gyroOverrideSliderX.Writer = (x, result) => result.AppendDecimal(x.m_gyroOverrideVelocity.Value.X * MathHelper.RadiansPerSecondToRPM, 2).Append(" RPM"); gyroOverrideSliderX.Enabled = (x) => x.GyroOverride; gyroOverrideSliderX.DefaultValue = 0; gyroOverrideSliderX.SetDualLogLimits((x) => 0.01f * MathHelper.RPMToRadiansPerSecond, MaxAngularRadiansPerSecond, 0.05f); gyroOverrideSliderX.EnableActions(MyTerminalActionIcons.INCREASE, MyTerminalActionIcons.DECREASE); MyTerminalControlFactory.AddControl(gyroOverrideSliderX); var gyroOverrideSliderZ = new MyTerminalControlSlider<MyGyro>("Roll", MySpaceTexts.BlockPropertyTitle_GyroRollOverride, MySpaceTexts.BlockPropertyDescription_GyroRollOverride); gyroOverrideSliderZ.Getter = (x) => -x.m_gyroOverrideVelocity.Value.Z; gyroOverrideSliderZ.Setter = (x, v) => { SetGyroTorqueRoll(x, -v); }; gyroOverrideSliderZ.Writer = (x, result) => result.AppendDecimal(-x.m_gyroOverrideVelocity.Value.Z * MathHelper.RadiansPerSecondToRPM, 2).Append(" RPM"); gyroOverrideSliderZ.Enabled = (x) => x.GyroOverride; gyroOverrideSliderZ.DefaultValue = 0; gyroOverrideSliderZ.SetDualLogLimits((x) => 0.01f * MathHelper.RPMToRadiansPerSecond, MaxAngularRadiansPerSecond, 0.05f); gyroOverrideSliderZ.EnableActions(MyTerminalActionIcons.INCREASE, MyTerminalActionIcons.DECREASE); MyTerminalControlFactory.AddControl(gyroOverrideSliderZ); } }