コード例 #1
0
        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);

            if (!FARDebugValues.allowStructuralFailures || !node.HasNode("FARPartStressTemplate"))
            {
                return;
            }
            ConfigNode            stressTemplate  = node.GetNode("FARPartStressTemplate");
            FARPartStressTemplate defaultTemplate = FARAeroStress.DetermineStressTemplate(part);

            if (stressTemplate.HasValue("YmaxStress"))
            {
                if (!double.TryParse(stressTemplate.GetValue("YmaxStress"), out partStressMaxY))
                {
                    partStressMaxY = defaultTemplate.YmaxStress;
                }
            }
            // ReSharper disable once InvertIf
            if (stressTemplate.HasValue("XZmaxStress"))
            {
                if (!double.TryParse(stressTemplate.GetValue("XZmaxStress"), out partStressMaxXZ))
                {
                    partStressMaxXZ = defaultTemplate.XZmaxStress;
                }
            }
        }
コード例 #2
0
        void Start()
        {
            if (waterSlowDragNew < 0)
            {
                waterSlowDragNew    = PhysicsGlobals.BuoyancyWaterDragSlow;
                minVelVesselMultNew = (float)PhysicsGlobals.BuoyancyWaterDragPartVelGreaterVesselMult;
                PhysicsGlobals.BuoyancyWaterDragPartVelGreaterVesselMult = 0;
            }

            part.maximum_drag = 0;
            part.minimum_drag = 0;
            part.angularDrag  = 0;
            if (HighLogic.LoadedSceneIsFlight)
            {
                this.enabled = true;
            }
            else if (HighLogic.LoadedSceneIsEditor)
            {
                this.enabled = false;
            }

            partLocalVel    = Vector3.zero;
            partLocalForce  = Vector3.zero;
            partLocalTorque = Vector3.zero;

            //if (!part.Modules.Contains("ModuleAeroSurface"))
            //    part.dragModel = Part.DragModel.CYLINDRICAL;

            if (FARDebugValues.allowStructuralFailures)
            {
                FARPartStressTemplate template = FARAeroStress.DetermineStressTemplate(this.part);
                partStressMaxY  = template.YmaxStress;
                partStressMaxXZ = template.XZmaxStress;
            }
            partTransform = part.partTransform;

            materialColorUpdater = new MaterialColorUpdater(partTransform, PhysicsGlobals.TemperaturePropertyID);
            if (part.Modules.Contains <FARWingAerodynamicModel>())
            {
                legacyWingModel = part.Modules.GetModule <FARWingAerodynamicModel>();
            }
            else if (part.Modules.Contains <FARControllableSurface>())
            {
                legacyWingModel = part.Modules.GetModule <FARControllableSurface>();
            }
            else
            {
                legacyWingModel = null;
            }

            // For handling airbrakes aero visualization
            if (part.Modules.Contains <ModuleAeroSurface>())
            {
                stockAeroSurfaceModule = part.Modules.GetModule <ModuleAeroSurface>();
            }
            else
            {
                stockAeroSurfaceModule = null;
            }
        }
コード例 #3
0
        private void Start()
        {
            shield = new DummyAirstreamShield {
                part = part
            };

            if (waterSlowDragNew < 0)
            {
                waterSlowDragNew    = PhysicsGlobals.BuoyancyWaterDragSlow;
                minVelVesselMultNew = (float)PhysicsGlobals.BuoyancyWaterDragPartVelGreaterVesselMult;
                PhysicsGlobals.BuoyancyWaterDragPartVelGreaterVesselMult = 0;
            }

            part.maximum_drag = 0;
            part.minimum_drag = 0;
            part.angularDrag  = 0;
            if (HighLogic.LoadedSceneIsFlight)
            {
                enabled = true;
            }
            else if (HighLogic.LoadedSceneIsEditor)
            {
                enabled = false;
            }

            partLocalVel    = Vector3.zero;
            partLocalForce  = Vector3.zero;
            partLocalTorque = Vector3.zero;

            if (FARDebugValues.allowStructuralFailures && !partStressOverride)
            {
                FARPartStressTemplate template = FARAeroStress.DetermineStressTemplate(part);
                partStressMaxY  = template.YMaxStress;
                partStressMaxXZ = template.XZMaxStress;
            }

            partTransform = part.partTransform;

            materialColorUpdater = new MaterialColorUpdater(partTransform, PhysicsGlobals.TemperaturePropertyID);
            if (part.Modules.Contains <FARWingAerodynamicModel>())
            {
                LegacyWingModel = part.Modules.GetModule <FARWingAerodynamicModel>();
            }
            else if (part.Modules.Contains <FARControllableSurface>())
            {
                LegacyWingModel = part.Modules.GetModule <FARControllableSurface>();
            }
            else
            {
                LegacyWingModel = null;
            }

            // For handling airbrakes aero visualization
            stockAeroSurfaceModule = part.Modules.Contains <ModuleAeroSurface>()
                                         ? part.Modules.GetModule <ModuleAeroSurface>()
                                         : null;
        }
コード例 #4
0
        void Start()
        {
            part.maximum_drag = 0;
            part.minimum_drag = 0;
            part.angularDrag  = 0;
            if (HighLogic.LoadedSceneIsFlight)
            {
                this.enabled = true;
            }
            else if (HighLogic.LoadedSceneIsEditor)
            {
                this.enabled = false;
            }

            partLocalVel    = Vector3.zero;
            partLocalForce  = Vector3.zero;
            partLocalTorque = Vector3.zero;

            if (!part.Modules.Contains("ModuleAeroSurface"))
            {
                part.dragModel = Part.DragModel.CYLINDRICAL;
            }

            if (FARDebugValues.allowStructuralFailures)
            {
                FARPartStressTemplate template = FARAeroStress.DetermineStressTemplate(this.part);
                partStressMaxY  = template.YmaxStress;
                partStressMaxXZ = template.XZmaxStress;
            }
            partTransform = part.partTransform;

            materialColorUpdater = new MaterialColorUpdater(partTransform, PhysicsGlobals.TemperaturePropertyID);
            if (part.Modules.Contains("FARWingAerodynamicModel"))
            {
                legacyWingModel = part.Modules["FARWingAerodynamicModel"] as FARWingAerodynamicModel;
            }
            else if (part.Modules.Contains("FARControllableSurface"))
            {
                legacyWingModel = part.Modules["FARControllableSurface"] as FARWingAerodynamicModel;
            }
            else
            {
                legacyWingModel = null;
            }

            // For handling airbrakes aero visualization
            if (part.Modules.Contains("ModuleAeroSurface"))
            {
                stockAeroSurfaceModule = part.Modules["ModuleAeroSurface"] as ModuleAeroSurface;
            }
            else
            {
                stockAeroSurfaceModule = null;
            }
        }
コード例 #5
0
        void Start()
        {
            part.maximum_drag = 0;
            part.minimum_drag = 0;
            part.angularDrag  = 0;
            this.enabled      = false;

            partLocalVel    = Vector3.zero;
            partLocalForce  = Vector3.zero;
            partLocalTorque = Vector3.zero;

            if (FARDebugValues.allowStructuralFailures)
            {
                FARPartStressTemplate template = FARAeroStress.DetermineStressTemplate(this.part);
                partStressMaxY  = template.YmaxStress;
                partStressMaxXZ = template.XZmaxStress;
            }
            partTransform = part.partTransform;
        }
コード例 #6
0
        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);

            if (FARDebugValues.allowStructuralFailures && node.HasNode("FARPartStressTemplate"))
            {
                ConfigNode            stressTemplate  = node.GetNode("FARPartStressTemplate");
                FARPartStressTemplate defaultTemplate = FARAeroStress.DetermineStressTemplate(this.part);
                if (stressTemplate.HasValue("YmaxStress"))
                {
                    if (!double.TryParse(stressTemplate.GetValue("YmaxStress"), out partStressMaxY))
                    {
                        partStressMaxY = defaultTemplate.YmaxStress;
                    }
                }
                if (stressTemplate.HasValue("XZmaxStress"))
                {
                    if (!double.TryParse(stressTemplate.GetValue("XZmaxStress"), out partStressMaxXZ))
                    {
                        partStressMaxXZ = defaultTemplate.XZmaxStress;
                    }
                }
            }
        }