Exemplo n.º 1
0
 public static bool AGX2VslActivateGroupDelayCheck(uint FlightID, int group, bool forceDir) //other vessel, with delay check
 {
     print("AGX Call: Activate group for " + group + " for vessel " + FlightID + " in dir " + forceDir);
     if (HighLogic.LoadedSceneIsFlight)
     {
         if (FlightGlobals.ActiveVessel.rootPart.flightID == FlightID)
         {
             //print("this vsl");
             AGXFlight.ActivateActionGroup(group, true, forceDir);
             return(true);
         }
         else
         {
             //print("other vsl");
             //ScreenMessages.PostScreenMessage("AGX Action Fail, other vessels not implemented yet", 10F, ScreenMessageStyle.UPPER_CENTER);
             //return false;
             AGXOtherVessel otherVsl = new AGXOtherVessel(FlightID);
             otherVsl.ActivateActionGroup(group, true, forceDir);
             return(true);
         }
     }
     else
     {
         // ScreenMessages.PostScreenMessage("AGX Action Not Activated, not in flight", 10F, ScreenMessageStyle.UPPER_CENTER);
         ScreenMessages.PostScreenMessage(Localizer.Format("#AGEXT_UI_SCREEN_MESSAGE_3"), 10F, ScreenMessageStyle.UPPER_CENTER);
         return(false);
     }
 }
Exemplo n.º 2
0
 public static bool AGXToggleGroupDelayCheck(int i) //2 on test, works //toggle action group on activevessel
 {
     print("AGX Call: toggle group " + i + " for active vessel");
     if (HighLogic.LoadedSceneIsFlight)
     {
         AGXFlight.ActivateActionGroup(i);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 3
0
 public static bool AGXActivateGroupDelayCheck(int i, bool forceDir) //activate action group it forceDir direction, true = force activate with delay check
 {
     print("AGX Call: activate group for " + i + " for active vessel in dir " + forceDir);
     if (HighLogic.LoadedSceneIsFlight)
     {
         AGXFlight.ActivateActionGroup(i, true, forceDir);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 4
0
 public static bool AGX2VslToggleGroupDelayCheck(uint FlightID, int group) //other vessel toggle, delay check
 {
     print("AGX Call: toggle action " + group + " for vessel " + FlightID);
     if (HighLogic.LoadedSceneIsFlight)
     {
         if (FlightGlobals.ActiveVessel.rootPart.flightID == FlightID)
         {
             AGXFlight.ActivateActionGroup(group);
             return(true);
         }
         else
         {
             AGXOtherVessel otherVsl = new AGXOtherVessel(FlightID);
             otherVsl.ActivateActionGroup(group, false, false);
             return(true);
         }
     }
     else
     {
         ScreenMessages.PostScreenMessage("AGX Action Not Activated, not in flight", 10F, ScreenMessageStyle.UPPER_CENTER);
         return(false);
     }
 }
Exemplo n.º 5
0
 public static bool AGXActivateGroupNameDelayCheck(string grpName, bool forceDir) //untested
 {
     try
     {
         print("AGX Call: activate group by name for " + grpName + " for active vessel in dir " + forceDir);
         if (HighLogic.LoadedSceneIsFlight) //only workes in flight
         {
             int grp = 0;
             try
             {
                 grp = AGXFlight.AGXguiNames.First(pair => pair.Value.ToLower() == grpName.ToLower()).Key; //compare strings, case does not matter
             }
             catch                                                                                         //poor man's error trap, name was not found. what is the correct way to do this?
             {
                 return(false);
             }
             if (grp >= 1 && grp <= 250) //check grp is valid
             {
                 AGXFlight.ActivateActionGroup(grp, true, forceDir);
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else //not in flight
         {
             return(false);
         }
     }
     catch
     {
         print("AGX Call FAIL! Catch block hit");
         return(false);
     }
 }