void EnableRC(List <MyWaypointInfo> inList, out List <MyWaypointInfo> outList) { rc.ClearWaypoints(); List <MyWaypointInfo> tempList = new List <MyWaypointInfo>(); foreach (MyWaypointInfo point in inList) { tempList.Add(point); } outList = tempList; rc.SetDockingMode(true); rc.SetCollisionAvoidance(true); rc.SetAutoPilotEnabled(true); rc.FlightMode = FlightMode.OneWay; }
public void Climb() { Echo("Target Grav: " + TargetGravity.ToString() + "m/s"); Echo("Accel Force (m/s): " + Accel.ToString() + "m/s"); Echo("Accel Time: " + AccelTime.ToString() + "s"); Echo("Stop Distance: " + stopDistance.ToString() + "m"); if (Elev >= (TargetAltitude - stopDistance)) { CCOff.ApplyAction("TriggerNow"); CruiseCon = false; RController.DampenersOverride = true; RControllers.SetAutoPilotEnabled(true); RControllers.SetCollisionAvoidance(false); RControllers.SetDockingMode(true); Main("Seperate"); } }
string doInit() { // initialization of each module goes here: // when all initialization is done, set init to true. Echo(gtsAllBlocks.Count.ToString() + " Blocks"); Echo("Init:" + currentInit); if (currentInit == 0) { // StatusLog("clear", textLongStatus, true); // only MAIN module should clear long status on init. StatusLog(DateTime.Now.ToString() + " " + OurName + ":" + moduleName + ":INIT", textLongStatus, true); /* * add commands to set modes * if(!modeCommands.ContainsKey("launchprep")) modeCommands.Add("launchprep", MODE_LAUNCHPREP); */ sInitResults += gridsInit(); initLogging(); initTimers(); sInitResults += SerializeInit(); Deserialize(); // get info from savefile to avoid blind-rewrite of (our) defaults } else if (currentInit == 1) { Deserialize();// get info from savefile to avoid blind-rewrite of (our) defaults // sInitResults += BlockInit(); sInitResults += DefaultOrientationBlockInit(); initCargoCheck(); initPower(); sInitResults += thrustersInit(shipOrientationBlock); sInitResults += gyrosetup(); // if (gtsAllBlocks.Count < 300) currentInit = 2; // go ahead and do next step. if (shipOrientationBlock is IMyRemoteControl) { Vector3D playerPosition; bool bGotPlayer = ((IMyRemoteControl)shipOrientationBlock).GetNearestPlayer(out playerPosition); IMyRemoteControl myR = (IMyRemoteControl)shipOrientationBlock; myR.SetCollisionAvoidance(false); myR.SetDockingMode(false); myR.Direction = Base6Directions.Direction.Forward; myR.FlightMode = FlightMode.OneWay; myR.ClearWaypoints(); myR.AddWaypoint(playerPosition, "Name"); } } if (currentInit == 2) { sInitResults += wheelsInit(shipOrientationBlock); sInitResults += rotorsNavInit(); sInitResults += connectorsInit(); sInitResults += tanksInit(); sInitResults += drillInit(); // if (gtsAllBlocks.Count < 100) currentInit = 3; // go ahead and do next step. } if (currentInit == 3) { sInitResults += camerasensorsInit(shipOrientationBlock); sInitResults += ejectorsInit(); sInitResults += antennaInit(); sInitResults += gasgenInit(); autoConfig(); bWantFast = false; if (bGotAntennaName) { sBanner = "*" + OurName + ":" + moduleName + " V" + sVersion + " "; } if (sBanner.Length > 34) { sBanner = OurName + ":" + moduleName + "\nV" + sVersion + " "; } if (shipOrientationBlock is IMyShipController) { MyShipMass myMass; myMass = ((IMyShipController)shipOrientationBlock).CalculateShipMass(); gridBaseMass = myMass.BaseMass; } sInitResults += modeOnInit(); // handle mode initializing from load/recompile.. init = true; // we are done } currentInit++; if (init) { currentInit = 0; } Log(sInitResults); return(sInitResults); }
public void Main(string argument, UpdateType updateSource) { string[] argInfo = argument.Split(new string[] { "," }, StringSplitOptions.None); if (argument == "RUN") { //Check if can scan, and scan if can. if (cam.CanScan(rayCastDistance)) { detectedInfo = cam.Raycast(rayCastDistance); } else { Echo("Can't scan yet!"); } Echo("INITIATING"); coordinate = Vector3D.Zero; //initating to zero value. Boolean found = false; if (detectedInfo.HitPosition != null) { coordinate = detectedInfo.HitPosition.Value; found = true; } if (found) { Vector3D currentCoords = rc.GetPosition(); //creating unit vector double denominator = Math.Sqrt(Math.Pow(coordinate.X - currentCoords.X, 2) + Math.Pow(coordinate.Y - currentCoords.Y, 2) + Math.Pow(coordinate.Z - currentCoords.Z, 2)); double xMultiplier = (coordinate.X - currentCoords.X) / denominator; double yMultiplier = (coordinate.Y - currentCoords.Y) / denominator; double zMultiplier = (coordinate.Z - currentCoords.Z) / denominator; //manipulating target coordinate with unit vector coordinate.X -= finalDistFromTarget * xMultiplier; coordinate.Y -= finalDistFromTarget * yMultiplier; coordinate.Z -= finalDistFromTarget * zMultiplier; //Setting up backward thrusters list backwardThrusters = new List <IMyThrust>(); //Obtaining each thruster pointing backward foreach (IMyThrust thruster in thrusters) { if (Base6Directions.GetFlippedDirection(rc.Orientation.Forward) == Base6Directions.GetFlippedDirection(thruster.Orientation.Forward)) { backwardThrusters.Add(thruster); } } //Obtaining max backward acceleration MyShipMass myShipMass = rc.CalculateShipMass(); backwardsAcceleration = CalculateAcceleration(myShipMass.TotalMass, backwardThrusters); //autopilot settings rc.ClearWaypoints(); rc.AddWaypoint(coordinate, "AUTO DYNAMIC BRAKING SCRIPT COORDINATE"); rc.SetAutoPilotEnabled(true); rc.SetCollisionAvoidance(false); rc.SetDockingMode(false); //CHANGE??? or dont? rc.FlightMode = FlightMode.OneWay; rc.Direction = Base6Directions.Direction.Forward; blindMode = false; } } else if (argInfo[0] == "blind".ToLower()) { int dist = 0; Boolean passed = Int32.TryParse(argInfo[1], out dist); if (passed) { Vector3D dir = rc.WorldMatrix.Forward; coordinate = rc.GetPosition(); coordinate.X += dir.X * dist; coordinate.Y += dir.Y * dist; coordinate.Z += dir.Z * dist; Vector3D currentCoords = rc.GetPosition(); //Setting up backward thrusters list backwardThrusters = new List <IMyThrust>(); //Obtaining each thruster pointing backward foreach (IMyThrust thruster in thrusters) { if (Base6Directions.GetFlippedDirection(rc.Orientation.Forward) == Base6Directions.GetFlippedDirection(thruster.Orientation.Forward)) { backwardThrusters.Add(thruster); } } //Obtaining max backward acceleration MyShipMass myShipMass = rc.CalculateShipMass(); backwardsAcceleration = CalculateAcceleration(myShipMass.TotalMass, backwardThrusters); //autopilot settings rc.ClearWaypoints(); rc.AddWaypoint(coordinate, "CAPTXAN'S SCRIPT COORDINATE"); rc.SetAutoPilotEnabled(true); rc.SetCollisionAvoidance(false); rc.SetDockingMode(false); //CHANGE??? or dont? rc.FlightMode = FlightMode.OneWay; rc.Direction = Base6Directions.Direction.Forward; blindMode = true; blindCounter = 0; } else { Echo("2nd parameter is not a number!"); } } else { //User Feedback if (!cam.CanScan(rayCastDistance)) { float percentage = ((cam.TimeUntilScan(rayCastDistance) / 1000) / (rayCastDistance / 2000)); percentage = (1 - percentage) * 100; Echo("Raycast is recharging " + percentage + "%"); if (!cam.EnableRaycast) { cam.EnableRaycast = true; } } else { Echo("Ready to Scan"); cam.EnableRaycast = false; } //Travelling CHANGE HERE FOR ENABLE / DISABLE AUTOPILOT if (rc.IsAutoPilotEnabled) { travelling = true; double currentDistanceFromTarget = Vector3D.Distance(coordinate, rc.GetPosition()); Echo("Travelling, ETA: " + (int)(currentDistanceFromTarget / rc.GetShipSpeed()) + "s"); //Calculating stopping distance to determine if thrusters need to be enabled. Echo("Current Speed: " + (int)rc.GetShipSpeed() + "m/s"); Echo("Ship Speed Limit: " + rc.SpeedLimit + "m/s"); if (rc.GetShipSpeed() > rc.SpeedLimit - 1) //If ship at max speed { Vector3D currentTrajectory = Vector3D.Normalize(rc.GetPosition() - prevPosition); prevPosition = rc.GetPosition(); Vector3D calculatedTrajectory = Vector3D.Normalize(rc.GetPosition() - coordinate); double accuracyAmount; if (currentDistanceFromTarget > 15000) { accuracyAmount = .99999; } else if (currentDistanceFromTarget > 5000) { accuracyAmount = .9999; } else { accuracyAmount = .999; } if (currentDistanceFromTarget * .90 > (Math.Pow(rc.GetShipSpeed(), 2) / (2 * backwardsAcceleration)) && Math.Abs(currentTrajectory.Dot(calculatedTrajectory)) > accuracyAmount) { foreach (IMyThrust thruster in thrusters) { thruster.ApplyAction("OnOff_Off"); } } else //Curr < stopp { foreach (IMyThrust thruster in thrusters) { thruster.ApplyAction("OnOff_On"); } } } Echo("Blind Mode: " + blindMode); if (blindMode) { Echo("Blind Counter: " + blindCounter); Echo("Coll Avoid: " + rc.); if (cam.CanScan(((Math.Pow(rc.GetShipSpeed(), 2) / (2 * backwardsAcceleration)) * 2))) { detectedInfo = cam.Raycast((Math.Pow(maxSpeed, 2) / (2 * backwardsAcceleration)) * 2); if (detectedInfo.HitPosition != null) { rc.SpeedLimit = 3; rc.SetCollisionAvoidance(true); blindCounter = 0; } else { if (blindCounter > 500) { rc.SpeedLimit = maxSpeed; rc.SetCollisionAvoidance(false); blindCounter = 0; } else { blindCounter++; } } } } } else if (travelling) { foreach (IMyThrust thruster in thrusters) { thruster.ApplyAction("OnOff_On"); } travelling = false; blindMode = false; } } //Additional Arugment Commands if (argument == "ABORT") { rc.SetAutoPilotEnabled(false); rc.DampenersOverride = true; } }
string doInit() { // initialization of each module goes here: // when all initialization is done, set init to true. // Echo(gtsAllBlocks.Count.ToString() + " Blocks"); if (bStartupError) { Echo("(RE)INIT:" + sStartupError); } do { // Echo("Init:" + currentInit); echoInstructions("Init:" + currentInit + " "); if (bStartupError) { Echo("ERROR: Need (RE)INIT:" + sStartupError); Echo(sStartupError); } switch (currentInit) { case 0: sStartupError = ""; if (bStartupError) { gridsInit(); // check the entire grid again } bStartupError = false; StatusLog(DateTime.Now.ToString() + " " + OurName + ":" + moduleName + ":INIT", textLongStatus, true); break; case 1: /* * add commands to set modes * if(!modeCommands.ContainsKey("launchprep")) modeCommands.Add("launchprep", MODE_LAUNCHPREP); */ if (!modeCommands.ContainsKey("doscans")) { modeCommands.Add("doscans", MODE_DOSCAN); } break; case 2: sInitResults += gridsInit(); break; case 3: initLogging(); break; case 4: initTimers(); break; case 5: sInitResults += SerializeInit(); Deserialize(); // get info from savefile to avoid blind-rewrite of (our) defaults break; case 6: sInitResults += DefaultOrientationBlockInit(); break; case 7: initCargoCheck(); break; case 8: initPower(); break; case 9: sInitResults += thrustersInit(shipOrientationBlock); break; case 10: sInitResults += gyrosetup(); break; case 11: if (shipOrientationBlock is IMyRemoteControl) { Vector3D playerPosition; bool bGotPlayer = ((IMyRemoteControl)shipOrientationBlock).GetNearestPlayer(out playerPosition); IMyRemoteControl myR = (IMyRemoteControl)shipOrientationBlock; myR.SetCollisionAvoidance(false); myR.SetDockingMode(false); myR.Direction = Base6Directions.Direction.Forward; myR.FlightMode = FlightMode.OneWay; myR.ClearWaypoints(); /* * if (bGotPlayer) * { * // we are a pirate faction. chase the player. * myR.AddWaypoint(playerPosition, "Name"); * myR.SetAutoPilotEnabled(true); * setMode(MODE_ATTACK); * } */ } break; case 12: sInitResults += wheelsInit(shipOrientationBlock); break; case 13: sInitResults += rotorsNavInit(); break; case 14: sInitResults += connectorsInit(); break; case 15: sInitResults += tanksInit(); break; case 16: sInitResults += drillInit(); break; case 17: // sInitResults += camerasensorsInit(shipOrientationBlock); break; case 18: sInitResults += ejectorsInit(); break; case 19: sInitResults += antennaInit(); break; case 20: sInitResults += gasgenInit(); break; case 21: autoConfig(); break; case 22: // bWantFast = false; if (bGotAntennaName) { sBanner = "*" + OurName + ":" + moduleName + " V" + sVersion + " "; } if (sBanner.Length > 34) { sBanner = OurName + ":" + moduleName + "\nV" + sVersion + " "; } if (shipOrientationBlock is IMyShipController) { MyShipMass myMass; myMass = ((IMyShipController)shipOrientationBlock).CalculateShipMass(); gridBaseMass = myMass.BaseMass; } sInitResults += modeOnInit(); // handle mode initializing from load/recompile.. break; case 23: { // do startup error check init = true; // we are done // sStartupError = ""; // bStartupError = false; if (shipOrientationBlock == null) { shipOrientationBlock = Me; sStartupError += "\nUsing " + Me.CustomName + " as orientation"; //bStartupError = true; sStartupError += "\nNo Ship Controller"; dGravity = -1.0; } else { if (shipOrientationBlock is IMyShipController) { velocityShip = ((IMyShipController)shipOrientationBlock).GetShipSpeed(); Vector3D vNG = ((IMyShipController)shipOrientationBlock).GetNaturalGravity(); double dLength = vNG.Length(); dGravity = dLength / 9.81; } else { dGravity = -1.0; } } Echo("Grid Mass=" + gridBaseMass.ToString()); if (gridBaseMass > 0) { // Only require propulsion if not a station if (dGravity == 0) { if (ionThrustCount < 1 && hydroThrustCount < 1) { sStartupError += "\nIn Space, but no valid thrusters"; } } if (ionThrustCount < 1 && hydroThrustCount < 1 && atmoThrustCount < 1) { // no thrusters if (wheelSledList.Count < 1) { // no sled wheels && no thrusters if (rotorNavRightList.Count < 1) { if (wheelRightList.Count < 1) { //TODO: Detect station and it's OK to not go anywhere.. bStartupError = true; sStartupError += "\nNo Propulsion Method Found"; sStartupError += "\nNo Thrusters.\nNo NAV Rotors\nNo Sled Wheels\nNo Wheels"; } } } else { // sled wheels, but not thrusters... bStartupError = true; sStartupError += "\nNo Valid Propulsion Method Found"; sStartupError += "\nSled wheels, but No Thrusters.\nNo NAV Rotors"; if (gyros.Count < 1) { bStartupError = true; sStartupError = "\nSled wheels, but no Gyros"; } } } else { // we DO have thrusters if (gyros.Count < 1) { // thrusters, but no gyros bStartupError = true; sStartupError += "\nNo Gyros Found"; } // check for sled wheels? if (shipOrientationBlock is IMyShipController) { // can check gravity.. } } // check for [WCCS] timer, but no Wico Craft Save.. and vice-versa if (TimerTriggerFind(sSubModuleTimer)) { // there is a submodule timer trigger if (SaveFile == null) { // no save text panel bStartupError = true; sStartupError += "\nSubmodule timer, but no text\n panel named:" + SAVE_FILE_NAME; } } else { if (bSupportSubModules) { bStartupError = true; sStartupError += "\nSubmodules Enabled, but no\n timer containing:" + sSubModuleTimer; if (SaveFile == null) { // no save text panel bStartupError = true; sStartupError += "\n No text\n panel containing:" + SAVE_FILE_NAME; } } } } if (!bStartupError) { init = true; } else { currentInit = -1; // start init all over again } break; } } currentInit++; // echoInstructions("EInit:" + currentInit + " | "); // Echo("%=" + (float)Runtime.CurrentInstructionCount / (float)Runtime.MaxInstructionCount); }while (!init && (((float)Runtime.CurrentInstructionCount / (float)Runtime.MaxInstructionCount) < 0.2f)); if (init) { currentInit = 0; } if (bStartupError) { Echo("ERROR: Need (RE)INIT:" + sStartupError); } Echo(sStartupError); Log(sInitResults); return(sInitResults); }
string doInit() { // Echo("InitA:" + currentInit + ":"+Runtime.CurrentInstructionCount+ "/"+Runtime.MaxInstructionCount); // initialization of each module goes here: // when all initialization is done, set init to true. if (bStartupError) { Echo("(RE)INIT:" + sStartupError); } Log("Init:" + currentInit.ToString()); // Echo(gtsAllBlocks.Count.ToString() + " Blocks"); /* * double progress = currentInit * 100 / 3; // 3=Number of expected INIT phases. * string sProgress = progressBar(progress); * StatusLog(moduleName + sProgress, textPanelReport); */ if (shipOrientationBlock != null) { // anchorPosition = shipOrientationBlock; // currentPosition = anchorPosition.GetPosition(); } // Echo("InitB:" + currentInit + ":"+Runtime.CurrentInstructionCount+ "/"+Runtime.MaxInstructionCount); do { // Echo("Init:" + currentInit); echoInstructions("Init:" + currentInit + " "); switch (currentInit) { case 0: sStartupError = ""; if (bStartupError) { gridsInit(); // check the entire grid again } bStartupError = false; StatusLog(DateTime.Now.ToString() + " " + OurName + ":" + moduleName + ":INIT", textLongStatus, true); break; case 2: sInitResults += gridsInit(); break; case 3: initLogging(); break; case 4: initTimers(); break; case 5: sInitResults += SerializeInit(); Deserialize(); // get info from savefile to avoid blind-rewrite of (our) defaults break; case 6: sInitResults += DefaultOrientationBlockInit(); break; case 7: initCargoCheck(); break; case 8: initPower(); break; case 9: sInitResults += thrustersInit(shipOrientationBlock); break; case 10: sInitResults += gyrosetup(); GyroControl.UpdateGyroList(gyros); break; case 11: if (shipOrientationBlock is IMyRemoteControl) { Vector3D playerPosition; bool bGotPlayer = ((IMyRemoteControl)shipOrientationBlock).GetNearestPlayer(out playerPosition); IMyRemoteControl myR = (IMyRemoteControl)shipOrientationBlock; myR.SetCollisionAvoidance(false); myR.SetDockingMode(false); myR.Direction = Base6Directions.Direction.Forward; myR.FlightMode = FlightMode.OneWay; myR.ClearWaypoints(); /* * if (bGotPlayer) * { * // we are a pirate faction. chase the player. * myR.AddWaypoint(playerPosition, "Name"); * myR.SetAutoPilotEnabled(true); * setMode(MODE_ATTACK); * } */ } break; case 12: sInitResults += wheelsInit(shipOrientationBlock); break; case 13: sInitResults += rotorsNavInit(); break; case 14: sInitResults += connectorsInit(); break; case 15: sInitResults += tanksInit(); break; case 16: sInitResults += drillInit(); sInitResults += controllersInit(); break; case 17: sInitResults += SensorInit(shipOrientationBlock); break; case 18: sInitResults += ejectorsInit(); break; case 19: sInitResults += antennaInit(); break; case 20: sInitResults += gasgenInit(); sInitResults += camerasensorsInit(shipOrientationBlock); sInitResults += airventInit(); break; case 21: autoConfig(); break; case 22: // bWantFast = false; if (bGotAntennaName) { sBanner = "*" + OurName + ":" + moduleName + " V" + sVersion + " "; } if (sBanner.Length > 34) { sBanner = OurName + ":" + moduleName + "\nV" + sVersion + " "; } if (shipOrientationBlock is IMyShipController) { MyShipMass myMass; myMass = ((IMyShipController)shipOrientationBlock).CalculateShipMass(); gridBaseMass = myMass.BaseMass; } sInitResults += modeOnInit(); // handle mode initializing from load/recompile.. break; case 23: // do startup error check init = true; // we are done sStartupError = ""; bStartupError = false; if (shipOrientationBlock == null) { bStartupError = true; sStartupError += "\nNo Ship Controller"; } if (ionThrustCount < 1 && hydroThrustCount < 1 && atmoThrustCount < 1) { // no thrusters if (wheelSledList.Count < 1) { // no sled wheels && no thrusters if (rotorNavRightList.Count < 1) { bStartupError = true; sStartupError += "\nNo Propulsion Method Found"; sStartupError += "\nNo Thrusters.\nNo NAV Rotors\nNo Sled Wheels"; } } else { // sled wheels, but not thrusters... bStartupError = true; sStartupError += "\nNo Valid Propulsion Method Found"; sStartupError += "\nSled wheels, but No Thrusters.\nNo NAV Rotors"; } } else { // we DO have thrusters if (gyros.Count < 1) { // thrusters, but no gyros bStartupError = true; sStartupError += "\nNo Gyros Found"; } // check for sled wheels? if (shipOrientationBlock is IMyShipController) { // can check gravity.. } } // check for [WCCS] timer, but no Wico Craft Save.. and vice-versa if (TimerTriggerFind(sSubModuleTimer)) { // there is a submodule timer trigger if (SaveFile == null) { // no save text panel bStartupError = true; sStartupError += "\nSubmodule timer, but no text\n panel named:" + SAVE_FILE_NAME; } } else { if (bSupportSubModules) { bStartupError = true; sStartupError += "\nSubmodules Enabled, but no\n timer containing:" + sSubModuleTimer; if (SaveFile == null) { // no save text panel bStartupError = true; sStartupError += "\n No text\n panel containing:" + SAVE_FILE_NAME; } } } if (!bStartupError) { init = true; } else { currentInit = -1; // start init all over again } break; } currentInit++; // echoInstructions("EInit:" + currentInit + " | "); // Echo("%=" + (float)Runtime.CurrentInstructionCount / (float)Runtime.MaxInstructionCount); }while (!init && (((float)Runtime.CurrentInstructionCount / (float)Runtime.MaxInstructionCount) < 0.2f)); /* * if (currentInit == 0) * { * // Echo("Init0:" + currentInit + ":"+Runtime.CurrentInstructionCount+ "/"+Runtime.MaxInstructionCount); * // StatusLog("clear", textLongStatus, true); // only MAIN module should clear long status on init. * StatusLog(DateTime.Now.ToString() + " " + OurName + ":" + moduleName + ":INIT", textLongStatus, true); * * sInitResults += gridsInit(); * initLogging(); * initTimers(); * sInitResults += SerializeInit(); * * Deserialize(); // get info from savefile to avoid blind-rewrite of (our) defaults * } * else if (currentInit == 1) * { * Deserialize();// get info from savefile to avoid blind-rewrite of (our) defaults * * sInitResults += DefaultOrientationBlockInit(); * initCargoCheck(); * initPower(); * sInitResults += thrustersInit(shipOrientationBlock); * sInitResults += gyrosetup(); * GyroControl.UpdateGyroList(gyros); * if (gtsAllBlocks.Count < 300) currentInit = 2; // go ahead and do next step. * } * if (currentInit == 2) * { * sInitResults += wheelsInit(shipOrientationBlock); * sInitResults += rotorsNavInit(); * sInitResults += wheelsInit(shipOrientationBlock); * sInitResults += sensorInit(true); * * if (gtsAllBlocks.Count < 100) currentInit = 3; // go ahead and do next step. * } * if (currentInit == 3) * { * sInitResults += connectorsInit(); * sInitResults += tanksInit(); * sInitResults += drillInit(); * sInitResults += controllersInit(); * if (gtsAllBlocks.Count < 100) currentInit = 4; // go ahead and do next step. * } * if (currentInit == 4) * { * sInitResults += ejectorsInit(); * sInitResults += antennaInit(); * sInitResults += gasgenInit(); * sInitResults += camerasensorsInit(shipOrientationBlock); * sInitResults += airventInit(); * * // Serialize(); * * autoConfig(); * bWantFast = false; * * if (bGotAntennaName) * sBanner = "*" + OurName + ":" + moduleName + " V" + sVersion + " "; * * if(sBanner.Length>34) * { * sBanner = OurName + ":" + moduleName + "\nV" + sVersion + " "; * } * * if (shipOrientationBlock is IMyShipController) * { * MyShipMass myMass; * myMass = ((IMyShipController)shipOrientationBlock).CalculateShipMass(); * * gridBaseMass = myMass.BaseMass; * }//// * initShipDim(shipOrientationBlock); * * sInitResults += modeOnInit(); // handle mode initializing from load/recompile.. * * if(currentInit==5) * { * sStartupError = ""; * bStartupError = false; * if (shipOrientationBlock == null) * { * bStartupError = true; * sStartupError += "\nNo Ship Controller"; * } * if (ionThrustCount < 1 && hydroThrustCount < 1 && atmoThrustCount < 1) * { * // no thrusters * if (wheelSledList.Count < 1) * { * // no sled wheels && no thrusters * if (rotorNavRightList.Count < 1) * { * bStartupError = true; * sStartupError += "\nNo Propulsion Method Found"; * sStartupError += "\nNo Thrusters.\nNo NAV Rotors\nNo Sled Wheels"; * * } * } * else * { * // sled wheels, but not thrusters... * bStartupError = true; * sStartupError += "\nNo Valid Propulsion Method Found"; * sStartupError += "\nSled wheels, but No Thrusters.\nNo NAV Rotors"; * } * } * else * { * // we DO have thrusters * if (gyros.Count < 1) * { * // thrusters, but no gyros * bStartupError = true; * sStartupError += "\nNo Gyros Found"; * } * // check for sled wheels? * if (shipOrientationBlock is IMyShipController) * { * // can check gravity.. * } * } * // check for [WCCS] timer, but no Wico Craft Save.. and vice-versa * if (TimerTriggerFind(sSubModuleTimer)) * { * // there is a submodule timer trigger * if (SaveFile == null) * { // no save text panel * * bStartupError = true; * sStartupError += "\nSubmodule timer, but no text\n panel named:" + SAVE_FILE_NAME; * * } * } * else * { * if (bSubModules) * { * bStartupError = true; * sStartupError += "\nSubmodules Enabled, but no\n timer containing:" + sSubModuleTimer; * if (SaveFile == null) * { // no save text panel * * bStartupError = true; * sStartupError += "\n No text\n panel containing:" + SAVE_FILE_NAME; * * } * * } * } * * } * init = true; // we are done * } * * currentInit++; */ if (init) { currentInit = 0; } Log(sInitResults); return(sInitResults); }