Ejemplo n.º 1
0
        private void OnEditorPodPicked(Part data)
        {
            var vesselName = EditorLogic.fetch.shipNameField.text;

            if (vesselName != "" && vesselName != Localizer.Format("#autoLOC_900530"))
            {
                return;
            }

            var vesselDefinition = new VesselDefinition
            {
                PartName   = data.name,
                VesselType = data.vesselType,
                HasCrew    = data.CrewCapacity > 0
            };

            EditorLogic.fetch.shipNameField.text = vesselNameService.RetrieveVesselName(vesselDefinition);
            Debug.Log("[QuickVesselName] Vessel name changed");
        }
Ejemplo n.º 2
0
        public string RetrieveVesselName(VesselDefinition vesselDefinition)
        {
            string[] names = null;

            // Vessel is a Rover
            if (vesselDefinition.VesselType == VesselType.Rover ||
                config.RoverParts.Contains(vesselDefinition.PartName))
            {
                names = config.RoverNames;
            }

            // Vessel is a Probe
            if (vesselDefinition.VesselType == VesselType.Probe)
            {
                names = config.ProbeNames;
            }

            // Vessel is a Station
            if (vesselDefinition.VesselType == VesselType.Station)
            {
                names = config.StationNames;
            }

            // Vessel is a Pod
            if (vesselDefinition.HasCrew)
            {
                names = config.CrewedNames;
            }

            // Vessel isn't defined
            if (names == null)
            {
                names = config.LauncherNames;
            }

            return(RetrieveRandomName(names));
        }