예제 #1
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;
            }
        }
예제 #2
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;
        }
예제 #3
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;
            }
        }
예제 #4
0
        public void Update()
        {
            if (u == null)
            {
                u = new MaterialColorUpdater(part.transform, PhysicsGlobals.TemperaturePropertyID, part);
            }

            if (val < 2)
            {
                u.Update(Color.clear, true);
            }
            else if (val < 5)
            {
                u.Update(new Color(Color.green.r, Color.green.g, Color.green.b, 0.2f), true);
            }
            else
            {
                u.Update(new Color(Color.magenta.r, Color.magenta.g, Color.magenta.b, (val - 4) * 0.2f), true);
            }

            return;
        }
        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;
        }
예제 #6
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            part.fuelCrossFeed = false;
            if (deployName != string.Empty)
            {
                base.Events ["Deploy"].guiName = deployName;

                base.Actions ["DeployAction"].guiName = deployName;
            }

            if (deployAnimationName != string.Empty)
            {
                deployAnimation = part.FindModelAnimator(deployAnimationName);
                maxFrame        = deployAnimation[deployAnimationName].length;
            }
            else
            {
                Debug.Log(header + " deployAnimationName string is empty. Check CFG file.");
            }

            if (fairingName_1 != string.Empty)
            {
                fairingTransform_1 = part.FindModelTransform(fairingName_1);
            }
            else
            {
                Debug.Log(header + " fairingName_1 string is empty. Check CFG file.");
            }

            if (fairingTransform_1 != null)
            {
                fairingTemperatureRenderer_1 = new MaterialColorUpdater(fairingTransform_1, PhysicsGlobals.TemperaturePropertyID);
            }

            if (fairingName_2 != string.Empty)
            {
                fairingTransform_2 = part.FindModelTransform(fairingName_2);

                if (fairingTransform_2 != null)
                {
                    fairingTemperatureRenderer_2 = new MaterialColorUpdater(fairingTransform_2, PhysicsGlobals.TemperaturePropertyID);
                }
            }
            else
            {
                Debug.Log(header + " fairingName_2 string is empty. check CFG file");
            }

            if (HighLogic.LoadedSceneIsFlight)
            {
                if (isDeployed)
                {
                    if (fairingTransform_1 != null && fairingTransform_2 != null)
                    {
                        fairingTransform_1.gameObject.DestroyGameObjectImmediate();

                        fairingTransform_2.gameObject.DestroyGameObjectImmediate();
                    }
                    else
                    {
                        Debug.Log(header + " fairingTransform_1 is null or fairingTransform_2 is null. Check CFG file.");
                    }
                    if (deployAnimation != null)
                    {
                        deployAnimation[deployAnimationName].speed = 0;

                        deployAnimation[deployAnimationName].normalizedTime = 1;

                        deployAnimation[deployAnimationName].wrapMode = WrapMode.Once;

                        deployAnimation.Play();
                    }
                    else
                    {
                        Debug.Log(header + " deployAnimation is null. Check CFG file.");
                    }

                    base.Events["Deploy"].active = false;

                    base.Actions["DeployAction"].active = false;
                }
                else
                {
                    AlterResources(part.Resources, "remove");
                }
            }
        }
예제 #7
0
 private void initialize()
 {
     mcu = new MaterialColorUpdater(part.transform.FindRecursive("model"), PhysicsGlobals.TemperaturePropertyID);
     resource = part.Resources[resourceName];
     float hsp = resource.info.specificHeatCapacity;
     useToFluxMultiplier = hsp * ablationEfficiency * resource.info.density;
     baseSkinIntMult = part.skinInternalConductionMult;
     //PhysicsGlobals.ThermalDataDisplay = true;
 }