Beispiel #1
0
        //[KSPEvent(guiActive = true, guiName = "Set to active waypoint", isPersistent = true)]
        public void SetToWaypoint()
        {
            NavWaypoint navPoint = NavWaypoint.fetch;

            if (navPoint == null || !navPoint.IsActive || navPoint.Body != this.vessel.mainBody)
            {
                ScreenMessages.PostScreenMessage("No valid nav point");
            }
            else
            {
                Deactivate();
                double[] newCoordinates =
                    GeoUtils.StepBack(
                        this.vessel.latitude,
                        this.vessel.longitude,
                        navPoint.Latitude,
                        navPoint.Longitude,
                        this.vessel.mainBody.Radius,
                        200
                        );
                this.targetLatitude    = newCoordinates[0];
                this.targetLongitude   = newCoordinates[1];
                this.distanceTravelled = 0;
                FindPath();
            }
        }
Beispiel #2
0
        //[KSPEvent(guiActive = true, guiName = "Set to active target")]
        public void SetToActive()
        {
            if (this.vessel.targetObject == null || this.vessel.situation != Vessel.Situations.LANDED)
            {
                return;
            }

            Vessel targetVessel = this.vessel.targetObject.GetVessel();

            if (targetVessel == null)
            {
                ScreenMessages.PostScreenMessage("Target some suitable vessel first!");
                return;
            }

            if (targetVessel.mainBody == this.vessel.mainBody && targetVessel.situation == Vessel.Situations.LANDED)
            {
                Deactivate();
                double[] newCoordinates =
                    GeoUtils.StepBack(
                        this.vessel.latitude,
                        this.vessel.longitude,
                        targetVessel.latitude,
                        targetVessel.longitude,
                        this.vessel.mainBody.Radius,
                        200
                        );
                this.targetLatitude    = newCoordinates[0];
                this.targetLongitude   = newCoordinates[1];
                this.distanceTravelled = 0;
                FindPath();
            }
            else
            {
                ScreenMessages.PostScreenMessage("Your target is out there somewhere, this won't work!");
            }
        }