Exemple #1
0
        public static Services.VesselType ToVesselType(this VesselType type)
        {
            switch (type)
            {
            case VesselType.Base:
                return(Services.VesselType.Base);

            case VesselType.Debris:
                return(Services.VesselType.Debris);

            case VesselType.Lander:
                return(Services.VesselType.Lander);

            case VesselType.Plane:
                return(Services.VesselType.Plane);

            case VesselType.Probe:
                return(Services.VesselType.Probe);

            case VesselType.Relay:
                return(Services.VesselType.Relay);

            case VesselType.Rover:
                return(Services.VesselType.Rover);

            case VesselType.Ship:
                return(Services.VesselType.Ship);

            case VesselType.Station:
                return(Services.VesselType.Station);

            default:
                throw new ArgumentOutOfRangeException(nameof(type));
            }
        }
Exemple #2
0
 public static void DrawOrbitIcon(Rect target, VesselType type)
 {
     if (iconsMap != null)
     {
         GUI.DrawTextureWithTexCoords(target, iconsMap, OrbitIconLocation[type]);
     }
 }
Exemple #3
0
        bool Filter_match(VesselType vesselType, string vesselGroup)
        {
            if (filter_types.Contains(vesselType))
            {
                return(false);
            }
            if (filter.Length <= 0 || filter == filter_placeholder)
            {
                return(true);
            }

            List <string> filterTags = Lib.Tokenize(filter.ToLower(), ' ');
            List <string> vesselTags = Lib.Tokenize(vesselGroup.ToLower(), ' ');

            foreach (string tag in filterTags)
            {
                foreach (string vesselTag in vesselTags)
                {
                    if (vesselTag.StartsWith(tag, StringComparison.CurrentCulture))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemple #4
0
 public static String GetVesselTypeString(VesselType vesselType)
 {
     switch (vesselType)
     {
         case VesselType.Debris:
             return "Debris";
         case VesselType.SpaceObject:
             return "SpaceObject";
         case VesselType.Unknown:
             return "Unknown";
         case VesselType.Probe:
             return "Probe";
         case VesselType.Rover:
             return "Rover";
         case VesselType.Lander:
             return "Lander";
         case VesselType.Ship:
             return "Ship";
         case VesselType.Station:
             return "Station";
         case VesselType.Base:
             return "Base";
         case VesselType.EVA:
             return "EVA";
         case VesselType.Flag:
             return "Flag";
     }
     return "Undefined";
 }
Exemple #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Type_Vessel")] VesselType vesselType)
        {
            if (id != vesselType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vesselType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VesselTypeExists(vesselType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vesselType));
        }
Exemple #6
0
        private void DrawIcon(float xPos, float yPos, VesselType vt, Color iconColor, MapIcons.OtherIcon icon = MapIcons.OtherIcon.None)
        {
            var position = new Rect(xPos - iconPixelSize * 0.5f, yPos - iconPixelSize * 0.5f,
                                    iconPixelSize, iconPixelSize);

            //Rect shadow = position;
            //shadow.x += iconShadowShift.x;
            //shadow.y += iconShadowShift.y;

            //MapView.OrbitIconsMaterial.color = iconColorShadowValue;
            //Graphics.DrawTexture(shadow, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, MapView.OrbitIconsMaterial);

            // the old icon material wasn't working, so just use this one
            // but I don't fully understand the color/blend system
            // a = 1.0 is far too faint; 4.0 looks pretty good
            MapView.OrbitIconsMaterial.color = new Color(iconColor.r, iconColor.g, iconColor.b, 4.0f);
            Graphics.DrawTexture(position, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, MapView.OrbitIconsMaterial);

            // if the icon texture ever changes, you can use this code to dump it out for inspection
                        #if false
            var filepath = "orbiticonsmap.png";
            if (!System.IO.File.Exists(filepath))
            {
                var textureCopy  = duplicateTexture(MapView.OrbitIconsMap);
                var textureBytes = textureCopy.EncodeToPNG();
                System.IO.File.WriteAllBytes(filepath, textureBytes);
            }
                        #endif
        }
Exemple #7
0
        private void DrawTargetTypes()
        {
            bool displaying = false;

            GUILayout.Label("RENDEZVOUS DISPLAY", fe.headingStyle);

            GUILayout.BeginHorizontal(fe.areaStyle);
            GUILayout.BeginVertical();

            List <VesselType> vesselTypes = new List <VesselType>();

            foreach (Vessel vessel in FlightGlobals.Vessels)
            {
                if (!vesselTypes.Contains(vessel.vesselType) && vessel.vesselType != VesselType.Unknown && vessel != fe.vessel && vessel.mainBody == fe.vessel.mainBody)
                {
                    displaying = true;
                    vesselTypes.Add(vessel.vesselType);
                    if (GUILayout.Button(vessel.vesselType.ToString(), fe.buttonStyle))
                    {
                        typeOfTarget        = TargetType.Vessel;
                        typeOfVessel        = vessel.vesselType;
                        fe.settings.Changed = true;
                    }
                }
            }

            if (GUILayout.Button("Celestial Body", fe.buttonStyle) || !displaying)
            {
                typeOfTarget        = TargetType.Celestial;
                fe.settings.Changed = true;
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }
            public WaldoAttackVesselData(WaldoAttackVesselData vd)
            {
                name       = vd.name;
                id         = vd.id;
                craftURL   = vd.craftURL;
                craftPart  = vd.craftPart;
                flagURL    = vd.flagURL;
                vesselType = vd.vesselType;
                body       = vd.body;
                orbit      = vd.orbit;
                latitude   = vd.latitude;
                longitude  = vd.longitude;
                altitude   = vd.altitude;
                height     = vd.height;
                orbiting   = vd.orbiting;
                owned      = vd.owned;
                pqsCity    = vd.pqsCity;
                pqsOffset  = vd.pqsOffset;
                heading    = vd.heading;
                pitch      = vd.pitch;
                roll       = vd.roll;

                foreach (CrewData cd in vd.crew)
                {
                    crew.Add(new CrewData(cd));
                }
            }
            public VesselData(VesselData vd)
            {
                name = vd.name;
                id = vd.id;
                craftURL = vd.craftURL;
                craftPart = vd.craftPart;
                flagURL = vd.flagURL;
                vesselType = vd.vesselType;
                body = vd.body;
                orbit = vd.orbit;
                latitude = vd.latitude;
                longitude = vd.longitude;
                altitude = vd.altitude;
                height = vd.height;
                orbiting = vd.orbiting;
                owned = vd.owned;
                pqsCity = vd.pqsCity;
                pqsOffset = vd.pqsOffset;
                heading = vd.heading;
                pitch = vd.pitch;
                roll = vd.roll;

                foreach (CrewData cd in vd.crew)
                {
                    crew.Add(new CrewData(cd));
                }
            }
Exemple #10
0
        private void DrawVessels()
        {
            bool displaying = false;

            GUILayout.Label("RENDEZVOUS DISPLAY", fe.headingStyle);

            GUILayout.BeginHorizontal(fe.areaStyle);
            GUILayout.BeginVertical();
            foreach (Vessel vessel in FlightGlobals.Vessels)
            {
                if (vessel.vesselType == typeOfVessel && vessel != fe.vessel)
                {
                    if (vessel.mainBody == fe.vessel.mainBody)
                    {
                        displaying = true;
                        if (GUILayout.Button(vessel.vesselName, fe.buttonStyle))
                        {
                            targetObject        = vessel;
                            fe.settings.Changed = true;
                        }
                    }
                }
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            if (GUILayout.Button("Back to Target Type", fe.buttonStyle) || !displaying)
            {
                targetObject        = null;
                typeOfTarget        = TargetType.None;
                typeOfVessel        = VesselType.Unknown;
                fe.settings.Changed = true;
            }
        }
        public Tracking_Group(string title, bool isOpen, bool instant, List <TrackingStationWidget> vessels, List <Tracking_MoonGroup> subGroups, CelestialBody body, VesselType type, Tracking_Mode mode)
        {
            _title   = title;
            _isOpen  = isOpen;
            _instant = instant;
            _mode    = mode;
            _body    = body;
            _type    = type;

            int _subVesselCount = 0;

            if (subGroups != null && subGroups.Count > 0)
            {
                for (int i = subGroups.Count - 1; i >= 0; i--)
                {
                    _subVesselCount += subGroups[i].Vessels.Count;
                }
            }

            AddHeader(vessels.Count, _subVesselCount);

            AddSubGroups(subGroups);

            AddVessels(vessels);
        }
        bool Filter_match(VesselType vesselType, string vesselGroup)
        {
            if (filter_types.Contains(vesselType))
            {
                return(false);
            }
            if (filter.Length <= 0 || filter == filter_placeholder)
            {
                return(true);
            }

            List <string> filterTags = filter.ToLower().Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(p => p.Trim()).ToList();
            List <string> vesselTags = vesselGroup.ToLower().Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(p => p.Trim()).ToList();

            foreach (string tag in filterTags)
            {
                foreach (string vesselTag in vesselTags)
                {
                    if (vesselTag.StartsWith(tag, StringComparison.CurrentCulture))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
    IEnumerator RespawnEntity(string id, VesselType vesselType, EntityType entityType, TeamColor teamColor, float time)
    {
        float timer = time;

        while (timer > 0)
        {
            timer -= Time.deltaTime;
            yield return(null);
        }

        //TODO : Refactor the statements below
        //Spawn entity
        //Replace with while that iterates until it finds a position after 10sec stop enumerator
        SpawnArea spawnArea     = spawnAreas.Where(x => x.isOccupied == false).First();
        Transform spawnLocation = spawnArea.location;

        if (spawnArea.isOccupied)
        {
            yield return(null);
        }

        GameSettings gameSettings = GameManager.Instance.gameSettings;
        GameObject   prefab       = gameSettings.vesselObjects.Where(x => x.entityType == entityType && x.vesselType == vesselType).First().objectPrefab;

        SpawnEntity(id, prefab, spawnLocation, teamColor);

        spawnArea.isOccupied = true;
        StartCoroutine(WaitUntilClear(spawnArea));
    }
Exemple #14
0
        /// <summary>
        ///
        /// </summary>
        private void UpdateVesselInfo()
        {
            IsVesselCommandable = vessel.IsVesselSituationValid();

            if (VesselName != vessel.vesselName)
            {
                VesselName = vessel.vesselName;
            }

            if (currentVesselType != vessel.vesselType)
            {
                currentVesselType = vessel.vesselType;
                VesselIcon        = GetVesselIcon(vessel.vesselType);
            }

            if (vessel.loaded)
            {
                IsActiveVessel = vessel.isActiveVessel;

                if (VesselAutopilotActive != vessel.Autopilot.Enabled)
                {
                    VesselAutopilotActive = vessel.Autopilot.Enabled;
                }

                if (VesselAutopilotMode != vessel.Autopilot.Mode.ToPTIEnum())
                {
                    VesselAutopilotMode = vessel.Autopilot.Mode.ToPTIEnum();
                }
            }
        }
Exemple #15
0
        public static bool isVesselTypeEnabled(VesselType type)
        {
            var enabled = false;

            filteredTypes.TryGetValue(type, out enabled);
            return(enabled);
        }
Exemple #16
0
        Texture2D GetVesselTypeIcon(VesselType type, bool disabled = false)
        {
            switch (type)
            {
            case VesselType.Base:    return(disabled ? Icons.base_black :    Icons.base_white);

            case VesselType.EVA:     return(disabled ? Icons.eva_black :     Icons.eva_white);

            case VesselType.Lander:  return(disabled ? Icons.lander_black :  Icons.lander_white);

            case VesselType.Plane:   return(disabled ? Icons.plane_black :   Icons.plane_white);

            case VesselType.Probe:   return(disabled ? Icons.probe_black :   Icons.probe_white);

            case VesselType.Relay:   return(disabled ? Icons.relay_black :   Icons.relay_white);

            case VesselType.Rover:   return(disabled ? Icons.rover_black :   Icons.rover_white);

            case VesselType.Ship:    return(disabled ? Icons.ship_black :    Icons.ship_white);

            case VesselType.Station: return(disabled ? Icons.station_black : Icons.station_white);

#if !KSP170 && !KSP16 && !KSP15 && !KSP14
            case VesselType.DeployedScienceController: return(disabled ? Icons.controller_black : Icons.controller_white);
#endif
            default: return(Icons.empty);                    // this really shouldn't happen.
            }
        }
Exemple #17
0
        // must be unique for Unity to not mash two nametag windows togehter.


        public void Invoke(PersistentDynamicPodNames module, string oldVesselName, VesselType oldVesselType, int oldPriority)
        {
            attachedModule        = module;
            workingvesselname     = oldVesselName;
            workingvesseltype     = oldVesselType;
            workingpriority       = oldPriority;
            workingprioritystring = workingpriority.ToString();


            myWindowId = GetInstanceID();              // Use the Id of this MonoBehaviour to guarantee unique window ID.

            Vector3 screenPos = GetViewportPosFor(attachedModule.part.transform.position);

            // screenPos is in coords from 0 to 1, 0 to 1, not screen pixel coords.
            // Transform it to pixel coords:
            float       xPixelPoint   = screenPos.x * UnityEngine.Screen.width;
            float       yPixelPoint   = (1 - screenPos.y) * UnityEngine.Screen.height;
            const float WINDOW_WIDTH  = 400;
            const float WINDOW_HEIGHT = 200;

            // windowRect = new Rect(xPixelWindow, yPixelPoint, windowWidth, 130);
            windowRect = new Rect(xPixelPoint - WINDOW_WIDTH / 2, yPixelPoint, WINDOW_WIDTH, WINDOW_HEIGHT);

            SetEnabled(true);

            if (HighLogic.LoadedSceneIsEditor)
            {
                attachedModule.part.SetHighlight(false, false);
            }
        }
 public void TypingDone(string newVesselName, VesselType newVesselType, int newPriority)
 {
     storedVesselName = newVesselName;
     vesselType       = newVesselType;
     priority         = newPriority;
     TypingCancel();
 }
Exemple #19
0
        private PointF[] getVesselPath(VesselType type, float size, float x, float y)
        {
            List <PointF> points = new List <PointF>();

            float offsetX = x - (size / 2f);
            float offsetY = y - (size / 2f);

            switch (type)
            {
            case VesselType.Probe:
            // TODO: DRAW SATTELLITE HERE
            //break;

            case VesselType.Ship:
            default:
                // TODO: DRAW SHIP HERE
                points.Add(new PointF((0.2f * size) + offsetX, 0 + offsetY));
                points.Add(new PointF((0.8f * size) + offsetX, 0 + offsetY));
                points.Add(new PointF((1 * size) + offsetX, (1 * size) + offsetY));
                points.Add(new PointF((0 * size) + offsetX, (1 * size) + offsetY));
                break;
            }

            return(points.ToArray());
        }
Exemple #20
0
        public static KRPC.SpaceCenter.Services.VesselType ToVesselType(this VesselType type)
        {
            switch (type)
            {
            case VesselType.Ship:
                return(KRPC.SpaceCenter.Services.VesselType.Ship);

            case VesselType.Station:
                return(KRPC.SpaceCenter.Services.VesselType.Station);

            case VesselType.Lander:
                return(KRPC.SpaceCenter.Services.VesselType.Lander);

            case VesselType.Probe:
                return(KRPC.SpaceCenter.Services.VesselType.Probe);

            case VesselType.Rover:
                return(KRPC.SpaceCenter.Services.VesselType.Rover);

            case VesselType.Base:
                return(KRPC.SpaceCenter.Services.VesselType.Base);

            case VesselType.Debris:
                return(KRPC.SpaceCenter.Services.VesselType.Debris);

            default:
                throw new ArgumentOutOfRangeException("type");
            }
        }
Exemple #21
0
        private static String GenerateName()
        {
            _shipType = VesselType.Unknown;

            Part p = VesselNaming.FindPriorityNamePart(EditorLogic.fetch.ship);

            if (p != null)
            {
                _shipType = p.vesselNaming.vesselType;
            }
            else
            {
                _shipType = VesselType.Unknown;
                foreach (var part in EditorLogic.fetch.ship.Parts)
                {
                    foreach (var m in part.Modules)
                    {
                        if (m is ModuleCommand)
                        {
                            part.vesselNaming = new VesselNaming();
                            part.vesselNaming.namingPriority = 10;

                            if (part.CrewCapacity == 0)
                            {
                                part.vesselNaming.vesselType = VesselType.Probe;
                            }
                            else
                            {
                                part.vesselNaming.vesselType = VesselType.Ship;
                            }
                            _shipType = part.vesselNaming.vesselType;
                            break;
                        }
                    }
                    if (_shipType != VesselType.Unknown)
                    {
                        break;
                    }
                }
                if (_shipType == VesselType.Unknown)
                {
                    return("");
                }
            }

            bool scr = false;

            switch (_lang)
            {
            case 1:
                scr = true;
                break;

            case 2:
                scr = (Ran.Next(2) == 1);
                break;
            }
            return(ParsePattern(Choose(_patterns), scr));
        }
        private bool getConnectedVessels()
        {
            connectedVessels.Clear();

            if (resultsDialog == null)
            {
                return(false);
            }

            Vessel vessel = FlightGlobals.ActiveVessel;

            if (vessel == null)
            {
                return(false);
            }

            if (CommNetScenario.CommNetEnabled)
            {
                connectedVessels = getConnectedVessels(vessel);
            }
            else
            {
                for (int i = FlightGlobals.Vessels.Count - 1; i >= 0; i--)
                {
                    Vessel v = FlightGlobals.Vessels[i];

                    if (v == null)
                    {
                        continue;
                    }

                    if (v == vessel)
                    {
                        continue;
                    }

                    VesselType type = v.vesselType;

                    if (type == VesselType.Debris || type == VesselType.SpaceObject || type == VesselType.Unknown || type == VesselType.Flag)
                    {
                        continue;
                    }

                    if (settings.requireMPL && !VesselUtilities.VesselHasModuleName("ModuleScienceLab", v))
                    {
                        continue;
                    }

                    if (!VesselUtilities.VesselHasModuleName("ModuleScienceContainer", v))
                    {
                        continue;
                    }

                    connectedVessels.Add(new KeyValuePair <Vessel, double>(v, 0));
                }
            }

            return(connectedVessels.Count > 0);
        }
 public override bool IsIgnoredVesselType(VesselType vesselType)
 {
     if (vesselType == VesselType.Debris)
     {
         return false;
     }
     return base.IsIgnoredVesselType(vesselType);
 }
        public ActionResult DeleteConfirmed(int id)
        {
            VesselType vesseltype = db.VesselTypes.Find(id);

            db.VesselTypes.Remove(vesseltype);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #25
0
 public VesselBasic(Vessel reference)
 {
     VesselId        = reference.id;
     VesselName      = reference.GetDisplayName();
     VesselLoaded    = reference.loaded;
     VesselType      = reference.vesselType;
     VesselSituation = reference.situation;
 }
Exemple #26
0
        void onAccept(string name, VesselType vt)
        {
            print("name: " + name + "    VesselType: " + vt.ToString());
            FlightGlobals.ActiveVessel.vesselName = name;

            print("FlightGlobals.ActiveVessel.name: " + FlightGlobals.ActiveVessel.name);
            Events ["ActivateEvent"].active = true;
        }
 public vesselTypes(VesselType vesselType, string name, bool show, Action callback)
 {
     this.vesselType = vesselType;
     this.name       = name;
     this.show       = show;
     this.callback   = callback;
     init            = true;
 }
Exemple #28
0
 public FishingVessel(VesselType vesselType, double?breadth = null, double?depth = null, double?length = null)
 {
     Breadth          = breadth;
     Depth            = depth;
     Length           = length;
     VesselType       = vesselType;
     VesselTypeString = VesselTypeFromVesselTypeNumber((int)vesselType);
 }
Exemple #29
0
        private static GameObject GetHeaderObject(VesselType type)
        {
            VesselIconSprite _iconSPrite = GameObject.Instantiate(Tracking_Loader.IconPrefab);

            _iconSPrite.SetType(type);

            return(_iconSPrite.gameObject);
        }
 public override bool IsIgnoredVesselType(VesselType vesselType)
 {
     if (vesselType == VesselType.Debris)
     {
         return(false);
     }
     return(base.IsIgnoredVesselType(vesselType));
 }
        public override bool Load(ConfigNode configNode)
        {
            // Load base class
            bool valid = base.Load(configNode);

            valid &= ConfigNodeUtil.ParseValue<VesselType>(configNode, "vesselType", x => vesselType = x, this);

            return valid;
        }
Exemple #32
0
 public void Initiate(VesselType newVesselType, float newSize, float newDurability, string newDesignation, List <VesselPart> parts)
 {
     vesselType           = newVesselType;
     transform.localScale = new Vector3(newSize, newSize, newSize);
     hitpoints            = newSize * newSize * newDurability;
     maxHitpoints         = hitpoints;
     designation          = newDesignation;
     BuildParts(parts, newDesignation);
 }
Exemple #33
0
        /// <summary>
        /// Parses a string as a predicate keyword.
        /// </summary>
        ///
        /// <param name="input">A string, assumed to be in the format "[body].[property]".</param>
        /// <returns>A predicate representing the desired property for the desired body.</returns>
        ///
        /// <exception cref="ArgumentException">Thrown if <c>input</c> does not have the correct
        /// format. The program state shall be unchanged in the event of an exception.</exception>
        static GamePredicate parse(string input)
        {
            Regex inputTemplate = new Regex(
                "(?<planet>.+)\\s*\\.\\s*(?<pred>\\w+?)(?<type>manned|unmanned)?$",
                RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);

            if (inputTemplate.Match(input).Groups [0].Success)
            {
                GroupCollection parsed = inputTemplate.Match(input).Groups;
                string          planet = parsed ["planet"].ToString();
                string          pred   = parsed ["pred"].ToString();
                VesselType      type   = parsed ["type"] == null || parsed ["type"].ToString() == ""
                    ? VesselType.Any
                    : parsed ["type"].ToString().ToLower() == "manned"
                        ? VesselType.Manned : VesselType.Unmanned;

                switch (pred.ToLower())
                {
                case "reached":
                    return(new AchievementPredicate(new []
                    {
                        new [] { planet, "Escape" },
                        new [] { planet, "Flyby" }
                    }, type));

                case "hadorbit":
                    return(new AchievementPredicate(new [] { new [] { planet, "Orbit" } }, type));

                case "hadlanded":
                    return(new AchievementPredicate(new []
                    {
                        new [] { planet, "Landing" },
                        new [] { planet, "Splashdown" }
                    }, type));

                case "science":
                    return(new AchievementPredicate(new [] { new [] { planet, "Science" } }, type));

                case "nowpresent":
                    return(new VesselPredicate(planet, VesselPredicate.Test.Present, type));

                case "noworbit":
                    return(new VesselPredicate(planet, VesselPredicate.Test.Orbiting, type));

                case "nowlanded":
                    return(new VesselPredicate(planet, VesselPredicate.Test.Landed, type));

                default:
                    throw new ArgumentException(
                              Localizer.Format("#autoLOC_CustomAsteroids_ErrorConditionInputBadType", pred),
                              nameof(input));
                }
            }
            throw new ArgumentException(
                      Localizer.Format("#autoLOC_CustomAsteroids_ErrorConditionInputBad", input),
                      nameof(input));
        }
Exemple #34
0
 public VesselInfo(string vesselName, Vessel.Situations situation, VesselType vesseltype, double currentTime)
 {
     this.vesselName = vesselName;
     lastUpdate = currentTime;
     lastFood = currentTime;
     lastWater = currentTime;
     lastOxygen = currentTime;
     lastElectricity = currentTime;
     hibernating = false;
     numFrozenCrew = 0;
     vesselSituation = situation;
     vesselIsPreLaunch = situation == Vessel.Situations.PRELAUNCH;
     vesselType = vesseltype;
     recoveryvessel = false;
 }
 public Notes_Archive_Container(Guid gid, string name, double time, double m, VesselType t)
 {
     id = gid;
     vesselName = name;
     recoveryTime = time;
     met = m;
     vtype = t;
     container = this;
     log = new Notes_VesselLog(container);
     notes = new Notes_TextContainer(container);
     checkList = new Notes_CheckListContainer(container);
     contracts = new Notes_ContractContainer(container);
     data = new Notes_DataContainer(container);
     crew = new Notes_Archived_Crew_Container(container);
 }
        /// <summary>
        ///     Draws the back to types button.
        /// </summary>
        private void DrawBackToTypes()
        {
            if (GUILayout.Button("Go Back to Type Selection", this.ButtonStyle, GUILayout.Width(this.ContentWidth)))
            {
                this.typeIsBody = false;
                this.vesselType = VesselType.Unknown;
                this.ResizeRequested = true;
            }

            GUILayout.Space(3f);
        }
 public static bool isVesselTypeEnabled(VesselType type)
 {
     var enabled = false;
     filteredTypes.TryGetValue(type, out enabled);
     return enabled;
 }
Exemple #38
0
 public void update()
 {
     /*if (lastVName != null && this.vessel.GetName().Length != 0 && !this.vessel.GetName().Equals(this.lastVName) || !this.vessel.vesselType.Equals(this.lastVType))
         Debug.Log("TARGETRON: RENAME DETECTED ON VESSEL " + this.lastVName + "-" + this.lastVType + " -> " + this.vessel.GetName() + "-" + this.vessel.vesselType);*/
     lastVName = vessel.GetName();
     lastVType = vessel.vesselType;
     try
     {
         lastDistance = Vector3.Distance(FlightGlobals.fetch.activeVessel.transform.position, vessel.transform.position);
     }
     catch (Exception e)
     {
         Debug.Log("Targetron Error: Failed to get distance\n" + e.StackTrace);
     }
 }
 protected override void OnParameterLoad(ConfigNode node)
 {
     base.OnParameterLoad(node);
     vesselType = ConfigNodeUtil.ParseValue<VesselType>(node, "vesselType");
 }
        public static VesselType parse(this ConfigNode node, string name, VesselType original)
        {
            if (!node.HasValue(name))
                return original;

            VesselType t = original;

            int i = (int)original;

            if (!int.TryParse(node.GetValue(name), out i))
                return original;

            if (i > 10 || i < 0)
                return original;

            return (VesselType)i;
        }
Exemple #41
0
        // This function prepares the simulation by creating all the necessary data structures it will 
        // need during the simulation.  All required data is copied from the core game data structures 
        // so that the simulation itself can be run in a background thread without having issues with 
        // the core game changing the data while the simulation is running.
        public bool PrepareSimulation(List<Part> parts, double theGravity, double theAtmosphere = 0, double theMach = 0, bool dumpTree = false, bool vectoredThrust = false, bool fullThrust = false)
        {
            LogMsg log = null;
            if (SimManager.logOutput)
            {
                log = new LogMsg();
                log.buf.AppendLine("PrepareSimulation started");
                dumpTree = true;
            }
            this._timer.Reset();
            this._timer.Start();

            // Store the parameters in members for ease of access in other functions
            this.partList = parts;
            this.gravity = theGravity;
            this.atmosphere = theAtmosphere;
            this.mach = theMach;
            this.lastStage = Staging.lastStage;
            this.maxMach = 1.0f;
            //MonoBehaviour.print("lastStage = " + lastStage);

            // Clear the lists for our simulation parts
            allParts.Clear();
            allFuelLines.Clear();
            drainingParts.Clear();
            allEngines.Clear();
            activeEngines.Clear();
            drainingResources.Clear();

            // A dictionary for fast lookup of Part->PartSim during the preparation phase
            partSimLookup.Clear();

            if (this.partList.Count > 0 && this.partList[0].vessel != null)
            {
                this.vesselName = this.partList[0].vessel.vesselName;
                this.vesselType = this.partList[0].vessel.vesselType;
            }
            //MonoBehaviour.print("PrepareSimulation pool size = " + PartSim.pool.Count());
            // First we create a PartSim for each Part (giving each a unique id)
            int partId = 1;
            for (int i = 0; i < partList.Count; ++i)
            {
                Part part = partList[i];

                // If the part is already in the lookup dictionary then log it and skip to the next part
                if (partSimLookup.ContainsKey(part))
                {
                    if (log != null)
                    {
                        log.buf.AppendLine("Part " + part.name + " appears in vessel list more than once");
                    }
                    continue;
                }

                // Create the PartSim
                PartSim partSim = PartSim.New(part, partId, this.atmosphere, log);

                // Add it to the Part lookup dictionary and the necessary lists
                partSimLookup.Add(part, partSim);
                this.allParts.Add(partSim);
                if (partSim.isFuelLine)
                {
                    this.allFuelLines.Add(partSim);
                }
                if (partSim.isEngine)
                {
                    partSim.CreateEngineSims(this.allEngines, this.atmosphere, this.mach, vectoredThrust, fullThrust, log);
                }

                partId++;
            }

            for (int i = 0; i < allEngines.Count; ++i)
            {
                maxMach = Mathf.Max(maxMach, allEngines[i].maxMach);
            }

            this.UpdateActiveEngines();

            // Now that all the PartSims have been created we can do any set up that needs access to other parts
            // First we set up all the parent links
            for (int i = 0; i < this.allParts.Count; i++)
            {
                PartSim partSim = this.allParts[i];
                partSim.SetupParent(partSimLookup, log);
            }

            // Then, in the VAB/SPH, we add the parent of each fuel line to the fuelTargets list of their targets
            if (HighLogic.LoadedSceneIsEditor)
            {
                for (int i = 0; i < allFuelLines.Count; ++i)
                {
                    PartSim partSim = allFuelLines[i];

                    CModuleFuelLine fuelLine = partSim.part.GetModule<CModuleFuelLine>();
                    if (fuelLine.target != null)
                    {
                        PartSim targetSim;
                        if (partSimLookup.TryGetValue(fuelLine.target, out targetSim))
                        {
                            if (log != null)
                            {
                                log.buf.AppendLine("Fuel line target is " + targetSim.name + ":" + targetSim.partId);
                            }

                            targetSim.fuelTargets.Add(partSim.parent);
                        }
                        else
                        {
                            if (log != null)
                            {
                                log.buf.AppendLine("No PartSim for fuel line target (" + partSim.part.partInfo.name + ")");
                            }
                        }
                    }
                    else
                    {
                        if (log != null)
                        {
                            log.buf.AppendLine("Fuel line target is null");
                        }
                    }
                }
            }

            //MonoBehaviour.print("SetupAttachNodes and count stages");
            for (int i = 0; i < allParts.Count; ++i)
            {
                PartSim partSim = allParts[i];

                partSim.SetupAttachNodes(partSimLookup, log);
                if (partSim.decoupledInStage >= this.lastStage)
                {
                    this.lastStage = partSim.decoupledInStage + 1;
                }
            }

            // And finally release the Part references from all the PartSims
            //MonoBehaviour.print("ReleaseParts");
            for (int i = 0; i < allParts.Count; ++i)
            { 
                allParts[i].ReleasePart();
            }

            // And dereference the core's part list
            this.partList = null;

            this._timer.Stop();
            if (log != null)
            {
                log.buf.AppendLine("PrepareSimulation: " + this._timer.ElapsedMilliseconds + "ms");
                log.Flush();
            }

            if (dumpTree)
            {
                this.Dump();
            }

            return true;
        }
 public static string GearCodeFromVesselType(VesselType vtype)
 {
     string gearCode = String.Empty;
     switch (vtype)
     {
         case VesselType.PS:
             gearCode = "S";
             break;
         case VesselType.LL:
             gearCode = "L";
             break;
         default:
             break;
     }
     return gearCode;
 }
Exemple #43
0
 //--------------------------------------------------------------------
 // RenderableVesselType
 // Indicates whether the specified vessel type is one we will render
 private bool RenderableVesselType(VesselType vesselType)
 {
     return !(vesselType == VesselType.Flag || vesselType == VesselType.EVA || (vesselType == VesselType.Debris && DistantObjectSettings.DistantFlare.ignoreDebrisFlare));
 }
Exemple #44
0
				public static Rect VesselTypeIcon(VesselType type, OtherIcon icon)
				{
						int x = 0;
						int y = 0;
						const float symbolSpan = 0.2f;
						if (icon != OtherIcon.None) {
								switch (icon) {
								case OtherIcon.AP:
										x = 1;
										y = 4;
										break;
								case OtherIcon.PE:
										x = 0;
										y = 4;
										break;
								case OtherIcon.AN:
										x = 2;
										y = 4;
										break;
								case OtherIcon.DN:
										x = 3;
										y = 4;
										break;
								case OtherIcon.NODE:
										x = 2;
										y = 1;
										break;
								case OtherIcon.SHIPATINTERCEPT:
										x = 0;
										y = 1;
										break;
								case OtherIcon.TGTATINTERCEPT:
										x = 1;
										y = 1;
										break;
								case OtherIcon.ENTERSOI:
										x = 0;
										y = 2;
										break;
								case OtherIcon.EXITSOI:
										x = 1;
										y = 2;
										break;
								case OtherIcon.PLANET:
										// Not sure if it is (2,3) or (3,2) - both are round
										x = 2;
										y = 3;
										break;
								}
						} else {
								switch (type) {
								case VesselType.Base:
										x = 2;
										y = 0;
										break;
								case VesselType.Debris:
										x = 1;
										y = 3;
										break;
								case VesselType.EVA:
										x = 2;
										y = 2;
										break;
								case VesselType.Flag:
										x = 4;
										y = 0;
										break;
								case VesselType.Lander:
										x = 3;
										y = 0;
										break;
								case VesselType.Probe:
										x = 1;
										y = 0;
										break;
								case VesselType.Rover:
										x = 0;
										y = 0;
										break;
								case VesselType.Ship:
										x = 0;
										y = 3;
										break;
								case VesselType.Station:
										x = 3;
										y = 1;
										break;
								case VesselType.Unknown:
										x = 3;
										y = 3;
										break;
								case VesselType.SpaceObject:
										x = 4;
										y = 1;
										break;
								default:
										x = 3;
										y = 2;
										break;
								}
						}
						var result = new Rect();
						result.x = symbolSpan * x;
						result.y = symbolSpan * y;
						result.height = result.width = symbolSpan;
						return result;
				}
 private void SetTypeAs(VesselType vesselType)
 {
     this.vesselType = vesselType;
     this.ResizeRequested = true;
 }
        void onAccept(string name, VesselType vt)
        {
            print ("name: " + name + "    VesselType: " + vt.ToString ());
            FlightGlobals.ActiveVessel.vesselName = name;

            print ("FlightGlobals.ActiveVessel.name: " + FlightGlobals.ActiveVessel.name);
            Events ["ActivateEvent"].active = true;
        }
Exemple #47
0
 public static OrbitIcon orbitIconForVesselType(VesselType type)
 {
     switch(type) {
     case VesselType.Base:
         return OrbitIcon.Base;
     case VesselType.Debris:
         return OrbitIcon.Debris;
     case VesselType.EVA:
         return OrbitIcon.EVA;
     case VesselType.Flag:
         return OrbitIcon.Flag;
     case VesselType.Lander:
         return OrbitIcon.Lander;
     case VesselType.Probe:
         return OrbitIcon.Probe;
     case VesselType.Rover:
         return OrbitIcon.Rover;
     case VesselType.Ship:
         return OrbitIcon.Ship;
     case VesselType.Station:
         return OrbitIcon.Station;
     case VesselType.Unknown:
         return OrbitIcon.Mystery;
     default:
         return OrbitIcon.Mystery;
     }
 }
Exemple #48
0
 public static String GetVesselTypeString(VesselType vesselType)
 {
     switch (vesselType)
     {
         case VesselType.Debris:
             return "Debris";
         case VesselType.SpaceObject:
             return "SpaceObject";
         case VesselType.Unknown:
             return "Unknown";
         case VesselType.Probe:
             return "Probe";
         case VesselType.Rover:
             return "Rover";
         case VesselType.Lander:
             return "Lander";
         case VesselType.Ship:
             return "Ship";
         case VesselType.Station:
             return "Station";
         case VesselType.Base:
             return "Base";
         case VesselType.EVA:
             return "EVA";
         case VesselType.Flag:
             return "Flag";
     }
     return "Undefined";
 }
Exemple #49
0
        public PartSim(Part thePart, int id, double atmosphere, LogMsg log)
        {
            part = thePart;
            partId = id;
            name = part.partInfo.name;

            if (log != null)
                log.buf.AppendLine("Create PartSim for " + name);

            parent = null;
            parentAttach = part.attachMode;
            fuelCrossFeed = part.fuelCrossFeed;
            noCrossFeedNodeKey = part.NoCrossFeedNodeKey;
            decoupledInStage = DecoupledInStage(part);
            isFuelLine = part is FuelLine;
            isFuelTank = part is FuelTank;
            isSepratron = IsSepratron();
            inverseStage = part.inverseStage;
            //MonoBehaviour.print("inverseStage = " + inverseStage);

            cost = part.partInfo.cost;
            foreach (PartResource resource in part.Resources)
            {
                cost -= (float)((resource.maxAmount - resource.amount) * resource.info.unitCost);
            }

            // Work out if the part should have no physical significance
            isNoPhysics = part.HasModule<LaunchClamp>() ||
                            part.physicalSignificance == Part.PhysicalSignificance.NONE ||
                            part.PhysicsSignificance == 1;

            if (!isNoPhysics)
                baseMass = part.mass;

            if (SimManager.logOutput)
                MonoBehaviour.print((isNoPhysics ? "Ignoring" : "Using") + " part.mass of " + part.mass);

            foreach (PartResource resource in part.Resources)
            {
                // Make sure it isn't NaN as this messes up the part mass and hence most of the values
                // This can happen if a resource capacity is 0 and tweakable
                if (!Double.IsNaN(resource.amount))
                {
                    if (SimManager.logOutput)
                        MonoBehaviour.print(resource.resourceName + " = " + resource.amount);

                    resources.Add(resource.info.id, resource.amount);
                    resourceFlowStates.Add(resource.info.id, resource.flowState ? 1 : 0);
                }
                else
                {
                    MonoBehaviour.print(resource.resourceName + " is NaN. Skipping.");
                }
            }

            startMass = GetMass();

            hasVessel = (part.vessel != null);
            isLanded = hasVessel && part.vessel.Landed;
            if (hasVessel)
            {
                vesselName = part.vessel.vesselName;
                vesselType = part.vesselType;
            }
            initialVesselName = part.initialVesselName;

            hasMultiModeEngine = part.HasModule<MultiModeEngine>();
            hasModuleEnginesFX = part.HasModule<ModuleEnginesFX>();
            hasModuleEngines = part.HasModule<ModuleEngines>();

            isEngine = hasMultiModeEngine || hasModuleEnginesFX || hasModuleEngines;

            if (SimManager.logOutput)
                MonoBehaviour.print("Created " + name + ". Decoupled in stage " + decoupledInStage);
        }
Exemple #50
0
        private void DrawVessels()
        {
            bool displaying = false;

            GUILayout.Label("RENDEZVOUS DISPLAY", fe.headingStyle);

            GUILayout.BeginHorizontal(fe.areaStyle);
            GUILayout.BeginVertical();
            foreach (Vessel vessel in FlightGlobals.Vessels)
            {
                if (vessel.vesselType == typeOfVessel && vessel != fe.vessel)
                {
                    if (vessel.mainBody == fe.vessel.mainBody)
                    {
                        displaying = true;
                        if (GUILayout.Button(vessel.vesselName, fe.buttonStyle))
                        {
                            targetObject = vessel;
                            fe.settings.Changed = true;
                        }
                    }
                }
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            if (GUILayout.Button("Back to Target Type", fe.buttonStyle) || !displaying)
            {
                targetObject = null;
                typeOfTarget = TargetType.None;
                typeOfVessel = VesselType.Unknown;
                fe.settings.Changed = true;
            }
        }
		private void DrawIcon(float xPos, float yPos, VesselType vt, Color iconColor, MapIcons.OtherIcon icon = MapIcons.OtherIcon.None)
		{
			var position = new Rect(xPos - iconPixelSize * 0.5f, yPos - iconPixelSize * 0.5f,
				               iconPixelSize, iconPixelSize);

			Rect shadow = position;
			shadow.x += iconShadowShift.x;
			shadow.y += iconShadowShift.y;

			iconMaterial.color = iconColorShadowValue;
			Graphics.DrawTexture(shadow, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, iconMaterial);

			iconMaterial.color = iconColor;
			Graphics.DrawTexture(position, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, iconMaterial);
		}
Exemple #52
0
 void hangar_content_editor(int windowID)
 {
     GUILayout.BeginVertical();
     GUILayout.BeginHorizontal();
     //VAB / SPH / SubAss selection
     GUILayout.FlexibleSpace();
     for(var T = VesselType.VAB; T <= VesselType.SubAssembly; T++)
     { if(GUILayout.Toggle(vessel_type == T, T.ToString(), GUILayout.Width(100))) vessel_type = T; }
     GUILayout.FlexibleSpace();
     //Vessel selector
     if(GUILayout.Button("Select Vessel", Styles.normal_button, GUILayout.ExpandWidth(true)))
     {
         Rect sWindowPos  = new Rect(eWindowPos) { height = 500 };
         var  diff  = HighLogic.CurrentGame.Parameters.Difficulty;
         bool stock = diff.AllowStockVessels;
         if(vessel_type == VesselType.SubAssembly) diff.AllowStockVessels = false;
         vessel_selector =
             new CraftBrowser(sWindowPos,
                              vessel_dirs[(int)vessel_type],
                              HighLogic.SaveFolder, "Select a ship to store",
                              vessel_selected,
                              selection_canceled,
                              HighLogic.Skin,
                              EditorLogic.ShipFileImage, true);
         diff.AllowStockVessels = stock;
     }
     GUILayout.EndHorizontal();
     //hangar info
     float used_frac = used_volume/hangar_metric.volume;
     GUILayout.Label(string.Format("Used Volume: {0}   {1:F1}%",
                                   Utils.formatVolume(used_volume), used_frac*100f),
                     Styles.fracStyle(1-used_frac), GUILayout.ExpandWidth(true));
     //hangar contents
     List<PackedConstruct> constructs = packed_constructs.Values;
     constructs.Sort((a, b) => a.name.CompareTo(b.name));
     scroll_view = GUILayout.BeginScrollView(scroll_view, GUILayout.Height(200), GUILayout.Width(400));
     GUILayout.BeginVertical();
     foreach(PackedConstruct pc in constructs)
     {
         GUILayout.BeginHorizontal();
         GUILayout.Label(string.Format("{0}: {1}   Cost: {2:F1}",
                                       pc.name, Utils.formatMass(pc.metric.mass), pc.metric.cost),
                         Styles.label, GUILayout.ExpandWidth(true));
         if(GUILayout.Button("X", Styles.red_button, GUILayout.Width(25))) remove_construct(pc);
         GUILayout.EndHorizontal();
     }
     GUILayout.EndVertical();
     GUILayout.EndScrollView();
     if(GUILayout.Button("Clear", Styles.red_button, GUILayout.ExpandWidth(true))) clear_constructs();
     if(GUILayout.Button("Close", Styles.normal_button, GUILayout.ExpandWidth(true)))
     {
         Utils.LockIfMouseOver(eLock, eWindowPos, false);
         editing_hangar = false;
     }
     GUILayout.EndVertical();
     GUI.DragWindow(new Rect(0, 0, 500, 20));
 }
Exemple #53
0
        // This function prepares the simulation by creating all the necessary data structures it will
        // need during the simulation.  All required data is copied from the core game data structures
        // so that the simulation itself can be run in a background thread without having issues with
        // the core game changing the data while the simulation is running.
        public bool PrepareSimulation(List<Part> parts, double theGravity, double theAtmosphere = 0, double theVelocity = 0, bool dumpTree = false, bool vectoredThrust = false)
        {
            LogMsg log = null;
            if (SimManager.logOutput)
            {
                log = new LogMsg();
                log.buf.AppendLine("PrepareSimulation started");
                dumpTree = true;
            }
            _timer.Start();

            // Store the parameters in members for ease of access in other functions
            partList = parts;
            gravity = theGravity;
            atmosphere = theAtmosphere;
            velocity = theVelocity;
            lastStage = Staging.lastStage;
            //MonoBehaviour.print("lastStage = " + lastStage);

            // Create the lists for our simulation parts
            allParts = new List<PartSim>();
            allFuelLines = new List<PartSim>();
            drainingParts = new HashSet<PartSim>();
            allEngines = new List<EngineSim>();
            activeEngines = new List<EngineSim>();
            drainingResources = new HashSet<int>();

            // A dictionary for fast lookup of Part->PartSim during the preparation phase
            Dictionary<Part, PartSim> partSimLookup = new Dictionary<Part, PartSim>();

            if (partList.Count > 0 && partList[0].vessel != null)
            {
                vesselName = partList[0].vessel.vesselName;
                vesselType = partList[0].vessel.vesselType;
            }

            // First we create a PartSim for each Part (giving each a unique id)
            int partId = 1;
            foreach (Part part in partList)
            {
                // If the part is already in the lookup dictionary then log it and skip to the next part
                if (partSimLookup.ContainsKey(part))
                {
                    if (log != null)
                        log.buf.AppendLine("Part " + part.name + " appears in vessel list more than once");
                    continue;
                }

                // Create the PartSim
                PartSim partSim = new PartSim(part, partId, atmosphere, log);

                // Add it to the Part lookup dictionary and the necessary lists
                partSimLookup.Add(part, partSim);
                allParts.Add(partSim);
                if (partSim.isFuelLine)
                    allFuelLines.Add(partSim);
                if (partSim.isEngine)
                    partSim.CreateEngineSims(allEngines, atmosphere, velocity, vectoredThrust, log);

                partId++;
            }

            UpdateActiveEngines();

            // Now that all the PartSims have been created we can do any set up that needs access to other parts
            // First we set up all the parent links
            foreach (PartSim partSim in allParts)
            {
                partSim.SetupParent(partSimLookup, log);
            }

            // Then, in the VAB/SPH, we add the parent of each fuel line to the fuelTargets list of their targets
            if (HighLogic.LoadedSceneIsEditor)
            {
                foreach (PartSim partSim in allFuelLines)
                {
                    if ((partSim.part as FuelLine).target != null)
                    {
                        PartSim targetSim;
                        if (partSimLookup.TryGetValue((partSim.part as FuelLine).target, out targetSim))
                        {
                            if (log != null)
                                log.buf.AppendLine("Fuel line target is " + targetSim.name + ":" + targetSim.partId);

                            targetSim.fuelTargets.Add(partSim.parent);
                        }
                        else
                        {
                            if (log != null)
                                log.buf.AppendLine("No PartSim for fuel line target (" + partSim.part.partInfo.name + ")");
                        }
                    }
                    else
                    {
                        if (log != null)
                            log.buf.AppendLine("Fuel line target is null");
                    }
                }
            }

            //MonoBehaviour.print("SetupAttachNodes and count stages");
            foreach (PartSim partSim in allParts)
            {
                partSim.SetupAttachNodes(partSimLookup, log);
                if (partSim.decoupledInStage >= lastStage)
                    lastStage = partSim.decoupledInStage + 1;
            }

            // And finally release the Part references from all the PartSims
            //MonoBehaviour.print("ReleaseParts");
            foreach (PartSim partSim in allParts)
                partSim.ReleasePart();

            // And dereference the core's part list
            partList = null;

            _timer.Stop();
            if (log != null)
            {
                log.buf.AppendLine("PrepareSimulation: " + _timer.ElapsedMilliseconds + "ms");
                log.Flush();
            }

            if (dumpTree)
                Dump();

            return true;
        }
 public static void DrawOrbitIcon(Rect target, VesselType type)
 {
     if (iconsMap != null) {
         GUI.DrawTextureWithTexCoords(target, iconsMap, OrbitIconLocation[type]);
     }
 }
Exemple #55
0
 public Filter(WWW textureLink, VesselType type, bool enabled)
 {
     textureLink.LoadImageIntoTexture(Texture);
     Type = type;
     Enabled = enabled;
 }
Exemple #56
0
 public bool matchType(VesselType type, List<VesselType> vesselTypes)
 {
     if (Type.Equals(type))
         return true;
     if (Type.Equals(VesselType.Debris) && !vesselTypes.Contains(type))
         return true;
     return false;
 }
Exemple #57
0
        private void DrawIcon(double longitude, double latitude, VesselType vt, Color iconColor, MapIcons.OtherIcon icon = MapIcons.OtherIcon.None)
        {
            var position = new Rect((float)(longitudeToPixels(longitude, latitude) - iconPixelSize / 2),
                               (float)(latitudeToPixels(longitude, latitude) - iconPixelSize / 2),
                               iconPixelSize, iconPixelSize);

            Rect shadow = position;
            shadow.x += iconShadowShift.x;
            shadow.y += iconShadowShift.y;

            iconMaterial.color = iconColorShadowValue;
            Graphics.DrawTexture(shadow, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, iconMaterial);

            iconMaterial.color = iconColor;
            Graphics.DrawTexture(position, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, iconMaterial);
        }
 public VesselIsType(VesselType vesselType, string title = null)
     : base(title)
 {
     this.vesselType = vesselType;
     this.title = title;
 }
 /// <summary>
 /// Checks if this is one of the ignored vessel types.
 /// </summary>
 /// <param name="vesselType">The type of vessel</param>
 /// <returns>True if this type of vessel should be ignored.</returns>
 public virtual bool IsIgnoredVesselType(VesselType vesselType)
 {
     switch (vesselType)
     {
         case VesselType.Debris:
         case VesselType.Flag:
         case VesselType.SpaceObject:
         case VesselType.Unknown:
             return true;
         default:
             return false;
     }
 }
Exemple #60
0
 public override void OnStart(StartState state)
 {
     //base OnStart
     base.OnStart(state);
     if(state == StartState.None) return;
     //setup hangar name
     if(HangarName == "_none_") HangarName = part.partInfo.title;
     //initialize resources
     if(state != StartState.Editor) update_resources();
     //initialize Animator
     part.force_activate();
     hangar_gates = part.Modules.OfType<BaseHangarAnimator>().FirstOrDefault(m => m.AnimatorID == AnimatorID);
     if (hangar_gates == null)
     {
         hangar_gates = new BaseHangarAnimator();
         Utils.Log("Using BaseHangarAnimator");
     }
     else
     {
         Events["Open"].guiActiveEditor = true;
         Events["Close"].guiActiveEditor = true;
     }
     //recalculate volume and mass, start updating labels
     Setup();
     StartCoroutine(UpdateStatus());
     //store packed constructs if any
     if(packed_constructs.Count > 0) StartCoroutine(store_constructs());
     //set vessel type
     EditorLogic el = EditorLogic.fetch;
     if(el != null) vessel_type = el.editorType == EditorLogic.EditorMode.SPH ? VesselType.SPH : VesselType.VAB;
 }