Exemple #1
0
 public bool CheckVesselType(Vessel v)
 {
     Enums.CustomVesselType vt = Enums.VesselTypetoCustomVesselType(v.vesselType);
     if ((vt & vesselType) != vt)
     {
         Utils.Log("Prereq failed: Expected situation " + vesselType + ", but was " + vt);
         return(false);
     }
     return(true);
 }
Exemple #2
0
 public Prerequisites(Prerequisites p)
 {
     bodyName           = p.bodyName;
     paused             = p.paused;
     scene              = p.scene;
     situation          = p.situation;
     cameraMode         = p.cameraMode;
     inAtmosphere       = p.inAtmosphere;
     timeOfDay          = p.timeOfDay;
     maxVelocitySurface = p.maxVelocitySurface;
     minVelocitySurface = p.minVelocitySurface;
     maxVelocityOrbital = p.maxVelocityOrbital;
     minVelocityOrbital = p.minVelocityOrbital;
     maxAltitude        = p.maxAltitude;
     minAltitude        = p.minAltitude;
     vesselState        = p.vesselState;
     vesselType         = p.vesselType;
 }
Exemple #3
0
        private bool IsFlightSituationChanged()
        {
            bool   changed = false;
            Vessel v       = SoundtrackEditor.InitialLoadingComplete ? FlightGlobals.ActiveVessel : null;

            if (v != null)
            {
                Enums.Selector inAtmosphere = v.atmDensity > 0 ? Enums.Selector.True : Enums.Selector.False;
                if (SoundtrackEditor.CurrentSituation.inAtmosphere != inAtmosphere)
                {
                    SoundtrackEditor.CurrentSituation.inAtmosphere = inAtmosphere;
                    if (MonitorInAtmosphere)
                    {
                        Utils.Log("In atmosphere changed");
                        changed = true;
                    }
                }

                // For surface velocity, orbital velocity and altitude, check if we crossed the monitored point going in either direction.
                if (MonitorSurfaceVelocity)
                {
                    if ((v.srf_velocity.magnitude > _maxSrfVel && v.srf_velocity.magnitude < _previousSrfVel) ||
                        (v.srf_velocity.magnitude < _maxSrfVel && v.srf_velocity.magnitude > _previousSrfVel))
                    {
                        changed = true;
                    }
                    if ((v.srf_velocity.magnitude > _minSrfVel && v.srf_velocity.magnitude < _previousSrfVel) ||
                        (v.srf_velocity.magnitude < _minSrfVel && v.srf_velocity.magnitude > _previousSrfVel))
                    {
                        changed = true;
                    }
                    _previousSrfVel = v.srf_velocity.magnitude;
                }
                if (MonitorOrbitalVelocity)
                {
                    if ((v.obt_velocity.magnitude > _maxObtVel && v.obt_velocity.magnitude < _previousObtVel) ||
                        (v.obt_velocity.magnitude < _maxObtVel && v.obt_velocity.magnitude > _previousObtVel))
                    {
                        changed = true;
                    }
                    if ((v.obt_velocity.magnitude > _minObtVel && v.obt_velocity.magnitude < _previousObtVel) ||
                        (v.obt_velocity.magnitude < _minObtVel && v.obt_velocity.magnitude > _previousObtVel))
                    {
                        changed = true;
                    }
                    _previousObtVel = v.obt_velocity.magnitude;
                }

                if (MonitorAltitude)
                {
                    if ((v.altitude > _maxAlt && v.altitude < _previousAlt) ||
                        (v.altitude < _maxAlt && v.altitude > _previousAlt))
                    {
                        changed = true;
                    }
                    if ((v.altitude > _minAlt && v.altitude < _previousAlt) ||
                        (v.altitude < _minAlt && v.altitude > _previousAlt))
                    {
                        changed = true;
                    }
                    _previousAlt = v.altitude;
                }

                if (MonitorNearestVessel)
                {
                    Vessel newVessel = Utils.GetNearestVessel(_minVesselDist, _maxVesselDist, v);
                    if (newVessel != null && NearestVessel != newVessel)
                    {
                        NearestVessel = newVessel;
                        changed       = true;
                    }
                }

                if (MonitorVesselState)
                {
                    if (_previousVesselState != Enums.ConvertVesselState(v.state))
                    {
                        Utils.Log("Vessel state changed");
                        _previousVesselState = Enums.ConvertVesselState(v.state);
                        changed = true;
                    }
                }
                if (MonitorVesselType)
                {
                    if (_previousVesselType != Enums.VesselTypetoCustomVesselType(v.vesselType))
                    {
                        Utils.Log("Vessel type changed");
                        _previousVesselType = Enums.VesselTypetoCustomVesselType(v.vesselType);
                        changed             = true;
                    }
                }
            }
            return(changed);
        }