Ejemplo n.º 1
0
        public bool PurchaseConfig(string cfgName)
        {
            if (ConfigUnlocked(cfgName))
            {
                return(false);
            }

            double cfgCost = ConfigEntryCost(cfgName);

            if (!HighLogic.CurrentGame.Parameters.Difficulty.BypassEntryPurchaseAfterResearch)
            {
                if (Funding.Instance.Funds < cfgCost)
                {
                    return(false);
                }

                Funding.Instance.AddFunds(-cfgCost, TransactionReasons.RnDPartPurchase);
            }

            EntryCostDatabase.SetUnlocked(cfgName);

            EntryCostDatabase.UpdatePartEntryCosts();

            return(true);
        }
Ejemplo n.º 2
0
        public void onPartPurchased(AvailablePart ap)
        {
            EntryCostDatabase.SetUnlocked(ap);

            StartCoroutine(updatePartEntryCosts());

            Part part = ap.partPrefab;

            if (part != null)
            {
                for (int i = part.Modules.Count - 1; i >= 0; --i)
                {
                    PartModule m = part.Modules[i];
                    if (m is ModuleEngineConfigs)
                    {
                        ModuleEngineConfigs mec = m as ModuleEngineConfigs;
                        mec.CheckConfigs();
                        for (int j = mec.configs.Count - 1; j >= 0; --j)
                        {
                            ConfigNode cfg = mec.configs[j];
                            if (cfg.HasValue("name"))
                            {
                                string cfgName = cfg.GetValue("name");

                                // TL upgrades
                                if (mec.techLevel >= 0)
                                {
                                    string tUName = Utilities.GetPartName(ap) + cfgName;
                                    SetTLUnlocked(tUName, mec.techLevel);
                                }
                            }
                        }
                    }
                }
            }
        }