Beispiel #1
0
        public static void FlightLog(params object[] msgparts)
        {
            string msg = "[" + KSPUtil.PrintTimeStamp(FlightLogger.met) + "] FTLDriveContinued: " + string.Join("", msgparts.Select(o => o.ToString()).ToArray());

            FlightLogger.eventLog.Add(msg);
            UnityEngine.Debug.Log(msg);
        }
Beispiel #2
0
        public static void DisplayMsg(params object[] msgparts)
        {
            string msg      = "[" + KSPUtil.PrintTimeStamp(FlightLogger.met) + "] FTLDriveContinued: " + string.Join("", msgparts.Select(o => o.ToString()).ToArray());
            string msgshort = string.Join("", msgparts.Select(o => o.ToString()).ToArray());

            ScreenMessages.PostScreenMessage(msgshort, 4f, ScreenMessageStyle.UPPER_CENTER);
            UnityEngine.Debug.Log(msg);
        }
Beispiel #3
0
        private void ApplyAeroStressFailure()
        {
            bool failureOccured = false;

            if (part.Modules.Contains <ModuleProceduralFairing>())
            {
                var fairing = part.Modules.GetModule <ModuleProceduralFairing>();
                fairing.ejectionForce = 0.5f;

                fairing.DeployFairing();
                failureOccured = true;
            }

            List <Part> children = part.children;

            // ReSharper disable once ForCanBeConvertedToForeach -> decouple modifies collection
            for (int i = 0; i < children.Count; i++)
            {
                Part child = children[i];
                child.decouple(25);

                failureOccured = true;
            }

            if (part.parent)
            {
                part.decouple(25);
                failureOccured = true;
            }

            if (!failureOccured || !vessel)
            {
                return;
            }
            vessel.SendMessage("AerodynamicFailureStatus");
            string msg = Localizer.Format("FARFlightLogAeroFailure",
                                          KSPUtil.PrintTimeStamp(FlightLogger.met),
                                          part.partInfo.title);

            FlightLogger.eventLog.Add(msg);
            if (FARDebugValues.aeroFailureExplosions)
            {
                FXMonger.Explode(part, partTransform.position, (float)projectedArea.totalArea * 0.0005f);
            }
        }
Beispiel #4
0
 private void CheckDynamicPressure()
 {
     if (vessel == null)
     {
         return;
     }
     if (!vessel.HoldPhysics && vessel.atmDensity > 0 && MaxDynamicPressure > 0)
     {
         if (vessel.dynamicPressurekPa > MaxDynamicPressure) // && !part.ShieldedFromAirstream)
         {
             if (!IsProtected)                               //CheckProtectionFromParent())
             {
                 ScreenMessages.PostScreenMessage(part.partInfo.title + " was ripped off by strong airflow.", 5f, ScreenMessageStyle.UPPER_CENTER);
                 string msg = string.Format(KSPUtil.PrintTimeStamp(FlightLogger.met), part.partInfo.title);
                 FlightLogger.eventLog.Add(string.Format("[{0}]: {1} was ripped off by strong airflow.", msg, part.partInfo.title));
                 part.decouple();
             }
         }
     }
 }
Beispiel #5
0
 public string PrintTimeStamp(double time, bool days = false, bool years = false) => KSPUtil.PrintTimeStamp(time, days, years);
Beispiel #6
0
 /// <summary>
 /// Adds a new entry to the flight events log.
 /// Automatically adds the MET at the beginning of the log
 /// </summary>
 public static void FlightLog(string msg)
 {
     FlightLogger.eventLog.Add("[" + KSPUtil.PrintTimeStamp(FlightLogger.met) + "]: " + msg);
 }
        private void ApplyAeroStressFailure()
        {
            bool failureOccured = false;

            if (part.Modules.Contains <ModuleProceduralFairing>())
            {
                ModuleProceduralFairing fairing = part.Modules.GetModule <ModuleProceduralFairing>();
                fairing.ejectionForce = 0.5f;

                fairing.DeployFairing();
                failureOccured = true;
            }

            List <Part> children = part.children;

            for (int i = 0; i < children.Count; i++)
            {
                Part child = children[i];
                child.decouple(25);


                failureOccured = true;
            }
            if (part.parent)
            {
                part.decouple(25);
                failureOccured = true;
            }

            if (failureOccured)
            {
                if (vessel)
                {
                    vessel.SendMessage("AerodynamicFailureStatus");
                    string msg = String.Format("[{0}] {1} failed due to aerodynamic stresses.", KSPUtil.PrintTimeStamp(FlightLogger.met), part.partInfo.title);
                    FlightLogger.eventLog.Add(msg);
                    if (FARDebugValues.aeroFailureExplosions)
                    {
                        FXMonger.Explode(part, partTransform.position, (float)projectedArea.totalArea * 0.0005f);
                    }
                }
            }
        }