예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BonVoyage.ActiveRover"/> class.
        /// </summary>
        /// <param name="v">Vessel.</param>
        /// <param name="module">Bon Voyage Module.</param>
        /// <param name="vcf">Vessel Config Node.</param>
        public ActiveRover(Vessel v, ConfigNode module, ConfigNode vcf)
        {
            vessel           = v;
            vesselConfigNode = vcf;

            BVModule = module;

            bvActive = bool.Parse(BVModule.GetValue("isActive"));

            // Workaround for update from versions prior to 1.0
            try {
                isManned = bool.Parse(BVModule.GetValue("isManned"));
            } catch {
                isManned = true;
            }

            solarPowered = bool.Parse(BVModule.GetValue("solarPowered"));

            lastTime          = double.Parse(BVModule.GetValue("lastTime"));
            distanceTravelled = double.Parse(BVModule.GetValue("distanceTravelled"));
            distanceToTarget  = double.Parse(BVModule.GetValue("distanceToTarget"));
            targetLatitude    = double.Parse(BVModule.GetValue("targetLatitude"));
            targetLongitude   = double.Parse(BVModule.GetValue("targetLongitude"));
            averageSpeed      = double.Parse(BVModule.GetValue("averageSpeed"));

            path            = PathUtils.DecodePath(BVModule.GetValue("pathEncoded"));
            speedMultiplier = 1.0;
        }
예제 #2
0
        public void UpdateWayPoints()
        {
//			if (wayPoints != null) {
//				wayPoints.Clear ();
            wayPoints = PathUtils.DecodePath(currentModule.pathEncoded, currentModule.vessel.mainBody);
//			}
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BonVoyage.ActiveRover"/> class.
        /// </summary>
        /// <param name="v">Vessel.</param>
        /// <param name="module">Bon Voyage Module.</param>
        /// <param name="vcf">Vessel Config Node.</param>
        public ActiveRover(Vessel v, ConfigNode module)
        {
            vessel = v;

            BVModule = module;

            bvActive = bool.Parse(BVModule.GetValue("isActive"));

            // Workaround for update from versions prior to 1.0
            try {
                isManned = bool.Parse(BVModule.GetValue("isManned"));
            } catch {
                isManned = true;
            }

            solarPowered = bool.Parse(BVModule.GetValue("solarPowered"));

            lastTime          = double.Parse(BVModule.GetValue("lastTime"));
            distanceTravelled = double.Parse(BVModule.GetValue("distanceTravelled"));
            distanceToTarget  = double.Parse(BVModule.GetValue("distanceToTarget"));
            targetLatitude    = double.Parse(BVModule.GetValue("targetLatitude"));
            targetLongitude   = double.Parse(BVModule.GetValue("targetLongitude"));
            averageSpeed      = double.Parse(BVModule.GetValue("averageSpeed"));
            if (BVModule.HasValue("averageSpeedAtNight")) // Backward compatibility
            {
                averageSpeedAtNight = double.Parse(BVModule.GetValue("averageSpeedAtNight"));
            }
            else
            {
                if (!solarPowered)
                {
                    averageSpeedAtNight = averageSpeed;
                }
                else
                {
                    averageSpeedAtNight = 0;
                }
            }

            path            = PathUtils.DecodePath(BVModule.GetValue("pathEncoded"));
            speedMultiplier = 1.0;
        }
예제 #4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="v"></param>
        /// <param name="module"></param>
        internal BVController(Vessel v, ConfigNode module)
        {
            vessel   = v;
            BVModule = module;
            displayedSystemCheckResults = new List <DisplayedSystemCheckResult[]>();

            // Load values from config if it isn't the first run of the mod (we are reseting vessel on the first run)
            if (!Configuration.FirstRun)
            {
                active            = bool.Parse(BVModule.GetValue("active") != null ? BVModule.GetValue("active") : "false");
                shutdown          = bool.Parse(BVModule.GetValue("shutdown") != null ? BVModule.GetValue("shutdown") : "false");
                arrived           = bool.Parse(BVModule.GetValue("arrived") != null ? BVModule.GetValue("arrived") : "false");
                targetLatitude    = double.Parse(BVModule.GetValue("targetLatitude") != null ? BVModule.GetValue("targetLatitude") : "0");
                targetLongitude   = double.Parse(BVModule.GetValue("targetLongitude") != null ? BVModule.GetValue("targetLongitude") : "0");
                distanceToTarget  = double.Parse(BVModule.GetValue("distanceToTarget") != null ? BVModule.GetValue("distanceToTarget") : "0");
                distanceTravelled = double.Parse(BVModule.GetValue("distanceTravelled") != null ? BVModule.GetValue("distanceTravelled") : "0");
                if (BVModule.GetValue("pathEncoded") != null)
                {
                    path = PathUtils.DecodePath(BVModule.GetValue("pathEncoded"));
                }

                if (BVModule.GetValue("rotationVector") != null)
                {
                    switch (BVModule.GetValue("rotationVector"))
                    {
                    case "0":
                        rotationVector = Vector3d.up;
                        break;

                    case "1":
                        rotationVector = Vector3d.down;
                        break;

                    case "2":
                        rotationVector = Vector3d.forward;
                        break;

                    case "3":
                        rotationVector = Vector3d.back;
                        break;

                    case "4":
                        rotationVector = Vector3d.right;
                        break;

                    case "5":
                        rotationVector = Vector3d.left;
                        break;

                    default:
                        rotationVector = Vector3d.back;
                        break;
                    }
                }
                else
                {
                    rotationVector = Vector3d.back;
                }
            }

            State = VesselState.Idle;
            if (shutdown)
            {
                State = VesselState.ControllerDisabled;
            }

            lastTimeUpdated     = 0;
            mainStarIndex       = 0; // In the most cases The Sun
            electricPower_Solar = 0;
            electricPower_Other = 0;
            requiredPower       = 0;
        }
예제 #5
0
 public void UpdateWayPoints()
 {
     wayPoints = PathUtils.DecodePath(currentModule.pathEncoded, currentModule.vessel.mainBody);
 }