Ejemplo n.º 1
0
        void CalculateGravityDistortion()
        {
            const float G = 9.81f;

            if (Grid.Physics == null || Grid.IsStatic)
            {
                GravityDistortion = 0;
                return;
            }
            List <IMyGravityGeneratorBase> GravGens = new List <IMyGravityGeneratorBase>();

            Grid.GetTerminalSystem().GetBlocksOfType(GravGens, x => (x as IMyCubeBlock).IsWorking);
            float MassDistortion = RadarCore.GetMassDistortion(Grid);
            float ArtificialGravityDistortion = 0;

            if (GravGens.Count != 0)
            {
                foreach (var GravGen in GravGens)
                {
                    ArtificialGravityDistortion += Math.Abs(GravGen.GravityAcceleration);
                }

                ArtificialGravityDistortion = (ArtificialGravityDistortion / G * 1000) / 2;
            }

            GravityDistortion = MassDistortion + ArtificialGravityDistortion;
        }