예제 #1
0
        private void ReEnableStopConditions(KerbalEVA eva)
        {
            if (this.ladderStopCondition != null)
            {
                //Debug.Log("Re-enable LadderStop");

                try
                {
                    foreach (var item in eva.fsm.CurrentState.StateEvents)
                    {
                        if (item.name == "Ladder Stop")
                        {
                            item.OnCheckCondition = this.ladderStopCondition;
                        }
                    }
                }
                catch { }

                this.ladderStopCondition = null;
            }
            if (this.swimStopCondition != null)
            {
                //Debug.Log("Re-enable SwimStop");

                try
                {
                    foreach (var item in eva.fsm.CurrentState.StateEvents)
                    {
                        if (item.name == "Swim Stop")
                        {
                            item.OnCheckCondition = this.swimStopCondition;
                        }
                    }
                }
                catch { }

                this.swimStopCondition = null;
            }
            if (this.runStopCondition != null)
            {
                //Debug.Log("Re-enable RunStop");

                try
                {
                    foreach (var item in eva.fsm.CurrentState.StateEvents)
                    {
                        if (item.name == "End Run")
                        {
                            item.OnCheckCondition = this.runStopCondition;
                        }
                    }
                }
                catch { }
                this.runStopCondition = null;
            }
        }
 private void DisableSwimStopCondition(KerbalEVA eva)
 {
     if (this.swimStopCondition == null)
     {
         //Debug.Log("Disabling SwimStop");
         KFSMEvent eSwimStop = (KFSMEvent)eventFields[21].GetValue(eva); // Swim Stop
         this.swimStopCondition     = eSwimStop.OnCheckCondition;
         eSwimStop.OnCheckCondition = this.eventConditionDisabled;
     }
 }
 private void DisableLadderStopCondition(KerbalEVA eva)
 {
     if (this.ladderStopCondition == null)
     {
         //Debug.Log("Disabling LadderStop");
         KFSMEvent eLadderStop = (KFSMEvent)eventFields[26].GetValue(eva); // Ladder Stop
         this.ladderStopCondition     = eLadderStop.OnCheckCondition;
         eLadderStop.OnCheckCondition = this.eventConditionDisabled;
     }
 }
 private void DisableRunStopCondition(KerbalEVA eva)
 {
     if (this.runStopCondition == null)
     {
         //Debug.Log("Disabling RunStop");
         KFSMEvent eRunStop = (KFSMEvent)eventFields[3].GetValue(eva); // End Run
         this.runStopCondition     = eRunStop.OnCheckCondition;
         eRunStop.OnCheckCondition = this.eventConditionDisabled;
     }
 }
예제 #5
0
 /// <summary>
 /// Forcibly restores the ability to drop parts in the editor
 /// </summary>
 public void RestorePartDropping()
 {
     if (st_place_Backup != null)
     {
         EditorLogic.fetch.GetType().GetField("st_place", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.FlattenHierarchy)?.SetValue(EditorLogic.fetch, st_place_Backup);
         st_place_Backup = null;
         Logging.DebugLog("Restored st_place");
     }
     if (on_partDropped_Backup != null)
     {
         KFSMEvent on_partDropped = EditorLogic.fetch.GetType().GetField("on_partDropped", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.FlattenHierarchy)?.GetValue(EditorLogic.fetch) as KFSMEvent;
         if (on_partDropped != null)
         {
             on_partDropped.OnCheckCondition = on_partDropped_Backup;
             on_partDropped_Backup           = null;
             Logging.DebugLog("Restored on_partDropped");
         }
     }
 }
예제 #6
0
        private void DisableSwimStopCondition(KerbalEVA eva)
        {
            if (this.swimStopCondition == null)
            {
                //Debug.Log("Disabling SwimStop");

                try
                {
                    foreach (var item in eva.fsm.CurrentState.StateEvents)
                    {
                        if (item.name == "Swim Stop")
                        {
                            this.swimStopCondition = item.OnCheckCondition;
                            item.OnCheckCondition  = this.eventConditionDisabled;
                        }
                    }
                }
                catch { }
            }
        }
예제 #7
0
 /// <summary>
 /// Forcibly disables the ability to drop parts in the editor
 /// </summary>
 public void DisablePartDropping()
 {
     if (on_partDropped_Backup == null)
     {
         KFSMEvent on_partDropped = EditorLogic.fetch.GetType().GetField("on_partDropped", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.FlattenHierarchy)?.GetValue(EditorLogic.fetch) as KFSMEvent;
         if (on_partDropped != null)
         {
             on_partDropped_Backup           = on_partDropped.OnCheckCondition;
             on_partDropped.OnCheckCondition = (s) => false;
             Logging.DebugLog("Disabled on_partDropped");
         }
     }
     if (st_place_Backup == null)
     {
         KFSMState st_place = EditorLogic.fetch.GetType().GetField("st_place", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.FlattenHierarchy)?.GetValue(EditorLogic.fetch) as KFSMState;
         if (st_place != null)
         {
             st_place_Backup = st_place;
             EditorLogic.fetch.GetType().GetField("st_place", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.FlattenHierarchy)?.SetValue(EditorLogic.fetch, null);
             Logging.DebugLog("Disabled st_place");
         }
     }
 }
 private void ReEnableStopConditions(KerbalEVA eva)
 {
     if (this.ladderStopCondition != null)
     {
         //Debug.Log("Re-enable LadderStop");
         KFSMEvent eLadderStop = (KFSMEvent)eventFields[26].GetValue(eva);
         eLadderStop.OnCheckCondition = this.ladderStopCondition;
         this.ladderStopCondition     = null;
     }
     if (this.swimStopCondition != null)
     {
         //Debug.Log("Re-enable SwimStop");
         KFSMEvent eSwimStop = (KFSMEvent)eventFields[21].GetValue(eva);
         eSwimStop.OnCheckCondition = this.swimStopCondition;
         this.swimStopCondition     = null;
     }
     if (this.runStopCondition != null)
     {
         //Debug.Log("Re-enable RunStop");
         KFSMEvent eRunStop = (KFSMEvent)eventFields[3].GetValue(eva);
         eRunStop.OnCheckCondition = this.runStopCondition;
         this.runStopCondition     = null;
     }
 }
 /// <summary>
 /// You can call this function and pass to it a function that takes a KFSMState
 /// and returns a boolean. That function will be called every update cycle while
 /// this tutorial page is active. If the function ever returns true, the tutorial
 /// will automatically advance to the next page.
 /// </summary>
 /// <param name="condition"></param>
 public extern void SetAdvanceCondition(KFSMEventCondition condition);
 /// <summary>
 /// You can call this function and pass to it a function that takes a KFSMState
 /// and returns a boolean. That function will be called every update cycle while
 /// this tutorial page is active. If the function ever returns true, the tutorial
 /// will automatically advance to the next page.
 /// </summary>
 /// <param name="condition"></param>
 public extern void SetAdvanceCondition(KFSMEventCondition condition);