예제 #1
0
        internal static void EarlyLoad()
        {
            RoR2Content = new RoR2Content();

            RoR2Content.contentPack.identifier = RoR2Content.identifier;

            RoR2Content.contentPack.bodyPrefabs.Add(Resources.LoadAll <GameObject>("Prefabs/CharacterBodies/"));
            RoR2Content.contentPack.masterPrefabs.Add(Resources.LoadAll <GameObject>("Prefabs/CharacterMasters/"));
            RoR2Content.contentPack.projectilePrefabs.Add(Resources.LoadAll <GameObject>("Prefabs/Projectiles/"));
            RoR2Content.contentPack.gameModePrefabs.Add(Resources.LoadAll <GameObject>("Prefabs/GameModes/"));
            RoR2Content.contentPack.networkedObjectPrefabs.Add(Resources.LoadAll <GameObject>("Prefabs/NetworkedObjects/"));
            RoR2Content.contentPack.skillDefs.Add(Resources.LoadAll <SkillDef>("SkillDefs/"));
            RoR2Content.contentPack.skillFamilies.Add(Resources.LoadAll <SkillFamily>("SkillDefs/"));
            RoR2Content.contentPack.unlockableDefs.Add(Resources.LoadAll <UnlockableDef>("UnlockableDefs/"));
            RoR2Content.contentPack.surfaceDefs.Add(Resources.LoadAll <SurfaceDef>("SurfaceDefs/"));
            RoR2Content.contentPack.sceneDefs.Add(Resources.LoadAll <SceneDef>("SceneDefs/"));
            RoR2Content.contentPack.networkSoundEventDefs.Add(Resources.LoadAll <NetworkSoundEventDef>("NetworkSoundEventDefs/"));
            RoR2Content.contentPack.musicTrackDefs.Add(Resources.LoadAll <MusicTrackDef>("MusicTrackDefs/"));
            RoR2Content.contentPack.gameEndingDefs.Add(Resources.LoadAll <GameEndingDef>("GameEndingDefs/"));
            RoR2Content.contentPack.itemDefs.Add(Resources.LoadAll <ItemDef>("ItemDefs/"));
            RoR2Content.contentPack.equipmentDefs.Add(Resources.LoadAll <EquipmentDef>("EquipmentDefs/"));
            RoR2Content.contentPack.buffDefs.Add(Resources.LoadAll <BuffDef>("BuffDefs/"));
            RoR2Content.contentPack.eliteDefs.Add(Resources.LoadAll <EliteDef>("EliteDefs/"));
            RoR2Content.contentPack.survivorDefs.Add(Resources.LoadAll <SurvivorDef>("SurvivorDefs/"));
            RoR2Content.contentPack.artifactDefs.Add(Resources.LoadAll <ArtifactDef>("ArtifactDefs/"));
            var effectDefs = new List <EffectDef>();

            foreach (var effect in Resources.LoadAll <GameObject>("Prefabs/Effects/"))
            {
                var effectDef = new EffectDef(effect);
                effectDefs.Add(effectDef);
            }
            RoR2Content.contentPack.effectDefs.Add(effectDefs.ToArray());
            RoR2Content.contentPack.entityStateConfigurations.Add(Resources.LoadAll <EntityStateConfiguration>("EntityStateConfigurations/"));
            RoR2Content.contentPack.entityStateTypes.Add((from type in typeof(EntityState).Assembly.GetTypes()
                                                          where typeof(EntityState).IsAssignableFrom(type)
                                                          select type).ToArray());

            ContentLoadHelper.PopulateTypeFields <ArtifactDef>(typeof(RoR2Content.Artifacts), RoR2Content.contentPack.artifactDefs);
            ContentLoadHelper.PopulateTypeFields <ItemDef>(typeof(RoR2Content.Items), RoR2Content.contentPack.itemDefs);
            ContentLoadHelper.PopulateTypeFields <EquipmentDef>(typeof(RoR2Content.Equipment), RoR2Content.contentPack.equipmentDefs);
            ContentLoadHelper.PopulateTypeFields <BuffDef>(typeof(RoR2Content.Buffs), RoR2Content.contentPack.buffDefs);
            ContentLoadHelper.PopulateTypeFields <EliteDef>(typeof(RoR2Content.Elites), RoR2Content.contentPack.eliteDefs);
            ContentLoadHelper.PopulateTypeFields <GameEndingDef>(typeof(RoR2Content.GameEndings), RoR2Content.contentPack.gameEndingDefs);
            ContentLoadHelper.PopulateTypeFields <SurvivorDef>(typeof(RoR2Content.Survivors), RoR2Content.contentPack.survivorDefs);

            RoR2Content.contentPack.effectDefs.Find("CoinEmitter").cullMethod = (EffectData effectData) => SettingsConVars.cvExpAndMoneyEffects.value;

            _ror2ContentLoaded = true;
        }
예제 #2
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();
        }
예제 #3
0
        private static System.Collections.IEnumerator LoadOnlyOnce(On.RoR2.RoR2Content.orig_LoadStaticContentAsync orig, RoR2Content self, LoadStaticContentAsyncArgs args)
        {
            if (!_ror2ContentLoaded)
            {
                yield return(orig(self, args));
            }

            yield break;
        }