Ejemplo n.º 1
0
 private void register(
     string subId,
     double force,
     double minPlanetaryInfluence,
     double maxPlanetaryInfluence,
     double effectivenessAtMinInfluence,
     double effectivenessAtMaxInfluence,
     bool needsAtmosphereForInfluence = false)
 {
     thrusterTypes[subId] = new ThrusterInfo(
         force,
         minPlanetaryInfluence,
         maxPlanetaryInfluence,
         effectivenessAtMinInfluence,
         effectivenessAtMaxInfluence,
         needsAtmosphereForInfluence);
 }
Ejemplo n.º 2
0
    private void UpdateThrusterPower()
    {
        MotionDebug = "";

        powerPosX = 0;
        powerNegX = 0;
        powerPosY = 0;
        powerNegY = 0;
        powerPosZ = 0;
        powerNegZ = 0;

        bool   inAtmosphere = false;
        double airDensity   = 0;

        double altitude;

        if (shipController.TryGetPlanetElevation(MyPlanetElevation.Sealevel, out altitude))
        {
            inAtmosphere = altitude < atmosphereAltitude;
            if (inAtmosphere)
            {
                airDensity = getAirDensityAtPlanet(altitude);
            }
        }

        foreach (IMyThrust thruster in thrusters)
        {
            Base6Directions.Direction direction = Base6Directions.GetFlippedDirection(thruster.Orientation.Forward);
            ThrusterInfo info = thrusterTypes.GetValueOrDefault(thruster.BlockDefinition.SubtypeId);
            if (info == null)
            {
                program.Echo("Unknown thruster type: " + thruster.BlockDefinition.SubtypeId);
                continue;
            }

            double power = info.GetPower(inAtmosphere, airDensity);
            switch (direction)
            {
            case Base6Directions.Direction.Right:
                powerPosX += power;
                break;

            case Base6Directions.Direction.Left:
                powerNegX += power;
                break;

            case Base6Directions.Direction.Up:
                powerPosY += power;
                break;

            case Base6Directions.Direction.Down:
                powerNegY += power;
                break;

            case Base6Directions.Direction.Backward:
                powerPosZ += power;
                break;

            case Base6Directions.Direction.Forward:
                powerNegZ += power;
                break;
            }
        }
    }
Ejemplo n.º 3
0
 private void register(string s, double f, double a, double b, double c, double d, bool n = false)
 {
     TH[s] = new ThrusterInfo(f, a, b, c, d, n);
 }