示例#1
0
            public StaticVariables()
            {
                Logger.DebugLog("entered", Logger.severity.TRACE);
                TerminalControlHelper.EnsureTerminalControlCreated <MyProgrammableBlock>();

                MyTerminalAction <MyProgrammableBlock> programmable_sendMessage = new MyTerminalAction <MyProgrammableBlock>("SendMessage", new StringBuilder("Send Message"), "Textures\\GUI\\Icons\\Actions\\Start.dds")
                {
                    ValidForGroups       = false,
                    ActionWithParameters = ProgrammableBlock_SendMessage
                };

                programmable_sendMessage.ParameterDefinitions.Add(Ingame.TerminalActionParameter.Get(string.Empty));
                programmable_sendMessage.ParameterDefinitions.Add(Ingame.TerminalActionParameter.Get(string.Empty));
                programmable_sendMessage.ParameterDefinitions.Add(Ingame.TerminalActionParameter.Get(string.Empty));
                MyTerminalControlFactory.AddAction(programmable_sendMessage);

                MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator <MyProgrammableBlock>());

                handleDetected = new MyTerminalControlOnOffSwitch <MyProgrammableBlock>("HandleDetected", MyStringId.GetOrCompute("Handle Detected"));
                new ValueSync <bool, ProgrammableBlock>(handleDetected, (prog) => prog.value_handleDetectedTerminal, (prog, value) => prog.value_handleDetectedTerminal = value);
                MyTerminalControlFactory.AddControl(handleDetected);

                blockCountList = new MyTerminalControlTextbox <MyProgrammableBlock>("BlockCounts", MyStringId.GetOrCompute("Blocks to Count"), MyStringId.GetOrCompute("Comma separated list of blocks to count"));
                new StringBuilderSync <ProgrammableBlock>(blockCountList, (prog) => prog.value_blockCountList, (prog, value) => {
                    prog.value_blockCountList = value;
                    prog.m_blockCountList_btl = new BlockTypeList(prog.m_blockCountList_sb.ToString().LowerRemoveWhitespace().Split(','));
                });
                MyTerminalControlFactory.AddControl(blockCountList);
            }
        static MyProgrammableBlock()
        {
            var console = new MyTerminalControlButton <MyProgrammableBlock>("Edit", MySpaceTexts.TerminalControlPanel_EditCode, MySpaceTexts.TerminalControlPanel_EditCode_Tooltip, (b) => b.SyncObject.SendOpenEditorRequest(Sync.MyId));

            console.Visible = (b) => MyFakes.ENABLE_PROGRAMMABLE_BLOCK && MySession.Static.EnableIngameScripts;
            MyTerminalControlFactory.AddControl(console);

            var arg = new MyTerminalControlTextbox <MyProgrammableBlock>("ConsoleCommand", MySpaceTexts.TerminalControlPanel_RunArgument, MySpaceTexts.TerminalControlPanel_RunArgument_ToolTip);

            arg.Visible = (e) => MyFakes.ENABLE_PROGRAMMABLE_BLOCK && MySession.Static.EnableIngameScripts;
            arg.Getter  = (e) => new StringBuilder(e.TerminalRunArgument);
            arg.Setter  = (e, v) => e.TerminalRunArgument = v.ToString();
            MyTerminalControlFactory.AddControl(arg);

            var terminalRun = new MyTerminalControlButton <MyProgrammableBlock>("TerminalRun", MySpaceTexts.TerminalControlPanel_RunCode, MySpaceTexts.TerminalControlPanel_RunCode_Tooltip, (b) => b.Run());

            terminalRun.Visible = (b) => MyFakes.ENABLE_PROGRAMMABLE_BLOCK && MySession.Static.EnableIngameScripts;
            terminalRun.Enabled = (b) => b.IsWorking == true && b.IsFunctional == true;
            MyTerminalControlFactory.AddControl(terminalRun);

            var runAction = new MyTerminalAction <MyProgrammableBlock>("Run", MyTexts.Get(MySpaceTexts.TerminalControlPanel_RunCode), OnRunApplied, null, MyTerminalActionIcons.START);

            runAction.Enabled = (b) => b.IsWorking == true && b.IsFunctional == true;
            runAction.DoUserParameterRequest = RequestRunArgument;
            runAction.ParameterDefinitions.Add(TerminalActionParameter.Get(string.Empty));
            MyTerminalControlFactory.AddAction(runAction);
        }
示例#3
0
        static void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated <MyPistonBase>())
            {
                return;
            }

            var reverse = new MyTerminalControlButton <MyPistonBase>("Reverse", MySpaceTexts.BlockActionTitle_Reverse, MySpaceTexts.Blank, (x) => x.Velocity.Value = -x.Velocity);

            reverse.EnableAction(MyTerminalActionIcons.REVERSE);
            MyTerminalControlFactory.AddControl(reverse);

            var extendAction = new MyTerminalAction <MyPistonBase>("Extend", MyTexts.Get(MySpaceTexts.BlockActionTitle_Extend), OnExtendApplied, null, MyTerminalActionIcons.REVERSE);

            extendAction.Enabled = (b) => b.IsFunctional == true;
            MyTerminalControlFactory.AddAction(extendAction);

            var retractAction = new MyTerminalAction <MyPistonBase>("Retract", MyTexts.Get(MySpaceTexts.BlockActionTitle_Retract), OnRetractApplied, null, MyTerminalActionIcons.REVERSE);

            retractAction.Enabled = (b) => b.IsFunctional == true;
            MyTerminalControlFactory.AddAction(retractAction);

            var velocity = new MyTerminalControlSlider <MyPistonBase>("Velocity", MySpaceTexts.BlockPropertyTitle_Velocity, MySpaceTexts.Blank);

            velocity.SetLimits((block) => - block.BlockDefinition.MaxVelocity, (block) => block.BlockDefinition.MaxVelocity);
            velocity.DefaultValue = -0.5f;
            velocity.Getter       = (x) => x.Velocity;
            velocity.Setter       = (x, v) => x.Velocity.Value = v;
            velocity.Writer       = (x, res) => res.AppendDecimal(x.Velocity, 1).Append("m/s");
            velocity.EnableActionsWithReset();
            MyTerminalControlFactory.AddControl(velocity);

            var maxDist = new MyTerminalControlSlider <MyPistonBase>("UpperLimit", MySpaceTexts.BlockPropertyTitle_MaximalDistance, MySpaceTexts.Blank);

            maxDist.SetLimits((block) => block.BlockDefinition.Minimum, (block) => block.BlockDefinition.Maximum);
            maxDist.DefaultValueGetter = (block) => block.BlockDefinition.Maximum;
            maxDist.Getter             = (x) => x.MaxLimit;
            maxDist.Setter             = (x, v) => x.MaxLimit.Value = v;
            maxDist.Writer             = (x, res) => res.AppendDecimal(x.MaxLimit, 1).Append("m");
            maxDist.EnableActions();
            MyTerminalControlFactory.AddControl(maxDist);

            var minDist = new MyTerminalControlSlider <MyPistonBase>("LowerLimit", MySpaceTexts.BlockPropertyTitle_MinimalDistance, MySpaceTexts.Blank);

            minDist.SetLimits((block) => block.BlockDefinition.Minimum, (block) => block.BlockDefinition.Maximum);
            minDist.DefaultValueGetter = (block) => block.BlockDefinition.Minimum;
            minDist.Getter             = (x) => x.MinLimit;
            minDist.Setter             = (x, v) => x.MinLimit.Value = v;
            minDist.Writer             = (x, res) => res.AppendDecimal(x.MinLimit, 1).Append("m");
            minDist.EnableActions();
            MyTerminalControlFactory.AddControl(minDist);


            var addPistonHead = new MyTerminalControlButton <MyPistonBase>("Add Piston Head", MySpaceTexts.BlockActionTitle_AddPistonHead, MySpaceTexts.BlockActionTooltip_AddPistonHead, (b) => b.RecreateTop());

            addPistonHead.Enabled = (b) => (b.m_topBlock == null);
            addPistonHead.EnableAction(MyTerminalActionIcons.STATION_ON);
            MyTerminalControlFactory.AddControl(addPistonHead);
        }
示例#4
0
        protected override void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated <MyLandingGear>())
            {
                return;
            }
            base.CreateTerminalControls();
            var stateWriter = new MyTerminalControl <MyLandingGear> .WriterDelegate((b, sb) => b.WriteLockStateValue(sb));

            var lockBtn = new MyTerminalControlButton <MyLandingGear>("Lock", MySpaceTexts.BlockActionTitle_Lock, MySpaceTexts.Blank, (b) => b.RequestLandingGearLock());

            lockBtn.Enabled = (b) => b.IsWorking;
            lockBtn.EnableAction(MyTerminalActionIcons.TOGGLE, (MyStringId?)null, stateWriter);
            MyTerminalControlFactory.AddControl(lockBtn);

            var unlockBtn = new MyTerminalControlButton <MyLandingGear>("Unlock", MySpaceTexts.BlockActionTitle_Unlock, MySpaceTexts.Blank, (b) => b.RequestLandingGearUnlock());

            unlockBtn.Enabled = (b) => b.IsWorking;
            unlockBtn.EnableAction(MyTerminalActionIcons.TOGGLE, (MyStringId?)null, stateWriter);
            MyTerminalControlFactory.AddControl(unlockBtn);

            var title = MyTexts.Get(MySpaceTexts.BlockActionTitle_SwitchLock);
            MyTerminalAction <MyLandingGear> switchLockAction = new MyTerminalAction <MyLandingGear>("SwitchLock", title, MyTerminalActionIcons.TOGGLE);

            switchLockAction.Action = (b) => b.RequestLandingGearSwitch();
            switchLockAction.Writer = stateWriter;
            MyTerminalControlFactory.AddAction(switchLockAction);

            var autoLock = new MyTerminalControlCheckbox <MyLandingGear>("Autolock", MySpaceTexts.BlockPropertyTitle_LandGearAutoLock, MySpaceTexts.Blank);

            autoLock.Getter = (b) => b.m_autoLock;
            autoLock.Setter = (b, v) => b.m_autoLock.Value = v;
            autoLock.EnableAction();
            MyTerminalControlFactory.AddControl(autoLock);

            if (MyFakes.LANDING_GEAR_BREAKABLE)
            {
                var brakeForce = new MyTerminalControlSlider <MyLandingGear>("BreakForce", MySpaceTexts.BlockPropertyTitle_BreakForce, MySpaceTexts.BlockPropertyDescription_BreakForce);
                brakeForce.Getter       = (x) => x.BreakForce;
                brakeForce.Setter       = (x, v) => x.m_breakForceSync.Value = v;
                brakeForce.DefaultValue = 1;
                brakeForce.Writer       = (x, result) =>
                {
                    if (x.BreakForce >= MyObjectBuilder_LandingGear.MaxSolverImpulse)
                    {
                        result.AppendStringBuilder(MyTexts.Get(MySpaceTexts.BlockPropertyValue_MotorAngleUnlimited));
                    }
                    else
                    {
                        MyValueFormatter.AppendForceInBestUnit(x.BreakForce, result);
                    }
                };
                brakeForce.Normalizer   = (b, v) => ThresholdToRatio(v);
                brakeForce.Denormalizer = (b, v) => RatioToThreshold(v);
                brakeForce.EnableActions();
                MyTerminalControlFactory.AddControl(brakeForce);
            }
        }
示例#5
0
 private static void AddAction(MyTerminalAction <MyShipController> action)
 {
     action.Enabled = ShipAutopilot.IsAutopilotBlock;
     MyTerminalControlFactory.AddAction <MyShipController, MyCockpit>(action);
     if (ServerSettings.GetSetting <bool>(ServerSettings.SettingName.bUseRemoteControl))
     {
         MyTerminalControlFactory.AddAction <MyShipController, MyRemoteControl>(action);
     }
 }
示例#6
0
        static MyPistonBase()
        {
            var reverse = new MyTerminalControlButton <MyPistonBase>("Reverse", MySpaceTexts.BlockActionTitle_Reverse, MySpaceTexts.Blank, (x) => x.SyncObject.SetVelocity(-x.Velocity));

            reverse.EnableAction(MyTerminalActionIcons.REVERSE);
            MyTerminalControlFactory.AddControl(reverse);

            var extendAction = new MyTerminalAction <MyPistonBase>("Extend", MyTexts.Get(MySpaceTexts.BlockActionTitle_Extend), OnExtendApplied, null, MyTerminalActionIcons.REVERSE);

            extendAction.Enabled = (b) => b.IsWorking == true && b.IsFunctional == true;
            MyTerminalControlFactory.AddAction(extendAction);

            var retractAction = new MyTerminalAction <MyPistonBase>("Retract", MyTexts.Get(MySpaceTexts.BlockActionTitle_Retract), OnRetractApplied, null, MyTerminalActionIcons.REVERSE);

            retractAction.Enabled = (b) => b.IsWorking == true && b.IsFunctional == true;
            MyTerminalControlFactory.AddAction(retractAction);

            var velocity = new MyTerminalControlSlider <MyPistonBase>("Velocity", MySpaceTexts.BlockPropertyTitle_Velocity, MySpaceTexts.Blank);

            velocity.SetLimits((block) => - block.BlockDefinition.MaxVelocity, (block) => block.BlockDefinition.MaxVelocity);
            velocity.DefaultValue = -0.5f;
            velocity.Getter       = (x) => x.Velocity;
            velocity.Setter       = (x, v) => x.SyncObject.SetVelocity(v);
            velocity.Writer       = (x, res) => res.AppendDecimal(x.Velocity, 1).Append("m/s");
            velocity.EnableActionsWithReset();
            MyTerminalControlFactory.AddControl(velocity);

            var maxDist = new MyTerminalControlSlider <MyPistonBase>("UpperLimit", MySpaceTexts.BlockPropertyTitle_MaximalDistance, MySpaceTexts.Blank);

            maxDist.SetLimits((block) => block.BlockDefinition.Minimum, (block) => block.BlockDefinition.Maximum);
            maxDist.DefaultValueGetter = (block) => block.BlockDefinition.Maximum;
            maxDist.Getter             = (x) => x.MaxLimit;
            maxDist.Setter             = (x, v) => x.SyncObject.SetMax(v);
            maxDist.Writer             = (x, res) => res.AppendDecimal(x.MaxLimit, 1).Append("m");
            maxDist.EnableActions();
            MyTerminalControlFactory.AddControl(maxDist);

            var minDist = new MyTerminalControlSlider <MyPistonBase>("LowerLimit", MySpaceTexts.BlockPropertyTitle_MinimalDistance, MySpaceTexts.Blank);

            minDist.SetLimits((block) => block.BlockDefinition.Minimum, (block) => block.BlockDefinition.Maximum);
            minDist.DefaultValueGetter = (block) => block.BlockDefinition.Minimum;
            minDist.Getter             = (x) => x.MinLimit;
            minDist.Setter             = (x, v) => x.SyncObject.SetMin(v);
            minDist.Writer             = (x, res) => res.AppendDecimal(x.MinLimit, 1).Append("m");
            minDist.EnableActions();
            MyTerminalControlFactory.AddControl(minDist);
        }
        public static void JumpSelectAction()
        {
            MyTerminalAction <MyJumpDrive> myTerminalAction = new MyTerminalAction <MyJumpDrive>("JumpSelect", new StringBuilder("Jump Select"), MyTerminalActionIcons.STATION_ON);

            myTerminalAction.Action = new Action <MyJumpDrive>(ShowJumpSelector);
            myTerminalAction.Writer = delegate(MyJumpDrive block, StringBuilder builder)
            {
                builder.Append("Jump Select");
            };
            myTerminalAction.ValidForGroups      = false;
            myTerminalAction.InvalidToolbarTypes = new List <MyToolbarType>
            {
                MyToolbarType.Character,
                MyToolbarType.Seat
            };
            MyTerminalControlFactory.AddAction <MyJumpDrive>(myTerminalAction);
        }
        protected override void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated <MyProgrammableBlock>())
            {
                return;
            }
            base.CreateTerminalControls();
            var console = new MyTerminalControlButton <MyProgrammableBlock>("Edit", MySpaceTexts.TerminalControlPanel_EditCode, MySpaceTexts.TerminalControlPanel_EditCode_Tooltip, (b) => b.SendOpenEditorRequest());

            console.Visible = (b) => MyFakes.ENABLE_PROGRAMMABLE_BLOCK && MySession.Static.EnableIngameScripts;
            console.Enabled = (b) => MySession.Static.IsScripter;
            MyTerminalControlFactory.AddControl(console);

            var arg = new MyTerminalControlTextbox <MyProgrammableBlock>("ConsoleCommand", MySpaceTexts.TerminalControlPanel_RunArgument, MySpaceTexts.TerminalControlPanel_RunArgument_ToolTip);

            arg.Visible = (e) => MyFakes.ENABLE_PROGRAMMABLE_BLOCK && MySession.Static.EnableIngameScripts;
            arg.Getter  = (e) => new StringBuilder(e.TerminalRunArgument);
            arg.Setter  = (e, v) => e.TerminalRunArgument = v.ToString();
            MyTerminalControlFactory.AddControl(arg);

            var terminalRun = new MyTerminalControlButton <MyProgrammableBlock>("TerminalRun", MySpaceTexts.TerminalControlPanel_RunCode, MySpaceTexts.TerminalControlPanel_RunCode_Tooltip, (b) => b.Run());

            terminalRun.Visible = (b) => MyFakes.ENABLE_PROGRAMMABLE_BLOCK && MySession.Static.EnableIngameScripts;
            terminalRun.Enabled = (b) => b.IsWorking == true && b.IsFunctional == true;
            MyTerminalControlFactory.AddControl(terminalRun);

            var recompile = new MyTerminalControlButton <MyProgrammableBlock>("Recompile", MySpaceTexts.TerminalControlPanel_Recompile, MySpaceTexts.TerminalControlPanel_Recompile_Tooltip, (b) => b.Recompile());

            recompile.Visible = (b) => MyFakes.ENABLE_PROGRAMMABLE_BLOCK && MySession.Static.EnableIngameScripts;
            recompile.Enabled = (b) => b.IsWorking == true && b.IsFunctional == true;
            MyTerminalControlFactory.AddControl(recompile);

            var runAction = new MyTerminalAction <MyProgrammableBlock>("Run", MyTexts.Get(MySpaceTexts.TerminalControlPanel_RunCode), OnRunApplied, null, MyTerminalActionIcons.START);

            runAction.Enabled = (b) => b.IsFunctional == true;
            runAction.DoUserParameterRequest = RequestRunArgument;
            runAction.ParameterDefinitions.Add(TerminalActionParameter.Get(string.Empty));
            MyTerminalControlFactory.AddAction(runAction);

            var runwithDefault = new MyTerminalAction <MyProgrammableBlock>("RunWithDefaultArgument", MyTexts.Get(MySpaceTexts.TerminalControlPanel_RunCodeDefault), OnRunDefaultApplied, MyTerminalActionIcons.START);

            runwithDefault.Enabled = (b) => b.IsFunctional == true;
            MyTerminalControlFactory.AddAction(runwithDefault);
        }
示例#9
0
 protected override void CreateTerminalControls()
 {
     if (!MyTerminalControlFactory.AreControlsCreated <MyBatteryBlock>())
     {
         base.CreateTerminalControls();
         MyTerminalControlCombobox <MyBatteryBlock> combobox1 = new MyTerminalControlCombobox <MyBatteryBlock>("ChargeMode", MySpaceTexts.BlockPropertyTitle_ChargeMode, MySpaceTexts.Blank);
         combobox1.ComboBoxContent = new Action <List <MyTerminalControlComboBoxItem> >(MyBatteryBlock.FillChargeModeCombo);
         combobox1.Getter          = x => (long)x.ChargeMode;
         MyTerminalControlCombobox <MyBatteryBlock> local4 = combobox1;
         MyTerminalControlCombobox <MyBatteryBlock> local5 = combobox1;
         local5.Setter = (x, v) => x.ChargeMode = (Sandbox.ModAPI.Ingame.ChargeMode)((int)v);
         MyTerminalControlCombobox <MyBatteryBlock> control = local5;
         control.SetSerializerRange(MyEnum <Sandbox.ModAPI.Ingame.ChargeMode> .Range.Min, MyEnum <Sandbox.ModAPI.Ingame.ChargeMode> .Range.Max);
         MyTerminalControlFactory.AddControl <MyBatteryBlock>(control);
         MyTerminalControlFactory.AddAction <MyBatteryBlock>(new MyTerminalAction <MyBatteryBlock>("Recharge", MyTexts.Get(MySpaceTexts.BlockActionTitle_RechargeToggle), new Action <MyBatteryBlock>(MyBatteryBlock.OnRechargeToggle), new MyTerminalControl <MyBatteryBlock> .WriterDelegate(MyBatteryBlock.WriteChargeModeValue), MyTerminalActionIcons.TOGGLE));
         MyTerminalControlFactory.AddAction <MyBatteryBlock>(new MyTerminalAction <MyBatteryBlock>("Discharge", MyTexts.Get(MySpaceTexts.BlockActionTitle_DischargeToggle), new Action <MyBatteryBlock>(MyBatteryBlock.OnDischargeToggle), new MyTerminalControl <MyBatteryBlock> .WriterDelegate(MyBatteryBlock.WriteChargeModeValue), MyTerminalActionIcons.TOGGLE));
         MyTerminalControlFactory.AddAction <MyBatteryBlock>(new MyTerminalAction <MyBatteryBlock>("Auto", MyTexts.Get(MySpaceTexts.BlockActionTitle_AutoEnable), new Action <MyBatteryBlock>(MyBatteryBlock.OnAutoEnabled), new MyTerminalControl <MyBatteryBlock> .WriterDelegate(MyBatteryBlock.WriteChargeModeValue), MyTerminalActionIcons.TOGGLE));
     }
 }
示例#10
0
        private static void CreateTerminal()
        {
            Logger.DebugLog("entered", Logger.severity.TRACE);
            TerminalControlHelper.EnsureTerminalControlCreated <MyTextPanel>();

            MyTerminalAction <MyTextPanel> textPanel_displayEntities = new MyTerminalAction <MyTextPanel>("DisplayEntities", new StringBuilder("Display Entities"), "Textures\\GUI\\Icons\\Actions\\Start.dds")
            {
                ValidForGroups       = false,
                ActionWithParameters = TextPanel_DisplayEntities
            };

            MyTerminalControlFactory.AddAction(textPanel_displayEntities);

            MyTerminalControlFactory.AddControl(new MyTerminalControlSeparator <MyTextPanel>());

            AddCheckbox("DisplayDetected", "Display Detected", "Write detected entities to the public text of the panel", Option.DisplayDetected);
            AddCheckbox("DisplayGPS", "Display GPS", "Write gps with detected entities", Option.GPS);
            AddCheckbox("DisplayEntityId", "Display Entity ID", "Write entity ID with detected entities", Option.EntityId);
            AddCheckbox("DisplayAutopilotStatus", "Display Autopilot Status", "Write the status of nearby Autopilots to the public text of the panel", Option.AutopilotStatus);
        }
示例#11
0
        static MyPistonBase()
        {
            var reverse = new MyTerminalControlButton <MyPistonBase>("Reverse", MySpaceTexts.BlockActionTitle_Reverse, MySpaceTexts.Blank, (x) => x.Velocity.Value = -x.Velocity);

            reverse.EnableAction(MyTerminalActionIcons.REVERSE);
            MyTerminalControlFactory.AddControl(reverse);

            var extendAction = new MyTerminalAction <MyPistonBase>("Extend", MyTexts.Get(MySpaceTexts.BlockActionTitle_Extend), OnExtendApplied, null, MyTerminalActionIcons.REVERSE);

            extendAction.Enabled = (b) => b.IsWorking == true && b.IsFunctional == true;
            MyTerminalControlFactory.AddAction(extendAction);

            var retractAction = new MyTerminalAction <MyPistonBase>("Retract", MyTexts.Get(MySpaceTexts.BlockActionTitle_Retract), OnRetractApplied, null, MyTerminalActionIcons.REVERSE);

            retractAction.Enabled = (b) => b.IsWorking == true && b.IsFunctional == true;
            MyTerminalControlFactory.AddAction(retractAction);

            var velocity = new MyTerminalControlSlider <MyPistonBase>("Velocity", MySpaceTexts.BlockPropertyTitle_Velocity, MySpaceTexts.Blank);

            velocity.SetLimits((block) => - block.BlockDefinition.MaxVelocity, (block) => block.BlockDefinition.MaxVelocity);
            velocity.DefaultValue = -0.5f;
            velocity.Getter       = (x) => x.Velocity;
            velocity.Setter       = (x, v) => x.Velocity.Value = v;
            velocity.Writer       = (x, res) => res.AppendDecimal(x.Velocity, 1).Append("m/s");
            velocity.EnableActionsWithReset();
            MyTerminalControlFactory.AddControl(velocity);

            var maxDist = new MyTerminalControlSlider <MyPistonBase>("UpperLimit", MySpaceTexts.BlockPropertyTitle_MaximalDistance, MySpaceTexts.Blank);

            maxDist.SetLimits((block) => block.BlockDefinition.Minimum, (block) => block.BlockDefinition.Maximum);
            maxDist.DefaultValueGetter = (block) => block.BlockDefinition.Maximum;
            maxDist.Getter             = (x) => x.MaxLimit;
            maxDist.Setter             = (x, v) => x.MaxLimit.Value = v;
            maxDist.Writer             = (x, res) => res.AppendDecimal(x.MaxLimit, 1).Append("m");
            maxDist.EnableActions();
            MyTerminalControlFactory.AddControl(maxDist);

            var minDist = new MyTerminalControlSlider <MyPistonBase>("LowerLimit", MySpaceTexts.BlockPropertyTitle_MinimalDistance, MySpaceTexts.Blank);

            minDist.SetLimits((block) => block.BlockDefinition.Minimum, (block) => block.BlockDefinition.Maximum);
            minDist.DefaultValueGetter = (block) => block.BlockDefinition.Minimum;
            minDist.Getter             = (x) => x.MinLimit;
            minDist.Setter             = (x, v) => x.MinLimit.Value = v;
            minDist.Writer             = (x, res) => res.AppendDecimal(x.MinLimit, 1).Append("m");
            minDist.EnableActions();
            MyTerminalControlFactory.AddControl(minDist);

            var weldSpeed = new MyTerminalControlSlider <MyPistonBase>("Weld speed", MySpaceTexts.BlockPropertyTitle_WeldSpeed, MySpaceTexts.Blank);

            weldSpeed.SetLimits((block) => 0f, (block) => MyGridPhysics.SmallShipMaxLinearVelocity());
            weldSpeed.DefaultValueGetter = (block) => MyGridPhysics.LargeShipMaxLinearVelocity() - 5f;
            weldSpeed.Getter             = (x) => (float)Math.Sqrt(x.m_weldSpeedSq);
            weldSpeed.Setter             = (x, v) => x.m_weldSpeedSq.Value = v * v;
            weldSpeed.Writer             = (x, res) => res.AppendDecimal((float)Math.Sqrt(x.m_weldSpeedSq), 1).Append("m/s");
            weldSpeed.EnableActions();
            MyTerminalControlFactory.AddControl(weldSpeed);

            var weldForce = new MyTerminalControlCheckbox <MyPistonBase>("Force weld", MySpaceTexts.BlockPropertyTitle_WeldForce, MySpaceTexts.Blank);

            weldForce.Getter = (x) => x.m_forceWeld;
            weldForce.Setter = (x, v) => x.m_forceWeld.Value = v;
            weldForce.EnableAction();
            MyTerminalControlFactory.AddControl(weldForce);
        }