예제 #1
0
            public void Start()
            {
                controller = GetComponent <SceneExitController>();

                // special next scene overrides based on the current scene
                var mostRecentSceneDef = SceneCatalog.mostRecentSceneDef;

                if (mostRecentSceneDef)
                {
                    if (destinationOverrides.ContainsKey(mostRecentSceneDef.baseSceneName))
                    {
                        var possibleOverrides = RoR2Application.rng.NextElementUniform(destinationOverrides[mostRecentSceneDef.baseSceneName]);
                        var sceneOverride     = SceneCatalog.FindSceneDef(possibleOverrides);
                        if (sceneOverride)
                        {
                            controller.destinationScene = sceneOverride;
                        }
                    }
                }

                // if a teleporter has a next scene override, use it
                if (TeleporterInteraction.instance)
                {
                    var sceneExitController = TeleporterInteraction.instance.sceneExitController;
                    if (sceneExitController && !sceneExitController.useRunNextStageScene)
                    {
                        controller.useRunNextStageScene = false;
                        controller.destinationScene     = sceneExitController.destinationScene;
                    }
                }

                controller.Begin();
            }
예제 #2
0
        private void GoToNextLevel()
        {
            if (NetworkServer.active && !SceneExitController.isRunning)
            {
                SceneCollection startingScenes = initialStartingScenes;
                if (startingScenes == null || startingScenes.isEmpty)
                {
                    startingScenes = ScriptableObject.CreateInstance <SceneCollection>();
                    startingScenes.SetSceneEntries(new SceneCollection.SceneEntry[] {
                        new SceneCollection.SceneEntry {
                            sceneDef = SceneCatalog.GetSceneDefFromSceneName("blackbeach"),
                            weight   = 1,
                        },
                        new SceneCollection.SceneEntry {
                            sceneDef = SceneCatalog.GetSceneDefFromSceneName("golemplains"),
                            weight   = 1,
                        },
                    });
                }

                WeightedSelection <SceneDef> sceneDefs = new WeightedSelection <SceneDef>();
                startingScenes.AddToWeightedSelection(sceneDefs);
                run.PickNextStageScene(sceneDefs);
                SceneExitController exitController = gameObject.AddComponent <SceneExitController>();
                exitController.useRunNextStageScene = true;
                Debug.Log("Advancing to next stage...");
                exitController.Begin();
            }
        }
예제 #3
0
        private void SkipStage(SceneExitController self)
        {
            /*I actually dont know what this does
             * //self = explicitSceneExitController.GetComponent<SceneExitController>();
             #if DEBUG
             * Chat.AddMessage("Turbo Edition: " + EquipmentName + " getComponent " + self);
             #endif*/
            //CANNOT DO THIS!!!! Throws an exception on ExitStage.State newState!
            //self = new SceneExitController();

            InstanceTracker.Add(self);
#if DEBUG
            Chat.AddMessage("Turbo Edition: " + EquipmentName + " forced stage skip.");
#endif
            //The game does this so lets do too
            if (NetworkServer.active)
            {
                //SceneExitController.ExitState == SceneExitController.ExitState.Idle;
                self.SetState(SceneExitController.ExitState.Idle);
                self.Begin();
            }
            //If we are grabbing an already existing instance from the game thanks to InstanceTracker.FirstOrNull we are deleting that one
            //should be fine since we are leaving the scene though.
            InstanceTracker.Remove(self);
        }
예제 #4
0
 private static void OnSceneExit(SceneExitController sceneExitController)
 {
     if (Run.instance)
     {
         disableDrops = true;
         Logger.Info("SceneExit : Drops Disabled");
     }
 }
예제 #5
0
        //IMPORTANT
        //AAAAAAAAA
        //CURRENTLY DOESN'T WORK IN HIDDEN REALMS
        //WHILE IS UP TO CHOICE IF IT DOES OR NOT WHAT I MEAN BY THIS IS THAT IT THROWS A NULL EXCEPTION!!!!!!!!

        //We could probably do this via the game's own SceneExitController but some stages such as the Ambry doesn't have one so we'll create one.
        protected override bool ActivateEquipment(EquipmentSlot slot)
        {
            if (Stage.instance.sceneDef.isFinalStage || UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "moon")
            {
#if DEBUG
                Chat.AddMessage("Turbo Edition: " + EquipmentName + " this is a final stage, won't skip!");
#endif
                return(false);
            }
            if (!(SceneCatalog.mostRecentSceneDef.sceneType == SceneType.Stage))
            {
#if DEBUG
                Chat.AddMessage("Turbo Edition: " + EquipmentName + " current scene is not a stage, won't skip!");
#endif
                return(false);
            }
            int sceneExitCount = InstanceTracker.GetInstancesList <SceneExitController>().Count;
#if DEBUG
            TurboEdition._logger.LogWarning("sceneExitCount: " + sceneExitCount);
#endif
            if (TeleporterInteraction.instance || !SceneExitController.isRunning)
            {
                //Makes sure that theres only the game's own controller, if theres none at least it wont create more than three
                //Increased to two since Bazaar has two
                if (sceneExitCount <= 2)
                {
                    if (TeleporterInteraction.instance.chargeFraction >= 0.99 || Reflection.GetFieldValue <bool>(TeleporterInteraction.instance, "monstersCleared"))
                    {
                        SceneExitController sceneExitController = explicitSceneExitController;
                        if (!sceneExitController)
                        {
                            sceneExitController = InstanceTracker.FirstOrNull <SceneExitController>();
#if DEBUG
                            TurboEdition._logger.LogWarning("TE instanceTracker.FirstOrNull: " + sceneExitController);
#endif
                        }
                        SkipStage(sceneExitController);
                        return(true);
                    }
                }
            }
#if DEBUG
            Chat.AddMessage("Turbo Edition: " + EquipmentName + " couldn't skip stage, see log for details.");
            TurboEdition._logger.LogWarning("TE chargeFraction: " + TeleporterInteraction.instance.chargeFraction);
            TurboEdition._logger.LogWarning("TE monstersCleared: " + Reflection.GetFieldValue <bool>(TeleporterInteraction.instance, "monstersCleared"));
            TurboEdition._logger.LogWarning("TE isRunning: " + SceneExitController.isRunning);
#endif
            return(false);
        }
        private void saveStackTokens(SceneExitController exitController)
        {
            // We shouldnt try to do anything if we arent the host
            if (!NetworkServer.active)
            {
                return;
            }
            ReadOnlyCollection <PlayerCharacterMasterController> players = PlayerCharacterMasterController.instances;

            for (int i = 0; i < players.Count; i++)
            {
                if (players[i].master.hasBody)
                {
                    CharacterBody body = players[i].master.GetBody();
                    stackCount[i] = (int)(body.GetBuffCount(RoR2Content.Buffs.BanditSkull) * multiplier);
                }
            }
        }
예제 #7
0
 private void On_SECBegin(On.RoR2.SceneExitController.orig_Begin orig, SceneExitController self)
 {
     orig(self);
     if (!NetworkServer.active)
     {
         return;
     }
     foreach (NetworkUser networkUser in NetworkUser.readOnlyInstancesList)
     {
         if (networkUser.master.hasBody)
         {
             var cpt = networkUser.master.GetBody().GetComponent <LifeSavingsComponent>();
             if (cpt)
             {
                 cpt.holdIt = true;
             }
         }
     }
 }
        private static void SplitExitMoney(On.RoR2.SceneExitController.orig_Begin orig, SceneExitController self)
        {
            MapTransitionActive = true;
            if (!ShareSuite.MoneyIsShared.Value)
            {
                orig(self);
                return;
            }

            var players = PlayerCharacterMasterController.instances.Count;

            foreach (var player in PlayerCharacterMasterController.instances)
            {
                player.master.money = (uint)
                                      // ReSharper disable once PossibleLossOfFraction
                                      Mathf.FloorToInt(player.master.money / players);
            }

            orig(self);
        }
예제 #9
0
        public override void OnLoad()
        {
            base.OnLoad();
            equipmentDef.name = "MysticsItems_GateChalice";
            ConfigManager.Balance.CreateEquipmentCooldownOption(equipmentDef, "Equipment: Gate Chalice", 60f);
            equipmentDef.canDrop = true;
            ConfigManager.Balance.CreateEquipmentEnigmaCompatibleOption(equipmentDef, "Equipment: Gate Chalice", false);
            ConfigManager.Balance.CreateEquipmentCanBeRandomlyTriggeredOption(equipmentDef, "Equipment: Gate Chalice", false);
            equipmentDef.isLunar           = true;
            equipmentDef.colorIndex        = ColorCatalog.ColorIndex.LunarItem;
            equipmentDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Gate Chalice/Model.prefab"));
            equipmentDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/Gate Chalice/Icon.png");

            Material mat = equipmentDef.pickupModelPrefab.transform.Find("mdlGateChalice").gameObject.GetComponent <MeshRenderer>().sharedMaterial;

            HopooShaderToMaterial.Standard.Apply(mat);
            HopooShaderToMaterial.Standard.Gloss(mat, 0.5f);
            HopooShaderToMaterial.Standard.Emission(mat, 0.02f, new Color(48f / 255f, 127f / 255f, 255f / 255f));
            foreach (Transform lightTransform in equipmentDef.pickupModelPrefab.transform.Find("mdlGateChalice").Find("Lights"))
            {
                SetScalableChildEffect(equipmentDef.pickupModelPrefab, lightTransform.gameObject);
                FlickerLight flickerLight = lightTransform.gameObject.AddComponent <FlickerLight>();
                flickerLight.light    = lightTransform.gameObject.GetComponent <Light>();
                flickerLight.sinWaves = new Wave[] {
                    new Wave {
                        amplitude = 0.3f,
                        frequency = 4f
                    },
                    new Wave {
                        amplitude = 0.6f,
                        frequency = 2f
                    },
                    new Wave {
                        amplitude = 0.9f,
                        frequency = 1f
                    }
                };
            }
            itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(equipmentDef.pickupModelPrefab, equipmentDef.pickupModelPrefab.name + "Display", false));
            onSetupIDRS      += () =>
            {
                AddDisplayRule("CommandoBody", "Stomach", new Vector3(-0.09F, 0.1F, -0.102F), new Vector3(5.862F, 140.357F, 1.915F), new Vector3(0.059F, 0.059F, 0.059F));
                AddDisplayRule("HuntressBody", "Pelvis", new Vector3(-0.082F, -0.111F, 0.085F), new Vector3(0.679F, 36.762F, 188.148F), new Vector3(0.047F, 0.047F, 0.048F));
                AddDisplayRule("Bandit2Body", "Stomach", new Vector3(-0.096F, 0.027F, -0.151F), new Vector3(337.162F, 337.663F, 11.532F), new Vector3(0.04F, 0.04F, 0.04F));
                AddDisplayRule("ToolbotBody", "Hip", new Vector3(-1.239F, 0.577F, -1.044F), new Vector3(0F, 180F, 180F), new Vector3(0.349F, 0.349F, 0.349F));
                AddDisplayRule("EngiBody", "Pelvis", new Vector3(-0.178F, 0.078F, 0.157F), new Vector3(11.745F, 186.295F, 185.936F), new Vector3(0.047F, 0.047F, 0.047F));
                AddDisplayRule("MageBody", "Pelvis", new Vector3(-0.128F, -0.131F, 0.024F), new Vector3(6.286F, 3.408F, 167.572F), new Vector3(0.044F, 0.044F, 0.044F));
                AddDisplayRule("MercBody", "Chest", new Vector3(0F, 0.193F, -0.286F), new Vector3(71.925F, 180F, 0F), new Vector3(0.027F, 0.027F, 0.027F));
                AddDisplayRule("TreebotBody", "FlowerBase", new Vector3(-0.485F, 0.701F, -0.803F), new Vector3(26.173F, 24.306F, 86.838F), new Vector3(0.061F, 0.061F, 0.061F));
                AddDisplayRule("LoaderBody", "Pelvis", new Vector3(-0.216F, -0.016F, -0.022F), new Vector3(342.363F, 183.205F, 159.555F), new Vector3(0.045F, 0.045F, 0.045F));
                AddDisplayRule("CrocoBody", "SpineStomach1", new Vector3(0.845F, 0.495F, 1.289F), new Vector3(74.633F, 327.618F, 247.859F), new Vector3(0.361F, 0.361F, 0.361F));
                AddDisplayRule("CaptainBody", "Stomach", new Vector3(-0.195F, 0.128F, 0.126F), new Vector3(336.504F, 156.734F, 358.159F), new Vector3(0.041F, 0.041F, 0.041F));
                AddDisplayRule("ScavBody", "MuzzleEnergyCannon", new Vector3(0F, 0F, -1.503F), new Vector3(90F, 0F, 0F), new Vector3(2.281F, 2.281F, 2.281F));
                AddDisplayRule("EquipmentDroneBody", "GunBarrelBase", new Vector3(0F, 0F, 1.069F), new Vector3(0F, 0F, 0F), new Vector3(0.267F, 0.267F, 0.267F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "Pelvis", new Vector3(0.19432F, 0.18834F, -0.17385F), new Vector3(343.5044F, 339.549F, 357.2065F), new Vector3(0.05181F, 0.05181F, 0.05181F));
                }
                AddDisplayRule("RailgunnerBody", "Pelvis", new Vector3(0.14878F, -0.03065F, 0.10522F), new Vector3(354.5591F, 180F, 180F), new Vector3(0.05639F, 0.05639F, 0.05639F));
                AddDisplayRule("VoidSurvivorBody", "Hand", new Vector3(-0.03581F, 0.28639F, -0.00539F), new Vector3(0F, 0F, 4.98446F), new Vector3(0.09781F, 0.09781F, 0.09781F));
            };

            visualEffectOnUse = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_GateChaliceOnUseEffect", false);
            EffectComponent effectComponent = visualEffectOnUse.AddComponent <EffectComponent>();

            effectComponent.soundName = "Play_env_teleporter_active_button";
            effectComponent.positionAtReferencedTransform = true;
            effectComponent.applyScale      = true;
            effectComponent.disregardZScale = true;
            VFXAttributes vfxAttributes = visualEffectOnUse.AddComponent <VFXAttributes>();

            vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Low;
            vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Low;
            visualEffectOnUse.AddComponent <DestroyOnTimer>().duration = 2f;

            GameObject     massSparks     = PrefabAPI.InstantiateClone(new GameObject(), "MassSparks", false);
            ParticleSystem particleSystem = massSparks.AddComponent <ParticleSystem>();

            massSparks.GetComponent <ParticleSystemRenderer>().material = Object.Instantiate(LegacyResourcesAPI.Load <GameObject>("Prefabs/Effects/ActivateRadarTowerEffect").transform.Find("MassSparks").gameObject.GetComponent <ParticleSystemRenderer>().material);
            particleSystem.useAutoRandomSeed = true;
            ParticleSystem.MainModule mainModule = particleSystem.main;
            mainModule.simulationSpace = ParticleSystemSimulationSpace.World;
            mainModule.scalingMode     = ParticleSystemScalingMode.Local;
            mainModule.startLifetime   = 5f;
            mainModule.duration        = 1f;
            mainModule.playOnAwake     = true;
            ParticleSystem.MinMaxCurve particleSpeed = mainModule.startSpeed;
            particleSpeed.mode         = ParticleSystemCurveMode.TwoConstants;
            particleSpeed.constantMin  = 10f;
            particleSpeed.constantMax  = 1000f;
            mainModule.startSize       = 0.1f;
            mainModule.startColor      = new Color(48f / 255f, 127f / 255f, 255f / 255f);
            mainModule.gravityModifier = 0.3f;
            mainModule.maxParticles    = 20;
            ParticleSystem.EmissionModule emissionModule = particleSystem.emission;
            emissionModule.enabled          = true;
            emissionModule.rateOverTime     = 10;
            emissionModule.rateOverDistance = 0;
            emissionModule.SetBursts(new ParticleSystem.Burst[]
            {
                new ParticleSystem.Burst
                {
                    time           = 0f,
                    count          = 20f,
                    cycleCount     = 1,
                    repeatInterval = 0.01f,
                    probability    = 1f
                }
            });
            ParticleSystem.ShapeModule shapeModule = particleSystem.shape;
            shapeModule.shapeType = ParticleSystemShapeType.Sphere;
            massSparks.transform.SetParent(visualEffectOnUse.transform);

            MysticsItemsContent.Resources.effectPrefabs.Add(visualEffectOnUse);

            visualEffectTeleportOut    = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_GateChaliceTeleportOutEffect", false);
            effectComponent            = visualEffectTeleportOut.AddComponent <EffectComponent>();
            vfxAttributes              = visualEffectTeleportOut.AddComponent <VFXAttributes>();
            vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Always;
            vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Medium;
            visualEffectTeleportOut.AddComponent <DestroyOnTimer>().duration = 4f;

            GameObject ppHolder = PrefabAPI.InstantiateClone(new GameObject(), "PP", false);

            ppHolder.layer = LayerIndex.postProcess.intVal;
            ppHolder.AddComponent <MysticsItemsGateChalicePPController>().time = 3f;
            PostProcessVolume pp = ppHolder.AddComponent <PostProcessVolume>();

            pp.isGlobal = true;
            pp.weight   = 0f;
            pp.priority = 50;
            PostProcessProfile ppProfile = ScriptableObject.CreateInstance <PostProcessProfile>();

            ppProfile.name = "ppGateChalice";
            LensDistortion lensDistortion = ppProfile.AddSettings <LensDistortion>();

            lensDistortion.SetAllOverridesTo(true);
            lensDistortion.intensity.value = -100f;
            lensDistortion.scale.value     = 1f;
            ColorGrading colorGrading = ppProfile.AddSettings <ColorGrading>();

            colorGrading.colorFilter.value         = new Color(97f / 255f, 163f / 255f, 239f / 255f);
            colorGrading.colorFilter.overrideState = true;
            pp.sharedProfile = ppProfile;
            ppHolder.transform.SetParent(visualEffectTeleportOut.transform);

            MysticsItemsContent.Resources.effectPrefabs.Add(visualEffectTeleportOut);

            SceneExitController sceneExitController = sceneExitControllerObject.AddComponent <SceneExitController>();

            sceneExitController.useRunNextStageScene = true;
            sceneExitControllerObject.AddComponent <MysticsItemsGateChaliceSceneExit>();

            itemDestroyEffectPrefab = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_GateChaliceItemDestroyEffect", false);
            EntityStateMachine entityStateMachine = itemDestroyEffectPrefab.AddComponent <EntityStateMachine>();

            entityStateMachine.initialStateType = entityStateMachine.mainStateType = new EntityStates.SerializableEntityStateType(typeof(MysticsItemsGateChaliceItemDestroyEffect));
            PickupDisplay pickupDisplay = itemDestroyEffectPrefab.AddComponent <PickupDisplay>();
            Rigidbody     rigidbody     = itemDestroyEffectPrefab.AddComponent <Rigidbody>();

            rigidbody.useGravity       = false;
            rigidbody.drag             = 2f;
            effectComponent            = itemDestroyEffectPrefab.AddComponent <EffectComponent>();
            effectComponent.applyScale = true;
            effectComponent.soundName  = "Play_moonBrother_phase4_itemSuck_returnSingle";
            vfxAttributes = itemDestroyEffectPrefab.AddComponent <VFXAttributes>();
            vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.High;
            vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Always;
            Highlight highlight = itemDestroyEffectPrefab.AddComponent <Highlight>();

            pickupDisplay.highlight  = highlight;
            highlight.highlightColor = Highlight.HighlightColor.pickup;
            MysticsItemsContent.Resources.effectPrefabs.Add(itemDestroyEffectPrefab);
        }
        private void SceneExitController_SetState(On.RoR2.SceneExitController.orig_SetState orig, SceneExitController self, SceneExitController.ExitState newState)
        {
            orig(self, newState);

            if (newState == SceneExitController.ExitState.TeleportOut)
            {
                IsAdvancingStage = true;
            }
        }
예제 #11
0
 public PortalData(SceneExitController portal)
 {
     transform            = new SerializableTransform(portal.transform);
     name                 = portal.destinationScene.baseSceneName;
     useRunNextStageScene = portal.useRunNextStageScene;
 }
예제 #12
0
 private void SceneExitController_Begin(On.RoR2.SceneExitController.orig_Begin orig, SceneExitController self)
 {
     if (NetworkServer.active)
     {
         if (self.destinationScene)
         {
             if (self.destinationScene.baseSceneName.Contains("bazaar") && !SceneInfo.instance.sceneDef.baseSceneName.Contains("bazaar"))
             {
                 bazaar.ResetBazaarPlayers();
             }
         }
     }
     orig(self);
 }
예제 #13
0
        private void SceneExitController_SetState(On.RoR2.SceneExitController.orig_SetState orig, SceneExitController self, SceneExitController.ExitState newState)
        {
            bool approved = newState != self.exitState;

            orig(self, newState);
            if (!approved)
            {
                return;
            }
            switch (self.exitState)
            {
            case SceneExitController.ExitState.Idle:
                preventMoneyDrops = false;
                break;

            case SceneExitController.ExitState.ExtractExp:
                if (preventModUseOnStageEnd)
                {
                    preventMoneyDrops = true;
                }
                if (refundOnStageEnd)
                {
                    RefundMoneyPackPickups();
                }
                break;

            default:
                if (preventModUseOnStageEnd)
                {
                    preventMoneyDrops = true;
                }
                break;
            }
        }
예제 #14
0
 private static void OnSceneExit(SceneExitController sceneExitController)
 {
     disableEarlyEliteDef = true;
 }