/// <summary>
 /// Trigger whatever action the PartModule has attached to this Action, given the kOS name for the action.
 /// Warning - it probably triggers the entire action group that is attached to this action if there is one,
 /// not just the action on this one part.
 /// <br/><br/>
 /// NOTE: After kOS 0.15.5, this ability is limited by career progress of the VAB/SPH.
 /// </summary>
 /// <param name="suffixName"></param>
 /// <param name="param">true = activate, false = de-activate</param>
 private void CallKSPAction(StringValue suffixName, BooleanValue param)
 {
     ThrowIfNotCPUVessel();
     BaseAction act = GetAction(suffixName);
     if (act == null)
         throw new KOSLookupFailException("ACTION", suffixName, this);
     string careerReason;
     if (!Career.CanDoActions(out careerReason))
         throw new KOSLowTechException("use :DOACTION", careerReason);
     act.Invoke(new KSPActionParam(act.actionGroup, (param ? KSPActionType.Activate : KSPActionType.Deactivate)));
 }
Esempio n. 2
0
        /// <summary>
        /// Trigger whatever action the PartModule has attached to this Action, given the kOS name for the action.
        /// Warning - it probably triggers the entire action group that is attached to this action if there is one,
        /// not just the action on this one part.
        /// <br/><br/>
        /// NOTE: After kOS 0.15.5, this ability is limited by career progress of the VAB/SPH.
        /// </summary>
        /// <param name="suffixName"></param>
        /// <param name="param">true = activate, false = de-activate</param>
        private void CallKSPAction(string suffixName, bool param)
        {
            BaseAction act = GetAction(suffixName);

            if (act == null)
            {
                throw new KOSLookupFailException("ACTION", suffixName, this);
            }
            string careerReason;

            if (!Career.CanDoActions(out careerReason))
            {
                throw new KOSLowTechException("use :DOACTION", careerReason);
            }
            act.Invoke(new KSPActionParam(act.actionGroup, (param ? KSPActionType.Activate : KSPActionType.Deactivate)));
        }