public override void OnStart(PartModule.StartState state)
        {
            base.OnStart(state);
            ModuleAblator ablator = base.part.FindModuleImplementing <ModuleAblator>();

            this.ablationTempThresh = ablator.ablationTempThresh;
        }
示例#2
0
        public override void OnStartFinished(StartState state)
        {
            base.OnStartFinished(state);

            if (!HeatShieldPreset.Initialized)
            {
                return;
            }

            modAblator  = part.FindModuleImplementing <ModuleAblator>();
            modularPart = part.FindModuleImplementing <ModuleROTank>();

            if (HighLogic.LoadedSceneIsEditor && modularPart is ModuleROTank)
            {
                modularPart.Fields[nameof(modularPart.currentDiameter)].uiControlEditor.onFieldChanged         += (bf, ob) => UpdateHeatshieldValues();
                modularPart.Fields[nameof(modularPart.currentVScale)].uiControlEditor.onFieldChanged           += (bf, ob) => UpdateHeatshieldValues();
                modularPart.Fields[nameof(modularPart.currentDiameter)].uiControlEditor.onSymmetryFieldChanged += (bf, ob) => UpdateHeatshieldValues();
                modularPart.Fields[nameof(modularPart.currentVScale)].uiControlEditor.onSymmetryFieldChanged   += (bf, ob) => UpdateHeatshieldValues();
            }

            origCost = part.partInfo.cost + 0.01f;  // sum eps to avoid 0 cost
            origMass = part.prefabMass + 0.00001f;  // sum eps to avoid 0 mass

            ApplyPreset(ActivePreset);
        }
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     this.baseConductivity = this.part.heatConductivity;
     this.ablator          = this.part.FindModuleImplementing <ModuleAblator>();
     if (this.ablator != null)
     {
         this.ablatorConductivity = this.ablator.reentryConductivity;
     }
 }
 public override void OnStartFinished(StartState state)
 {
     base.OnStartFinished(state);
     modAblator  = part.FindModuleImplementing <ModuleAblator>();
     modularPart = part.FindModuleImplementing <ModuleROTank>();
     if (!(modAblator is ModuleAblator && modularPart is ModuleROTank))
     {
         ROLLog.error($"{part} Unable to find ModuleAblator or ModuleROTank modules");
         isEnabled = enabled = false;
         return;
     }
     else
     {
         if (modularPart is ModuleROTank)
         {
             modularPart.Fields[nameof(modularPart.currentDiameter)].uiControlEditor.onFieldChanged += OnDiameterChange;
         }
         UpdateHeatshieldValues();
     }
 }
示例#5
0
        public static List <string> DetermineProppellantArray(List <Part> parts)
        {
            List <string> propellants = new List <string>();

            List <string> excludedPropellants = new List <string> {
                "ElectricCharge", "IntakeAir"
            };

            foreach (Part part in parts)
            {
                foreach (PartModule partModule in part.Modules)
                {
                    if (partModule.GetType() == typeof(ModuleEngines))
                    {
                        ModuleEngines mer = part.Modules.OfType <ModuleEngines>().FirstOrDefault();
                        foreach (Propellant pr in mer.propellants)
                        {
                            if (!propellants.Contains(pr.name) && !excludedPropellants.Contains(pr.name))
                            {
                                propellants.Add(pr.name);
                            }
                        }
                    }

                    if (partModule.GetType() == typeof(ModuleEnginesFX))
                    {
                        ModuleEnginesFX mefxr = part.Modules.OfType <ModuleEnginesFX>().FirstOrDefault();
                        foreach (Propellant pr in mefxr.propellants)
                        {
                            if (!propellants.Contains(pr.name) && !excludedPropellants.Contains(pr.name))
                            {
                                propellants.Add(pr.name);
                            }
                        }
                    }

                    if (partModule.GetType() == typeof(ModuleRCS))
                    {
                        ModuleRCS mrcs = part.Modules.OfType <ModuleRCS>().FirstOrDefault();
                        if (!propellants.Contains(mrcs.resourceName) && !excludedPropellants.Contains(mrcs.resourceName))
                        {
                            propellants.Add(mrcs.resourceName);
                        }
                    }

                    if (partModule.GetType() == typeof(ModuleRCSFX))
                    {
                        ModuleRCS mrcs = part.Modules.OfType <ModuleRCSFX>().FirstOrDefault();
                        if (!propellants.Contains(mrcs.resourceName) && !excludedPropellants.Contains(mrcs.resourceName))
                        {
                            propellants.Add(mrcs.resourceName);
                        }
                    }

                    if (partModule.GetType() == typeof(ModuleAblator))
                    {
                        ModuleAblator mabl = part.Modules.OfType <ModuleAblator>().FirstOrDefault();
                        if (!propellants.Contains(mabl.ablativeResource) && !excludedPropellants.Contains(mabl.ablativeResource))
                        {
                            propellants.Add(mabl.ablativeResource);
                        }
                    }
                }
            }
            return(propellants);
        }