コード例 #1
0
        public void Awake()
        {
            Instance = this;

            Logger = base.Logger;

            ModManager = new DetourModManager();
            AddHookLogging();

            CheckForIncompatibleAssemblies();

            if (Environment.GetEnvironmentVariable("R2API_DEBUG") == "true")
            {
                EnableDebug();
            }

            var pluginScanner    = new PluginScanner();
            var submoduleHandler = new APISubmoduleHandler(Logger);

            LoadedSubmodules = submoduleHandler.LoadRequested(pluginScanner);
            pluginScanner.ScanPlugins();

            var networkCompatibilityHandler = new NetworkCompatibilityHandler();

            networkCompatibilityHandler.BuildModList();

            On.RoR2.RoR2Application.Awake += CheckIfUsedOnRightGameVersion;

            R2APIContentPackProvider.Init();
        }
コード例 #2
0
ファイル: R2API.cs プロジェクト: Reinms/R2API
        public R2API()
        {
            Logger     = base.Logger;
            ModManager = new DetourModManager();
            AddHookLogging();
            CheckForIncompatibleAssemblies();
            CheckR2APIMonomodPatch();

            Environment.SetEnvironmentVariable("MONOMOD_DMD_TYPE", "Cecil");

            On.RoR2.UnitySystemConsoleRedirector.Redirect += orig => { };

            var pluginScanner    = new PluginScanner();
            var submoduleHandler = new APISubmoduleHandler(GameBuild, Logger);

            LoadedSubmodules = submoduleHandler.LoadRequested(pluginScanner);
            pluginScanner.ScanPlugins();

            var networkCompatibilityHandler = new NetworkCompatibilityHandler();

            networkCompatibilityHandler.BuildModList();

            RoR2Application.isModded = true;

            SteamworksClientManager.onLoaded += CheckIfUsedOnRightGameVersion;

            VanillaFixes();
        }
コード例 #3
0
ファイル: R2API.cs プロジェクト: zkitX/R2API
        public R2API()
        {
            Logger     = base.Logger;
            ModManager = new DetourModManager();
            AddHookLogging();
            CheckForIncompatibleAssemblies();
            CheckR2APIMonomodPatch();

            Environment.SetEnvironmentVariable("MONOMOD_DMD_TYPE", "Cecil");

            On.RoR2.RoR2Application.UnitySystemConsoleRedirector.Redirect += orig => { };

            var submoduleHandler = new APISubmoduleHandler(GameBuild, Logger);

            loadedSubmodules = submoduleHandler.LoadRequested();

            //Currently disabled until manifest v2
            //ModListAPI.Init();

            RoR2Application.isModded = true;

            // Temporary fix as the new quickplay button currently don't have the DisableIfGameModded Script attached to it
            On.RoR2.UI.QuickPlayButtonController.Start += (orig, self) => {
                orig(self);
                self.gameObject.SetActive(false);
            };

            On.RoR2.DisableIfGameModded.OnEnable += (orig, self) => {
                // TODO: If we can enable quick play without regrets, uncomment.
                //if (self.name == "Button, QP")
                //    return;

                self.gameObject.SetActive(false);
            };

            On.RoR2.Networking.SteamLobbyFinder.CCSteamQuickplayStart += (orig, args) => {
                Debug.Log("QuickPlay is disabled in mods due to social contracts and lack of general support");
            };

            SteamworksClientManager.onLoaded += () => {
                var buildId =
                    SteamworksClientManager.instance.GetFieldValue <Client>("steamworksClient").BuildId;

                if (GameBuild == buildId)
                {
                    return;
                }

                Logger.LogWarning($"This version of R2API was built for build id \"{GameBuild}\", you are running \"{buildId}\".");
                Logger.LogWarning("Should any problems arise, please check for a new version before reporting issues.");
            };

            // Make sure that modded dedicated servers are recognizable from the server browser
            On.RoR2.SteamworksServerManager.UpdateHostName += (orig, self, hostname) => {
                var server = ((SteamworksServerManager)self).GetFieldValue <Server>("steamworksServer");
                server.GameTags = "mod," + server.GameTags;
            };
        }
コード例 #4
0
ファイル: R2API.cs プロジェクト: IBurn36360/R2API
        public R2API()
        {
            Logger     = base.Logger;
            ModManager = new DetourModManager();
            AddHookLogging();
            CheckForIncompatibleAssemblies();
            CheckR2APIMonomodPatch();

            Environment.SetEnvironmentVariable("MONOMOD_DMD_TYPE", "Cecil");

            On.RoR2.RoR2Application.UnitySystemConsoleRedirector.Redirect += orig => { };
            var submoduleHandler = new APISubmoduleHandler(GameBuild, Logger);

            submoduleHandler.LoadRequested();

            RoR2Application.isModded = true;

            //This needs to always be enabled, regardless of module dependency, or it is useless
            ModListAPI.Init();

            On.RoR2.DisableIfGameModded.OnEnable += (orig, self) => {
                // TODO: If we can enable quick play without regrets, uncomment.
                //if (self.name == "Button, QP")
                //    return;

                self.gameObject.SetActive(false);
            };

            SteamworksClientManager.onLoaded += () => {
                var buildId =
                    SteamworksClientManager.instance.GetFieldValue <Client>("steamworksClient").BuildId;

                if (GameBuild == buildId)
                {
                    return;
                }

                Logger.LogWarning($"This version of R2API was built for build id \"{GameBuild}\", you are running \"{buildId}\".");
                Logger.LogWarning("Should any problems arise, please check for a new version before reporting issues.");
            };

            On.RoR2.SteamworksServerManager.UpdateHostName += (orig, self, hostname) => {
                orig(self, $"[MOD] {hostname}");
                var server = ((SteamworksServerManager)self).GetFieldValue <Server>("steamworksServer");
                server.GameTags = "mod," + server.GameTags;
            };
        }
コード例 #5
0
        public void Awake()
        {
            Instance = this;

            Logger     = base.Logger;
            ModManager = new DetourModManager();
            AddHookLogging();
            CheckForIncompatibleAssemblies();

            Environment.SetEnvironmentVariable("MONOMOD_DMD_TYPE", "Cecil");

            if (Environment.GetEnvironmentVariable("R2API_DEBUG") == "true")
            {
                EnableDebug();
            }

            On.RoR2.UnitySystemConsoleRedirector.Redirect += orig => { };

            LoadRoR2ContentEarly.Init();

            var pluginScanner    = new PluginScanner();
            var submoduleHandler = new APISubmoduleHandler(GameBuild, Logger);

            LoadedSubmodules = submoduleHandler.LoadRequested(pluginScanner);
            pluginScanner.ScanPlugins();

            var networkCompatibilityHandler = new NetworkCompatibilityHandler();

            networkCompatibilityHandler.BuildModList();

            RoR2Application.isModded = true;

            SteamworksClientManager.onLoaded += CheckIfUsedOnRightGameVersion;

            VanillaFixes();

            R2APIContentPackProvider.Init();
        }
コード例 #6
0
ファイル: R2API.cs プロジェクト: macauleym/R2API
        public void Awake()
        {
            Logger     = base.Logger;
            ModManager = new DetourModManager();
            AddHookLogging();
            CheckForIncompatibleAssemblies();
            CheckR2APIPatch();

            Environment.SetEnvironmentVariable("MONOMOD_DMD_TYPE", "Cecil");

            On.RoR2.UnitySystemConsoleRedirector.Redirect += orig => { };

            var pluginScanner    = new PluginScanner();
            var submoduleHandler = new APISubmoduleHandler(GameBuild, Logger);

            LoadedSubmodules = submoduleHandler.LoadRequested(pluginScanner);
            pluginScanner.ScanPlugins();

            var networkCompatibilityHandler = new NetworkCompatibilityHandler();

            networkCompatibilityHandler.BuildModList();

            RoR2Application.isModded = true;

            SteamworksClientManager.onLoaded += CheckIfUsedOnRightGameVersion;

            VanillaFixes();

            // Load RoR2Content early so that modders
            // can take prefabs refs from the fields directly.
            RoR2Content = new RoR2Content();

            // We dont want the game code to remake the RoR2Content instance again
            IL.RoR2.RoR2Application.OnLoad += TakeOurInstanceInstead;

            R2APIContentPackProvider.Init();
        }
コード例 #7
0
ファイル: R2API.cs プロジェクト: MagnusMagnuson/R2API
        public R2API()
        {
            Logger     = base.Logger;
            ModManager = new DetourModManager();
            AddHookLogging();

            CheckForIncompatibleAssemblies();

            Environment.SetEnvironmentVariable("MONOMOD_DMD_TYPE", "Cecil");

            On.RoR2.RoR2Application.UnitySystemConsoleRedirector.Redirect += orig => { };
            var submoduleHandler = new APISubmoduleHandler(GameBuild, Logger);

            submoduleHandler.LoadAll(GetType().Assembly);

            RoR2Application.isModded = true;

            On.RoR2.DisableIfGameModded.OnEnable += (orig, self) => {
                // TODO: If we can enable quick play without regrets, uncomment.
                //if (self.name == "Button, QP")
                //    return;

                self.gameObject.SetActive(false);
            };

            On.RoR2.RoR2Application.OnLoad += (orig, self) => {
                orig(self);

                if (GameBuild == self.steamworksClient.BuildId)
                {
                    return;
                }

                Logger.LogWarning($"This version of R2API was built for build id \"{GameBuild}\", you are running \"{self.steamworksClient.BuildId}\".");
                Logger.LogWarning("Should any problems arise, please check for a new version before reporting issues.");
            };
        }