void StageStart(On.RoR2.Stage.orig_Start orig, RoR2.Stage stage) { orig(stage); if (Data.modEnabled) { if (Data.mode == DataShop.mode) { foreach (Coroutine coroutine in characterMasterCoroutines) { if (coroutine != null) { StopCoroutine(coroutine); } } characterMasterCoroutines.Clear(); characterBody = null; inventoryLocal = null; latestInteractionName = ""; stageClearCountOld = -1; if (NetworkClient.active) { foreach (NetworkUser networkUser in RoR2.NetworkUser.readOnlyInstancesList) { if (networkUser.isLocalPlayer) { characterMasterCoroutines.Add(StartCoroutine(GetMasterController(networkUser))); } } } } } }
/// <summary> /// Resets the chance for a family even at the beginning of ever stage, if it was previously set. /// </summary> /// <param name="orig"></param> /// <param name="self"></param> private static void Stage_Start(On.RoR2.Stage.orig_Start orig, Stage self) { orig(self); if (RoR2Cheats.FAMCHANCE == 1f) { RoR2Cheats.FAMCHANCE = 0.02f; } }
static void PVPReset(On.RoR2.Stage.orig_Start orig, Stage self) { if (NetworkServer.active) { PVPMode.Reset(); } orig(self); }
// I noticed that going between stages (especially when looping back // to stages you've been to before, you'd hear orphan deja vu instances // floating in space. This performs orphancide. private void Stage_Start(On.RoR2.Stage.orig_Start orig, Stage self) { orig(self); AkSoundEngine.PostEvent(EVERYBODY_FREEZE, null); SurvivorsToTrack.Clear(); foreach (var pcmc in PlayerCharacterMasterController.instances) { SurvivorsToTrack.Add(new SurvivorStatus(pcmc, false)); } }
private void Stage_Start(On.RoR2.Stage.orig_Start orig, Stage self) { orig(self); if (RoR2.Run.instance && NetworkUser.readOnlyInstancesList .Select(x => x.GetCurrentBody()) .Where(x => x.bodyIndex == SurvivorCatalog.GetBodyIndexFromSurvivorIndex(SurvivorIndex.Engi)) .Any()) { EngineerInGame = true; Message.SendToAll("Give yo' motherfucking fungus to the motherfucking Engineer motherfuckers", Colours.LightBlue); } else { EngineerInGame = false; Logger.LogInfo("No Engineer in party."); } }
internal static void RemoveFamilyEvent(On.RoR2.Stage.orig_Start orig, Stage self) { orig(self); IL.RoR2.ClassicStageInfo.Awake -= ForceFamilyEvent; On.RoR2.Stage.Start -= RemoveFamilyEvent; }
private void StageOnStart(On.RoR2.Stage.orig_Start orig, Stage self) { orig(self); //Destroy random junk that was left in the scene UnityEngine.Object.DestroyImmediate(GameObject.Find("EngiTurretMaster")); UnityEngine.Object.DestroyImmediate(GameObject.Find("EngiTurretMaster (1)")); UnityEngine.Object.DestroyImmediate(GameObject.Find("EngiTurretMaster (2)")); UnityEngine.Object.DestroyImmediate(GameObject.Find("EngiTurretMaster (3)")); UnityEngine.Object.DestroyImmediate(GameObject.Find("EngiTurretBody(Clone)")); UnityEngine.Object.DestroyImmediate(GameObject.Find("EngiTurretBody(Clone)")); UnityEngine.Object.DestroyImmediate(GameObject.Find("EngiTurretBody(Clone)")); UnityEngine.Object.DestroyImmediate(GameObject.Find("EngiTurretBody(Clone)")); UnityEngine.Object.DestroyImmediate(GameObject.Find("GolemBodyInvincible(Clone)")); UnityEngine.Object.DestroyImmediate(GameObject.Find("Reflection Probe")); UnityEngine.Object.DestroyImmediate(GameObject.Find("Plane")); UnityEngine.Object.DestroyImmediate(GameObject.Find("Plane (1)")); UnityEngine.Object.DestroyImmediate(GameObject.Find("Plane (2)")); UnityEngine.Object.DestroyImmediate(GameObject.Find("Plane (3)")); UnityEngine.Object.DestroyImmediate(GameObject.Find("Teleporter1(Clone)")); //Disable combat directors (enemy spawning is going to be different here) var director = GameObject.Find("Director"); foreach (var combatDirector in director.GetComponents <CombatDirector>()) { combatDirector.enabled = false; } //Load the arena var arena = Object.Instantiate(HailstormAssets.CataclysmArenaPrefab); //Make mobile platforms transport properly foreach (var meshRenderer in arena.GetComponentsInChildren <MeshRenderer>()) { var obj = meshRenderer.gameObject; if (obj.name.Contains("_P") || obj.name.Contains("P_")) { obj.AddComponent <MobilePlatform>(); if (obj.transform.childCount > 0) { var child = obj.transform.GetChild(0); child.gameObject.AddComponent <MobilePlatform>(); } } } //Configure out-of-bounds box var mapBounds = arena.transform.Find("MapBounds").gameObject; var mapZone = mapBounds.AddComponent <MapZone>(); mapZone.triggerType = MapZone.TriggerType.TriggerExit; mapZone.zoneType = MapZone.ZoneType.OutOfBounds; //Apply skybox material RenderSettings.skybox = HailstormAssets.CataclysmSkyboxMaterial; RenderSettings.ambientSkyColor = Color.white; RenderSettings.ambientGroundColor = Color.white; //Replace ground nodes with dynamically computed nodes on the central platform BuildGroundNodes(arena); //Instantiate laser chargers var folP2 = GameObject.Find("FOL_P2"); var charger1 = Object.Instantiate(HailstormAssets.LaserChargerPrefab, folP2.transform.position, Quaternion.identity); var folP4 = GameObject.Find("FOL_P4"); var charger2 = Object.Instantiate(HailstormAssets.LaserChargerPrefab, folP4.transform.position, Quaternion.identity); //Enable the boss fight mechanics BossFight = arena.AddComponent <CataclysmBossFightController>(); //Our hooks are done processing to load this stage, so revert to normal handling UnhookStageTransition(); }