GetCommRange() public static method

public static GetCommRange ( Vessel vessel ) : double
vessel Vessel
return double
コード例 #1
0
 public override bool CheckRange(Vessel vessel)
 {
     if (vessel != null)
     {
         return(VesselUtils.GetDistanceToKerbinSurface(vessel) < VesselUtils.GetCommRange(vessel));
     }
     else
     {
         return(false);
     }
 }
コード例 #2
0
        public override void AddTo(SharedObjects shared)
        {
            _shared = shared;

            _shared.BindingMgr.AddGetter("ALT|RADAR", delegate(CPU cpu) { return(_shared.Vessel.heightFromTerrain > 0 ? Mathf.Min(_shared.Vessel.heightFromTerrain, (float)_shared.Vessel.altitude) : (float)_shared.Vessel.altitude); });
            _shared.BindingMgr.AddGetter("ALT|APOAPSIS", delegate(CPU cpu) { return(_shared.Vessel.orbit.ApA); });
            _shared.BindingMgr.AddGetter("ALT|PERIAPSIS", delegate(CPU cpu) { return(_shared.Vessel.orbit.PeA); });
            _shared.BindingMgr.AddGetter("ETA|APOAPSIS", delegate(CPU cpu) { return(_shared.Vessel.orbit.timeToAp); });
            _shared.BindingMgr.AddGetter("ETA|PERIAPSIS", delegate(CPU cpu) { return(_shared.Vessel.orbit.timeToPe); });

            _shared.BindingMgr.AddGetter("MISSIONTIME", delegate(CPU cpu) { return(_shared.Vessel.missionTime); });
            _shared.BindingMgr.AddGetter("TIME", delegate(CPU cpu) { return(new kOS.TimeSpan(Planetarium.GetUniversalTime())); });

            _shared.BindingMgr.AddGetter("STATUS", delegate(CPU cpu) { return(_shared.Vessel.situation.ToString().Replace("_", " ")); });
            _shared.BindingMgr.AddGetter("COMMRANGE", delegate(CPU cpu) { return(VesselUtils.GetCommRange(_shared.Vessel)); });
            _shared.BindingMgr.AddGetter("INCOMMRANGE", delegate(CPU cpu) { return(Convert.ToDouble(CheckCommRange(_shared.Vessel))); });

            _shared.BindingMgr.AddGetter("AV", delegate(CPU cpu) { return(_shared.Vessel.transform.InverseTransformDirection(_shared.Vessel.rigidbody.angularVelocity)); });
            _shared.BindingMgr.AddGetter("STAGE", delegate(CPU cpu) { return(new StageValues(_shared.Vessel)); });

            _shared.BindingMgr.AddGetter("ENCOUNTER", delegate(CPU cpu) { return(VesselUtils.TryGetEncounter(_shared.Vessel)); });

            _shared.BindingMgr.AddGetter("NEXTNODE", delegate(CPU cpu)
            {
                var vessel = _shared.Vessel;
                if (!vessel.patchedConicSolver.maneuverNodes.Any())
                {
                    throw new Exception("No maneuver nodes present!");
                }

                return(Node.FromExisting(vessel, vessel.patchedConicSolver.maneuverNodes[0]));
            });

            // Things like altitude, mass, maxthrust are now handled the same for other ships as the current ship
            _shared.BindingMgr.AddGetter("SHIP", delegate(CPU cpu) { return(new VesselTarget(_shared.Vessel, _shared.Vessel)); });

            // These are now considered shortcuts to SHIP:suffix
            foreach (string scName in VesselTarget.ShortCuttableShipSuffixes)
            {
                string cName = scName;
                _shared.BindingMgr.AddGetter(scName, delegate(CPU cpu) { return(new VesselTarget(_shared.Vessel, _shared.Vessel).GetSuffix(cName)); });
            }

            _shared.BindingMgr.AddSetter("VESSELNAME", delegate(CPU cpu, object value) { _shared.Vessel.vesselName = value.ToString(); });
        }
コード例 #3
0
ファイル: FunctionList.cs プロジェクト: erendrake/kRISC
        private kList GetTargetList(SharedObjects shared)
        {
            kList list = new kList();

            list.AddColumn("Vessel Name", 25, ColumnAlignment.Left);
            list.AddColumn("Distance", 12, ColumnAlignment.Right, "0.0");

            double commRange = VesselUtils.GetCommRange(shared.Vessel);

            foreach (Vessel vessel in FlightGlobals.Vessels)
            {
                if (vessel != shared.Vessel)
                {
                    var vT = new VesselTarget(vessel, shared.Vessel);
                    if (vT.IsInRange(commRange))
                    {
                        list.AddItem(vT.target.vesselName, vT.GetDistance());
                    }
                }
            }

            return(list);
        }
コード例 #4
0
ファイル: CommandVessel.cs プロジェクト: civilwargeeky/KOS
        public override void Evaluate()
        {
            switch (RegexMatch.Groups[1].Value.ToUpper())
            {
            case "BODIES":
                StdOut("");
                StdOut("Name           Distance");
                StdOut("-------------------------------------");
                foreach (var body in FlightGlobals.fetch.bodies)
                {
                    StdOut(body.bodyName.PadLeft(14) + " " + Vector3d.Distance(body.position, Vessel.GetWorldPos3D()));
                }
                StdOut("");

                break;


            case "TARGETS":
                StdOut("");
                StdOut("Vessel Name              Distance");
                StdOut("-------------------------------------");

                float commRange = VesselUtils.GetCommRange(Vessel);

                foreach (Vessel vessel in FlightGlobals.Vessels)
                {
                    if (vessel != Vessel)
                    {
                        var vT = new VesselTarget(vessel, this);
                        if (vT.IsInRange(commRange))
                        {
                            StdOut(vT.target.vesselName.PadRight(24) + " " + vT.GetDistance().ToString("0.0").PadLeft(8));
                        }
                    }
                }

                StdOut("");

                break;

            case "RESOURCES":
                StdOut("");
                StdOut("Stage      Resource Name               Amount");
                StdOut("------------------------------------------------");

                foreach (Part part in Vessel.Parts)
                {
                    String stageStr = part.inverseStage.ToString();

                    foreach (PartResource resource in part.Resources)
                    {
                        StdOut(part.inverseStage.ToString() + " " + resource.resourceName.PadRight(20) + " " + resource.amount.ToString("0.00").PadLeft(8));
                    }
                }
                break;

            case "PARTS":
                StdOut("------------------------------------------------");

                foreach (Part part in Vessel.Parts)
                {
                    StdOut(part.ConstructID + " " + part.partInfo.name);
                }

                break;

            case "ENGINES":
                StdOut("------------------------------------------------");

                foreach (Part part in VesselUtils.GetListOfActivatedEngines(Vessel))
                {
                    foreach (PartModule module in part.Modules)
                    {
                        if (module is ModuleEngines)
                        {
                            var engineMod = (ModuleEngines)module;

                            StdOut(part.uid + "  " + part.inverseStage.ToString() + " " + engineMod.moduleName);
                        }
                    }
                }

                break;
            }

            State = ExecutionState.DONE;
        }
コード例 #5
0
ファイル: BindingsFlightStats.cs プロジェクト: yadenisyur/KOS
 private static bool CheckCommRange(Vessel vessel)
 {
     return(VesselUtils.GetDistanceToKerbinSurface(vessel) < VesselUtils.GetCommRange(vessel));
 }
コード例 #6
0
 public override bool CheckRange()
 {
     return(VesselUtils.GetDistanceToKerbinSurface(vessel) < VesselUtils.GetCommRange(vessel));
 }