コード例 #1
0
ファイル: AutoActionEditor.cs プロジェクト: Acea-K/AutoAction
        void RefreshPartModule(ModuleAutoAction module)
        {
            module.ActivateAbort  = _activateAbort;
            module.ActivateBrakes = _activateBrakes;
            module.ActivateGear   = _activateGear;
            module.ActivateLights = _activateLights;
            module.ActivateRcs    = _activateRcs;
            module.ActivateSas    = _activateSas;

            module.SetThrottle = _setThrottle;
            module.SetPrecCtrl = _setPrecCtrl;

            module.ActivateGroupA = _activateGroupA;
            module.ActivateGroupB = _activateGroupB;
            module.ActivateGroupC = _activateGroupC;
            module.ActivateGroupD = _activateGroupD;
            module.ActivateGroupE = _activateGroupE;
        }
コード例 #2
0
        void ProcessModule(ModuleAutoAction module)
        {
            var actionGroups = FlightGlobals.ActiveVessel.ActionGroups;

            actionGroups.SetGroup(KSPActionGroup.Abort, module.ActivateAbort ?? _defaultActivateAbort);
            actionGroups.SetGroup(KSPActionGroup.Brakes, module.ActivateBrakes ?? _defaultActivateBrakes);
            actionGroups.SetGroup(KSPActionGroup.Gear, module.ActivateGear ?? _defaultActivateGear);
            actionGroups.SetGroup(KSPActionGroup.Light, module.ActivateLights ?? _defaultActivateLights);
            actionGroups.SetGroup(KSPActionGroup.RCS, module.ActivateRcs ?? _defaultActivateRcs);
            actionGroups.SetGroup(KSPActionGroup.SAS, module.ActivateSas ?? _defaultActivateSas);

            FlightInputHandler.state.mainThrottle = Mathf.Max(0, Mathf.Min(1, (module.SetThrottle ?? _defaultSetThrottle) / 100F));
            SetPrecisionMode(module.SetPrecCtrl ?? _defaultSetPrecCtrl);

            CallActionGroup(module.ActivateGroupA);
            CallActionGroup(module.ActivateGroupB);
            CallActionGroup(module.ActivateGroupC);
            CallActionGroup(module.ActivateGroupD);
            CallActionGroup(module.ActivateGroupE);
        }
コード例 #3
0
        void ProcessModule(ModuleAutoAction module)
        {
            var actionGroups = FlightGlobals.ActiveVessel.ActionGroups;

            actionGroups.SetGroup(KSPActionGroup.Abort, module.ActivateAbort ?? _defaultActivateAbort);
            actionGroups.SetGroup(KSPActionGroup.Brakes, module.ActivateBrakes ?? _defaultActivateBrakes);
            actionGroups.SetGroup(KSPActionGroup.RCS, module.ActivateRcs ?? _defaultActivateRcs);
            actionGroups.SetGroup(KSPActionGroup.SAS, module.ActivateSas ?? _defaultActivateSas);

            if (module.ActivateGear.HasValue)
            {
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Gear);
                if (module.ActivateGear.Value != FlightGlobals.ActiveVessel.ActionGroups[KSPActionGroup.Gear])
                {
                    FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Gear);
                }
            }
            if (module.ActivateLights.HasValue)
            {
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Light);
                if (module.ActivateLights.Value != FlightGlobals.ActiveVessel.ActionGroups[KSPActionGroup.Light])
                {
                    FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Light);
                }
            }

            FlightInputHandler.state.mainThrottle = Mathf.Max(0, Mathf.Min(1, (module.SetThrottle ?? _defaultSetThrottle) / 100F));
            SetPrecisionMode(module.SetPrecCtrl ?? _defaultSetPrecCtrl);

            FlightInputHandler.state.pitchTrim         = TrimStep * module.SetPitchTrim;
            FlightInputHandler.state.yawTrim           = TrimStep * module.SetYawTrim;
            FlightInputHandler.state.rollTrim          = TrimStep * module.SetRollTrim;
            FlightInputHandler.state.wheelThrottleTrim = TrimStep * module.SetWheelMotorTrim;
            FlightInputHandler.state.wheelSteerTrim    = -TrimStep * module.SetWheelSteerTrim;          // Inverted

            CallActionGroup(module.ActivateGroupA);
            CallActionGroup(module.ActivateGroupB);
            CallActionGroup(module.ActivateGroupC);
            CallActionGroup(module.ActivateGroupD);
            CallActionGroup(module.ActivateGroupE);
        }
コード例 #4
0
        void RefreshPartModule(ModuleAutoAction module)
        {
            module.ActivateAbort  = _activateAbort;
            module.ActivateBrakes = _activateBrakes;
            module.ActivateGear   = _activateGear;
            module.ActivateLights = _activateLights;
            module.ActivateRcs    = _activateRcs;
            module.ActivateSas    = _activateSas;

            module.SetThrottle = _setThrottle;
            module.SetPrecCtrl = _setPrecCtrl;

            module.ActivateGroupA = _activateGroupA;
            module.ActivateGroupB = _activateGroupB;
            module.ActivateGroupC = _activateGroupC;
            module.ActivateGroupD = _activateGroupD;
            module.ActivateGroupE = _activateGroupE;

            module.SetPitchTrim      = _setPitchTrimString.ParseNullableInt(minValue: -500, maxValue: 500) ?? 0;
            module.SetYawTrim        = _setYawTrimString.ParseNullableInt(minValue: -500, maxValue: 500) ?? 0;
            module.SetRollTrim       = _setRollTrimString.ParseNullableInt(minValue: -500, maxValue: 500) ?? 0;
            module.SetWheelMotorTrim = _setWheelMotorTrimString.ParseNullableInt(minValue: -500, maxValue: 500) ?? 0;
            module.SetWheelSteerTrim = _setWheelSteerTrimString.ParseNullableInt(minValue: -500, maxValue: 500) ?? 0;
        }