예제 #1
0
 public override void Reset()
 {
     this.drillParts.Clear();
     this.drillInstalled = false;
     this.heatshieldParts.Clear();
     this.wheelDeployments.Clear();
     this.wheelBrakes.Clear();
     this.airBrakes.Clear();
     this.flaps.Clear();
     this.totalMass           = 0.0;
     this.dragCoefficent      = 0.0;
     this.heatshieldTemp      = 0.0;
     this.heatshieldInstalled = false;
     this.landingGearState    = GEARSTATES.NOT_INSTALLED;
     this.brakeState          = BRAKESTATES.NOT_INSTALLED;
     this.airBrakeState       = BRAKESTATES.NOT_INSTALLED;
     this.flapState           = FPLAPSTATES.NOT_INSTALLED;
 }
예제 #2
0
 protected override void Inspect(Vessel vessel)
 {
     if (vessel == null)
     {
         totalMass      = 0.0;
         heatshieldTemp = 0.0;
     }
     else
     {
         // mass
         totalMass = vessel.GetTotalMass();
         // heat shields
         heatshieldTemp = Constants.MIN_TEMP;
         foreach (Part p in heatshieldParts)
         {
             if (p.temperature > heatshieldTemp)
             {
                 heatshieldTemp = p.temperature;
             }
         }
         // drills
         drillTemp = Constants.MIN_TEMP;
         foreach (Part p in drillParts)
         {
             if (p.temperature > drillTemp)
             {
                 drillTemp = p.temperature;
             }
         }
         //// landing gears
         //this.landingGearState = InspectLandingGear();
         //// brakes
         //this.brakeState = InspectBrakes();
         // air brakes
         this.airBrakeState = InspectAirBrakes();
         // flaps
         this.flapState = InspectFlaps();
     }
 }
예제 #3
0
            protected void ScanVesselParts(Vessel vessel)
            {
                Reset();
                foreach (Part part in vessel.Parts)
                {
                    if (part.packed)
                    {
                        part.Unpack();
                    }

                    // Debug
                    if (Log.IsLogable(Log.LEVEL.DETAIL))
                    {
                        Log.Detail("scanning vessel part " + part.name);
                        foreach (PartModule module in part.Modules)
                        {
                            Log.Detail(" module " + module.GetType());
                        }
                    }

                    foreach (PartResource r in part.Resources)
                    {
                        if ((r.info != null && Resources.ABLATOR != null && r.info.id == Resources.ABLATOR.id) ||                     // Stock
                            (r.info != null && Resources.ABLATIVE_SHIELDING != null && r.info.id == Resources.ABLATIVE_SHIELDING.id)) // Deadly Reentry
                        {
                            heatshieldParts.Add(part);
                            this.heatshieldInstalled = true;
                            break;
                        }
                    }

                    if (part.IsDrill())
                    {
                        drillParts.Add(part);
                        this.drillInstalled = true;
                    }

                    // landing gears and brakes
                    foreach (ModuleWheelDeployment g in part.Modules.OfType <ModuleWheelDeployment> ())
                    {
                        wheelDeployments.Add(g);
                    }

                    foreach (ModuleWheelBrakes g in part.Modules.OfType <ModuleWheelBrakes> ())
                    {
                        wheelBrakes.Add(g);
                    }

                    foreach (ModuleControlSurface s in part.Modules.OfType <ModuleControlSurface>())
                    {
                        bool isAirBrake = false;
                        //
                        if (s.ignoreRoll && s.ignoreYaw && s.ignorePitch)
                        {
                            foreach (BaseAction a in s.Actions)
                            {
                                if (a.name.Equals("ActionToggleBrakes"))
                                {
                                    airBrakes.Add(s);
                                    isAirBrake = true;
                                    break;
                                }
                            }
                            // no airbrake => flap
                            if (!isAirBrake)
                            {
                                flaps.Add(s);
                            }
                        }
                    }
                }

                this.landingGearState = InspectLandingGear();
                this.brakeState       = InspectBrakes();
                this.airBrakeState    = InspectAirBrakes();
                this.flapState        = InspectFlaps();
            }