Exemple #1
0
        void SymmetryMaintenance()
        {
            foreach (Part i in part.symmetryCounterparts)
            {
                EngineDecay engineDecay = i.FindModuleImplementing <EngineDecay>();
                if (i != null)
                {
                    engineDecay.MaintenanceFromCounterpart();
                }
                else
                {
                    UnityEngine.Debug.Log("EngineDecay found a counterpart without EngineDecay, it is really WEIRD!");
                }
            }

            MaintenanceFromCounterpart();
        }
Exemple #2
0
        void MaintenanceEvent()
        {
            foreach (Part i in part.symmetryCounterparts)
            {
                EngineDecay engineDecay = i.FindModuleImplementing <EngineDecay>();
                if (i != null)
                {
                    engineDecay.CounterpartMaintenance(maintenanceCost);
                }
                else
                {
                    UnityEngine.Debug.Log("EngineDecay found a counterpart without EngineDecay, it is really WEIRD!");
                }
            }

            CounterpartMaintenance(maintenanceCost);                            // the counterpart is the same part for this case, we call it to update symmetry maintenance button

            Maintenance();

            GameEvents.onEditorShipModified.Fire(EditorLogic.fetch.ship);
        }
Exemple #3
0
        public void Update()
        {
            if (PayToPlaySettings.Enable)
            {
                if (!inEditor && newBorn)
                {
                    throw new Exception("EngineDecay MODULE thinks it is not in editor but not initialized yet");
                }

                if (inEditor)
                {
                    newBorn = false;

                    UpdateMaintenanceCost();

                    List <Part> counterparts = part.symmetryCounterparts;
                    if (counterparts.Count() != 0)
                    {
                        if (symmetryMaintenanceCost == -1)
                        {
                            foreach (Part i in counterparts)
                            {
                                EngineDecay engineDecay = i.FindModuleImplementing <EngineDecay>();
                                if (engineDecay != null)
                                {
                                    symmetryMaintenanceCost += engineDecay.UpdateMaintenanceCost();
                                }
                                else
                                {
                                    UnityEngine.Debug.Log("EngineDecay found a counterpart without EngineDecay, it is really WEIRD!");
                                }
                            }

                            foreach (Part i in counterparts)
                            {
                                EngineDecay engineDecay = i.FindModuleImplementing <EngineDecay>();
                                if (engineDecay != null)
                                {
                                    engineDecay.symmetryMaintenanceCost = symmetryMaintenanceCost;
                                    if (symmetryMaintenanceCost > 0)
                                    {
                                        engineDecay.Events["SymmetryMaintenance"].guiName         = string.Format("Symmetry Maintenance: {0}", symmetryMaintenanceCost);
                                        engineDecay.Events["SymmetryMaintenance"].guiActiveEditor = true;
                                    }
                                }
                                else
                                {
                                    UnityEngine.Debug.Log("EngineDecay found a counterpart without EngineDecay, it is really WEIRD!");
                                }
                            }
                        }

                        if (symmetryMaintenanceCost > 0)
                        {
                            Events["SymmetryMaintenance"].guiName         = string.Format("Symmetry Maintenance: {0}", symmetryMaintenanceCost);
                            Events["SymmetryMaintenance"].guiActiveEditor = true;
                        }
                    }

                    if (prevEBTP != extraBurnTimePercent || prevEIP != extraIgnitionsPercent)
                    {
                        if (maintenanceCost > 0)
                        {
                            SymmetryMaintenance();
                        }

                        if (topBaseRatedTime != -1)
                        {
                            currentBaseRatedTime = ProbabilityLib.ATangentCumulativePercentArg(r, topBaseRatedTime);

                            setBurnTime  = currentBaseRatedTime * (1 + extraBurnTimePercent * (topMaxRatedTime / topBaseRatedTime - 1) / 100);
                            usedBurnTime = 0;
                        }

                        if (baseIgnitions != -1)
                        {
                            setIgnitions  = (int)(baseIgnitions + extraIgnitionsPercent * (maxIgnitions - baseIgnitions) / 100);
                            ignitionsLeft = setIgnitions;
                        }

                        UpdateIndicators();

                        maintenanceCost = 0;
                        Events["MaintenanceEvent"].guiActiveEditor = false;

                        prevEBTP = extraBurnTimePercent;
                        prevEIP  = extraIgnitionsPercent;

                        failAtBurnTime = -1;
                    }
                }
            }
        }