コード例 #1
0
ファイル: Loader.cs プロジェクト: gotmachine/Kerbalism-1
        public void Start()
        {
            // log version
            Lib.Log("version " + Lib.Version());

            Lib.Log("Forcing KSP to load resources...");
            PartResourceLibrary.Instance.LoadDefinitions();

            // parse settings
            Settings.Parse();
            // parse profile
            Profile.Parse();
            // detect features
            Features.Detect();

            // get configs from DB
            UrlDir.UrlFile root = null;
            foreach (UrlDir.UrlConfig url in GameDatabase.Instance.root.AllConfigs)
            {
                root = url.parent; break;
            }

            // inject MM patches on-the-fly, so that profile/features can be queried with NEEDS[]
            Inject(root, "Profile", Lib.UppercaseFirst(Settings.Profile));
            if (Features.Reliability)
            {
                Inject(root, "Feature", "Reliability");
            }
            if (Features.Deploy)
            {
                Inject(root, "Feature", "Deploy");
            }
            if (Features.SpaceWeather)
            {
                Inject(root, "Feature", "SpaceWeather");
            }
            if (Features.Automation)
            {
                Inject(root, "Feature", "Automation");
            }
            if (Features.Science)
            {
                Inject(root, "Feature", "Science");
            }
            if (Features.Radiation)
            {
                Inject(root, "Feature", "Radiation");
            }
            if (Features.Shielding)
            {
                Inject(root, "Feature", "Shielding");
            }
            if (Features.LivingSpace)
            {
                Inject(root, "Feature", "LivingSpace");
            }
            if (Features.Comfort)
            {
                Inject(root, "Feature", "Comfort");
            }
            if (Features.Poisoning)
            {
                Inject(root, "Feature", "Poisoning");
            }
            if (Features.Pressure)
            {
                Inject(root, "Feature", "Pressure");
            }
            if (Features.Humidity)
            {
                Inject(root, "Feature", "Humidity");
            }
            if (Features.Habitat)
            {
                Inject(root, "Feature", "Habitat");
            }
            if (Features.Supplies)
            {
                Inject(root, "Feature", "Supplies");
            }

            // inject harmony patches
            HarmonyInstance harmony = HarmonyInstance.Create("Kerbalism");

            harmony.PatchAll(Assembly.GetExecutingAssembly());
            var methods = harmony.GetPatchedMethods();
        }
コード例 #2
0
        public static void Init()
        {
            // log version
            Lib.Verbose("version " + Lib.Version());

            // parse settings
            Settings.Parse();

            // parse profile
            Profile.Parse();

            // detect features
            Features.Detect();

            // get configs from DB
            UrlDir.UrlFile root = null;
            foreach (UrlDir.UrlConfig url in GameDatabase.Instance.root.AllConfigs)
            {
                root = url.parent; break;
            }

            // inject MM patches on-the-fly, so that profile/features can be queried with NEEDS[]
            Inject(root, "Profile", Lib.UppercaseFirst(Settings.Profile));
            if (Features.Reliability)
            {
                Inject(root, "Feature", "Reliability");
            }
            if (Features.Signal)
            {
                Inject(root, "Feature", "Signal");
            }
            if (Features.KCommNet)
            {
                Inject(root, "Feature", "KCommNet");
            }
            if (Features.AdvancedEC)
            {
                Inject(root, "Feature", "AdvancedEC");
            }
            if (Features.SpaceWeather)
            {
                Inject(root, "Feature", "SpaceWeather");
            }
            if (Features.Automation)
            {
                Inject(root, "Feature", "Automation");
            }
            if (Features.Science)
            {
                Inject(root, "Feature", "Science");
            }
            if (Features.Radiation)
            {
                Inject(root, "Feature", "Radiation");
            }
            if (Features.Shielding)
            {
                Inject(root, "Feature", "Shielding");
            }
            if (Features.LivingSpace)
            {
                Inject(root, "Feature", "LivingSpace");
            }
            if (Features.Comfort)
            {
                Inject(root, "Feature", "Comfort");
            }
            if (Features.Poisoning)
            {
                Inject(root, "Feature", "Poisoning");
            }
            if (Features.Pressure)
            {
                Inject(root, "Feature", "Pressure");
            }
            if (Features.Habitat)
            {
                Inject(root, "Feature", "Habitat");
            }
            if (Features.Supplies)
            {
                Inject(root, "Feature", "Supplies");
            }
        }
コード例 #3
0
        public void Start()
        {
            // log version
            Lib.Log("Version : " + Lib.KerbalismVersion + " - Build : " + Lib.KerbalismDevBuild);

            if (LocalHelpers.GenerateEnglishLoc)
            {
                LocalHelpers.GenerateLoc();
            }

            if (LocalHelpers.UpdateNonEnglishLoc)
            {
                LocalHelpers.RegenerateNonEnglishLoc();
            }

            Lib.Log("Forcing KSP to load resources...");
            PartResourceLibrary.Instance.LoadDefinitions();

            // parse settings
            Settings.Parse();
            // parse profile
            Profile.Parse();
            // detect features
            Features.Detect();

            // get configs from DB
            UrlDir.UrlFile root = null;
            foreach (UrlDir.UrlConfig url in GameDatabase.Instance.root.AllConfigs)
            {
                root = url.parent; break;
            }

            // inject MM patches on-the-fly, so that profile/features can be queried with NEEDS[]
            Inject(root, "Profile", Lib.UppercaseFirst(Settings.Profile));
            if (Features.Reliability)
            {
                Inject(root, "Feature", "Reliability");
            }
            if (Features.Deploy)
            {
                Inject(root, "Feature", "Deploy");
            }
            if (Features.SpaceWeather)
            {
                Inject(root, "Feature", "SpaceWeather");
            }
            if (Features.Automation)
            {
                Inject(root, "Feature", "Automation");
            }
            if (Features.Science)
            {
                Inject(root, "Feature", "Science");
            }
            if (Features.Radiation)
            {
                Inject(root, "Feature", "Radiation");
            }
            if (Features.Shielding)
            {
                Inject(root, "Feature", "Shielding");
            }
            if (Features.LivingSpace)
            {
                Inject(root, "Feature", "LivingSpace");
            }
            if (Features.Comfort)
            {
                Inject(root, "Feature", "Comfort");
            }
            if (Features.Poisoning)
            {
                Inject(root, "Feature", "Poisoning");
            }
            if (Features.Pressure)
            {
                Inject(root, "Feature", "Pressure");
            }
            if (Features.Habitat)
            {
                Inject(root, "Feature", "Habitat");
            }
            if (Features.Supplies)
            {
                Inject(root, "Feature", "Supplies");
            }

            // inject harmony patches
            Harmony harmony = new Harmony("Kerbalism");

            harmony.PatchAll(Assembly.GetExecutingAssembly());
            KerbalismSentinel.ApplyHarmonyPatches(harmony);
            var methods = harmony.GetPatchedMethods();

            // register loading callbacks
            if (HighLogic.LoadedScene == GameScenes.LOADING)
            {
                GameEvents.OnPartLoaderLoaded.Add(SaveHabitatData);
            }
        }