private void SceneDirector_Start(On.RoR2.SceneDirector.orig_Start orig, RoR2.SceneDirector director) { orig(director); if (SceneInfo.instance.sceneDef.baseSceneName != "bazaar") { //sky meadow and a couple other stages name them like this. we grab them by exact name so we don't accidentally disable an object we don't want to var newts = Resources.FindObjectsOfTypeAll <GameObject>().Where(obj => obj.name == "NewtStatue" || obj.name == "NewtStatue (1)" || obj.name == "NewtStatue (2)" || obj.name == "NewtStatue (3)" || obj.name == "NewtStatue (4)").ToList(); foreach (var newt in newts) { if (NewtAltarChance.Value >= 1 || director.rng.nextNormalizedFloat <= NewtAltarChance.Value) { CmdSetActive(newt, true); } else { CmdSetActive(newt, false); } } if (!EnableGuaranteedNewtAltars.Value) { //naming conventions??? NAHH var guaranteedNewts = Resources.FindObjectsOfTypeAll <GameObject>().Where(obj => obj.name == "NewtStatue, Guarantee" || obj.name == "NewtStatue, Guaranteed" || obj.name == "NewtStatue (Permanent)").ToList(); foreach (var newt in guaranteedNewts) { CmdSetActive(newt, false); } } } }
private void SceneDirector_onPostPopulateSceneServer(RoR2.SceneDirector obj) { if (obj.gameObject.scene.name == "foggyswamp") { UnityEngine.Object.Destroy(GameObject.Find("AltarSkeletonBody").GetComponent <AkEvent>()); } }
void PopulateScene(On.RoR2.SceneDirector.orig_PopulateScene orig, RoR2.SceneDirector sceneDirector) { if (Data.modEnabled) { sceneDirector.interactableCredit = Mathf.FloorToInt(sceneDirector.interactableCredit * Data.interactableMultiplier); List <SpawnCard> spawnCards = new List <SpawnCard>(); List <string> spawnCardNames = new List <string>(); //spawnCardNames = new List<string>() { "ShrineChance" }; //spawnCardNames = new List<string>() { "BrokenDrone1", "BrokenDrone2", "BrokenEmergencyDrone", "BrokenEquipmentDrone", "BrokenFlameDrone", "BrokenMegaDrone", "BrokenMissileDrone", "BrokenTurret1" }; //spawnCardNames = new List<string>() { "Duplicator", "DuplicatorLarge", "DuplicatorMilitary", "DuplicatorWild" }; //spawnCardNames = new List<string>() { "EquipmentBarrel", "TripleShopEquipment" }; RoR2.InteractableSpawnCard[] allInteractables = UnityEngine.Resources.LoadAll <RoR2.InteractableSpawnCard>("SpawnCards/InteractableSpawnCard"); foreach (RoR2.InteractableSpawnCard spawnCard in allInteractables) { string interactableName = ItemDropAPIFixes.InteractableCalculator.GetSpawnCardName(spawnCard); if (spawnCardNames.Contains(interactableName)) { spawnCards.Add(spawnCard); } } if (spawnCardNames.Count > 0) { DirectorCard[] directorCards = new DirectorCard[spawnCards.Count]; for (int cardIndex = 0; cardIndex < spawnCards.Count; cardIndex++) { DirectorCard directorCard = new DirectorCard(); directorCard.spawnCard = spawnCards[cardIndex]; directorCard.selectionWeight = 1; directorCards[cardIndex] = directorCard; } DirectorCardCategorySelection.Category category = new DirectorCardCategorySelection.Category(); category.name = "FORCED"; category.cards = directorCards; category.selectionWeight = 1000; DirectorCardCategorySelection.Category[] categoriesAdjusted = new DirectorCardCategorySelection.Category[ClassicStageInfo.instance.interactableCategories.categories.Length + 1]; for (int categoryIndex = 0; categoryIndex < ClassicStageInfo.instance.interactableCategories.categories.Length; categoryIndex++) { categoriesAdjusted[categoryIndex] = ClassicStageInfo.instance.interactableCategories.categories[categoryIndex]; } categoriesAdjusted[categoriesAdjusted.Length - 1] = category; ClassicStageInfo.instance.interactableCategories.categories = categoriesAdjusted; } ; foreach (int key in Data.allDroneIDs.Keys) { if (!Data.itemsToDrop.Contains(key) && !ItemDropAPIFixes.ItemDropAPIFixes.playerInteractables.interactablesInvalid.Contains(Data.allDroneIDs[key])) { ItemDropAPIFixes.ItemDropAPIFixes.playerInteractables.interactablesInvalid.Add(Data.allDroneIDs[key]); } } } orig(sceneDirector); }
// Token: 0x06001290 RID: 4752 RVA: 0x0004FBC8 File Offset: 0x0004DDC8 private void PlacePlayerSpawnsViaNodegraph() { bool usePod = Stage.instance.usePod; NodeGraph groundNodes = SceneInfo.instance.groundNodes; NodeFlags requiredFlags = NodeFlags.None; NodeFlags nodeFlags = NodeFlags.None; nodeFlags |= NodeFlags.NoCharacterSpawn; List <NodeGraph.NodeIndex> activeNodesForHullMaskWithFlagConditions = groundNodes.GetActiveNodesForHullMaskWithFlagConditions(HullMask.Golem, requiredFlags, nodeFlags); if (usePod) { int num = activeNodesForHullMaskWithFlagConditions.Count - 1; while (num >= 0 && activeNodesForHullMaskWithFlagConditions.Count > 1) { if (!SceneDirector.IsNodeSuitableForPod(groundNodes, activeNodesForHullMaskWithFlagConditions[num])) { activeNodesForHullMaskWithFlagConditions.RemoveAt(num); } num--; } } NodeGraph.NodeIndex nodeIndex; if (this.teleporterInstance) { Vector3 position = this.teleporterInstance.transform.position; List <SceneDirector.NodeDistanceSqrPair> list = new List <SceneDirector.NodeDistanceSqrPair>(); for (int i = 0; i < activeNodesForHullMaskWithFlagConditions.Count; i++) { Vector3 b2; groundNodes.GetNodePosition(activeNodesForHullMaskWithFlagConditions[i], out b2); list.Add(new SceneDirector.NodeDistanceSqrPair { nodeIndex = activeNodesForHullMaskWithFlagConditions[i], distanceSqr = (position - b2).sqrMagnitude }); } list.Sort((SceneDirector.NodeDistanceSqrPair a, SceneDirector.NodeDistanceSqrPair b) => a.distanceSqr.CompareTo(b.distanceSqr)); int index = this.rng.RangeInt(list.Count * 3 / 4, list.Count); nodeIndex = list[index].nodeIndex; } else { nodeIndex = this.rng.NextElementUniform <NodeGraph.NodeIndex>(activeNodesForHullMaskWithFlagConditions); } NodeGraphSpider nodeGraphSpider = new NodeGraphSpider(groundNodes, HullMask.Human); nodeGraphSpider.AddNodeForNextStep(nodeIndex); while (nodeGraphSpider.PerformStep()) { List <NodeGraphSpider.StepInfo> collectedSteps = nodeGraphSpider.collectedSteps; if (usePod) { for (int j = collectedSteps.Count - 1; j >= 0; j--) { if (!SceneDirector.IsNodeSuitableForPod(groundNodes, collectedSteps[j].node)) { collectedSteps.RemoveAt(j); } } } if (collectedSteps.Count >= RoR2Application.maxPlayers) { break; } } List <NodeGraphSpider.StepInfo> collectedSteps2 = nodeGraphSpider.collectedSteps; Util.ShuffleList <NodeGraphSpider.StepInfo>(collectedSteps2, Run.instance.stageRng); int num2 = Math.Min(nodeGraphSpider.collectedSteps.Count, RoR2Application.maxPlayers); for (int k = 0; k < num2; k++) { SpawnPoint.AddSpawnPoint(groundNodes, collectedSteps2[k].node, this.rng); } }
// Token: 0x060005F8 RID: 1528 RVA: 0x000189A2 File Offset: 0x00016BA2 private void OnPreGeneratePlayerSpawnPointsServer(SceneDirector sceneDirector, ref Action generationMethod) { generationMethod = new Action(this.GeneratePlayerSpawnPointsServer); }
// Token: 0x0600150E RID: 5390 RVA: 0x00064F0C File Offset: 0x0006310C private void PlacePlayerSpawnsViaNodegraph() { bool usePod = Stage.instance.usePod; NodeGraph groundNodes = SceneInfo.instance.groundNodes; List <NodeGraph.NodeIndex> activeNodesForHullMask = groundNodes.GetActiveNodesForHullMask(HullMask.Golem); if (usePod) { for (int i = activeNodesForHullMask.Count - 1; i >= 0; i--) { if (!SceneDirector.IsNodeSuitableForPod(groundNodes, activeNodesForHullMask[i])) { activeNodesForHullMask.RemoveAt(i); } } } NodeGraph.NodeIndex nodeIndex; if (this.teleporterInstance) { Vector3 position = this.teleporterInstance.transform.position; List <SceneDirector.NodeDistanceSqrPair> list = new List <SceneDirector.NodeDistanceSqrPair>(); for (int j = 0; j < activeNodesForHullMask.Count; j++) { Vector3 b2; groundNodes.GetNodePosition(activeNodesForHullMask[j], out b2); list.Add(new SceneDirector.NodeDistanceSqrPair { nodeIndex = activeNodesForHullMask[j], distanceSqr = (position - b2).sqrMagnitude }); } list.Sort((SceneDirector.NodeDistanceSqrPair a, SceneDirector.NodeDistanceSqrPair b) => a.distanceSqr.CompareTo(b.distanceSqr)); int index = this.rng.RangeInt(list.Count * 3 / 4, list.Count); nodeIndex = list[index].nodeIndex; } else { nodeIndex = activeNodesForHullMask[this.rng.RangeInt(0, activeNodesForHullMask.Count)]; } NodeGraphSpider nodeGraphSpider = new NodeGraphSpider(groundNodes, HullMask.Human); nodeGraphSpider.AddNodeForNextStep(nodeIndex); while (nodeGraphSpider.PerformStep()) { List <NodeGraphSpider.StepInfo> collectedSteps = nodeGraphSpider.collectedSteps; if (usePod) { for (int k = collectedSteps.Count - 1; k >= 0; k--) { if (!SceneDirector.IsNodeSuitableForPod(groundNodes, collectedSteps[k].node)) { collectedSteps.RemoveAt(k); } } } if (collectedSteps.Count >= RoR2Application.maxPlayers) { break; } } List <NodeGraphSpider.StepInfo> collectedSteps2 = nodeGraphSpider.collectedSteps; Util.ShuffleList <NodeGraphSpider.StepInfo>(collectedSteps2, Run.instance.stageRng); int num = Math.Min(nodeGraphSpider.collectedSteps.Count, RoR2Application.maxPlayers); for (int l = 0; l < num; l++) { NodeGraph.NodeIndex node = collectedSteps2[l].node; Vector3 vector; groundNodes.GetNodePosition(node, out vector); NodeGraph.LinkIndex[] activeNodeLinks = groundNodes.GetActiveNodeLinks(node); Quaternion rotation; if (activeNodeLinks.Length != 0) { int num2 = this.rng.RangeInt(0, activeNodeLinks.Length); NodeGraph.LinkIndex linkIndex = activeNodeLinks[num2]; Vector3 a2; groundNodes.GetNodePosition(groundNodes.GetLinkEndNode(linkIndex), out a2); rotation = Util.QuaternionSafeLookRotation(a2 - vector); } else { rotation = Quaternion.Euler(0f, this.rng.nextNormalizedFloat * 360f, 0f); } UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/SpawnPoint"), vector, rotation); } }