Example #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);
     }
 }
Example #2
0
 public static bool AGX2VslActivateGroup(uint FlightID, int group, bool forceDir) //other vessel, direct activate group
 {
     Log.trace("Call: Activate group for {0} for vessel {1} in dir {2}", group, FlightID, forceDir);
     if (HighLogic.LoadedSceneIsFlight)
     {
         if (FlightGlobals.ActiveVessel.rootPart.flightID == FlightID)
         {
             //Log.dbg("this vsl");
             AGXFlight.ActivateActionGroupActivation(group, true, forceDir);
             return(true);
         }
         else
         {
             //Log.dbg("other vsl");
             //ScreenMessages.PostScreenMessage("AGX Action Fail, other vessels not implemented yet", 10F, ScreenMessageStyle.UPPER_CENTER);
             //return false;
             AGXOtherVessel otherVsl = new AGXOtherVessel(FlightID);
             otherVsl.ActivateActionGroupActivation(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);
     }
 }
Example #3
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);
     }
 }
Example #4
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);
     }
 }
Example #5
0
 public static bool AGXToggleGroup(int i) //2 on test, works //toggle action group on activevessel
 {
     Log.trace("Call: toggle group {0} for active vessel", i);
     if (HighLogic.LoadedSceneIsFlight)
     {
         AGXFlight.ActivateActionGroupActivation(i, false, false);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #6
0
 public static bool AGXActivateGroup(int i, bool forceDir) //activate action group it forceDir direction, true = force activate
 {
     Log.trace("Call: activate group for {0} for active vessel in dir {1}", i, forceDir);
     if (HighLogic.LoadedSceneIsFlight)
     {
         AGXFlight.ActivateActionGroupActivation(i, true, forceDir);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #7
0
 public static bool RTDataReceive(ConfigNode node) //receive data back from RT
 {
     Debug.Log("AGX Call: RemoteTechCallback");
     if (HighLogic.LoadedSceneIsFlight)
     {
         if (FlightGlobals.ActiveVessel.rootPart.flightID == Convert.ToUInt32(node.GetValue("FlightID")))
         {
             AGXFlight.ActivateActionGroupActivation(Convert.ToInt32(node.GetValue("Group")), Convert.ToBoolean(node.GetValue("Force")), Convert.ToBoolean(node.GetValue("ForceDir")));
         }
         else
         {
             AGXOtherVessel otherVsl = new AGXOtherVessel(Convert.ToUInt32(node.GetValue("FlightID")));
             otherVsl.ActivateActionGroupActivation(Convert.ToInt32(node.GetValue("Group")), Convert.ToBoolean(node.GetValue("Force")), Convert.ToBoolean(node.GetValue("ForceDir")));
         }
     }
     else
     {
         ScreenMessages.PostScreenMessage("AGX Action Not Activated, Remotetech passed invalid vessel", 10F, ScreenMessageStyle.UPPER_CENTER);
     }
     return(false);
 }
Example #8
0
 public static bool AGX2VslToggleGroup(uint FlightID, int group) //other vessel direct toggle activate
 {
     print("AGX Call: toggle action " + group + " for vessel " + FlightID);
     if (HighLogic.LoadedSceneIsFlight)
     {
         if (FlightGlobals.ActiveVessel.rootPart.flightID == FlightID)
         {
             AGXFlight.ActivateActionGroupActivation(group, false, false);
             return(true);
         }
         else
         {
             AGXOtherVessel otherVsl = new AGXOtherVessel(FlightID);
             otherVsl.ActivateActionGroupActivation(group, false, false);
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }
Example #9
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);
     }
 }
Example #10
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);
     }
 }
Example #11
0
 public static bool AGXToggleGroupName(string grpName) //untested,
 {
     try
     {
         Log.trace("Call: toggle group by name for {0} for active vessel", grpName);
         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.ActivateActionGroupActivation(grp, false, false);
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else //not in flight
         {
             return(false);
         }
     }
     catch
     {
         Log.err("Call FAIL! Catch block hit");
         return(false);
     }
 }