public static void AssignRoomToFloorRoomTable(PrototypeDungeonRoom Room, GlobalDungeonData.ValidTilesets targetTileSet, float?Weight) { if (targetTileSet == GlobalDungeonData.ValidTilesets.CASTLEGEON) { ExpandPrefabs.CastleRoomTable.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(Room, Weight.Value)); } else if (targetTileSet == GlobalDungeonData.ValidTilesets.SEWERGEON) { ExpandPrefabs.SewersRoomTable.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(Room, Weight.Value)); } else if (targetTileSet == GlobalDungeonData.ValidTilesets.GUNGEON) { ExpandPrefabs.Gungeon_RoomTable.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(Room, Weight.Value)); } else if (targetTileSet == GlobalDungeonData.ValidTilesets.CATHEDRALGEON) { ExpandPrefabs.AbbeyRoomTable.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(Room, Weight.Value)); } else if (targetTileSet == GlobalDungeonData.ValidTilesets.MINEGEON) { ExpandPrefabs.MinesRoomTable.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(Room, Weight.Value)); } else if (targetTileSet == GlobalDungeonData.ValidTilesets.CATACOMBGEON) { ExpandPrefabs.CatacombsRoomTable.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(Room, Weight.Value)); } else if (targetTileSet == GlobalDungeonData.ValidTilesets.OFFICEGEON) { // R&G floor doesn't use room tables yet. If a room has this set, I'll assign to all floors instead. return; } else if (targetTileSet == GlobalDungeonData.ValidTilesets.FORGEGEON) { ExpandPrefabs.ForgeRoomTable.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(Room, Weight.Value)); } else if (targetTileSet == GlobalDungeonData.ValidTilesets.HELLGEON) { ExpandPrefabs.BulletHellRoomTable.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(Room, Weight.Value)); } return; }
// Initialize KnownFlows array with custom + official flows. public static void InitDungeonFlows(AssetBundle sharedAssets2, bool refreshFlows = false) { Dungeon TutorialPrefab = DungeonDatabase.GetOrLoadByName("Base_Tutorial"); Dungeon CastlePrefab = DungeonDatabase.GetOrLoadByName("Base_Castle"); Dungeon SewerPrefab = DungeonDatabase.GetOrLoadByName("Base_Sewer"); Dungeon GungeonPrefab = DungeonDatabase.GetOrLoadByName("Base_Gungeon"); Dungeon CathedralPrefab = DungeonDatabase.GetOrLoadByName("Base_Cathedral"); Dungeon MinesPrefab = DungeonDatabase.GetOrLoadByName("Base_Mines"); Dungeon ResourcefulRatPrefab = DungeonDatabase.GetOrLoadByName("Base_ResourcefulRat"); Dungeon CatacombsPrefab = DungeonDatabase.GetOrLoadByName("Base_Catacombs"); Dungeon NakatomiPrefab = DungeonDatabase.GetOrLoadByName("Base_Nakatomi"); Dungeon ForgePrefab = DungeonDatabase.GetOrLoadByName("Base_Forge"); Dungeon BulletHellPrefab = DungeonDatabase.GetOrLoadByName("Base_BulletHell"); BaseSharedInjectionData = sharedAssets2.LoadAsset <SharedInjectionData>("Base Shared Injection Data"); GungeonInjectionData = GungeonPrefab.PatternSettings.flows[0].sharedInjectionData[1]; SewersInjectionData = SewerPrefab.PatternSettings.flows[0].sharedInjectionData[1]; HollowsInjectionData = CatacombsPrefab.PatternSettings.flows[0].sharedInjectionData[1]; CastleInjectionData = CastlePrefab.PatternSettings.flows[0].sharedInjectionData[0]; JunkSecretRoomInjector = new ProceduralFlowModifierData() { annotation = "Tiny Secret Room", DEBUG_FORCE_SPAWN = false, OncePerRun = false, placementRules = new List <ProceduralFlowModifierData.FlowModifierPlacementType>() { ProceduralFlowModifierData.FlowModifierPlacementType.RANDOM_NODE_CHILD }, roomTable = null, exactRoom = ExpandRoomPrefabs.Expand_TinySecret, IsWarpWing = false, RequiresMasteryToken = false, chanceToLock = 0, selectionWeight = 1, chanceToSpawn = 1, RequiredValidPlaceable = null, prerequisites = new DungeonPrerequisite[0], CanBeForcedSecret = true, RandomNodeChildMinDistanceFromEntrance = 0, exactSecondaryRoom = null, framedCombatNodes = 0, }; BellySpecialEntranceRoomInjector = new ProceduralFlowModifierData() { annotation = "Secret Belly Entrance Room", DEBUG_FORCE_SPAWN = false, OncePerRun = false, placementRules = new List <ProceduralFlowModifierData.FlowModifierPlacementType>() { ProceduralFlowModifierData.FlowModifierPlacementType.END_OF_CHAIN }, roomTable = null, exactRoom = ExpandRoomPrefabs.Expand_Gungeon_BellyEntranceRoom, IsWarpWing = false, RequiresMasteryToken = false, chanceToLock = 0, selectionWeight = 1, chanceToSpawn = 1, RequiredValidPlaceable = null, prerequisites = new DungeonPrerequisite[] { new DungeonPrerequisite() { prerequisiteOperation = DungeonPrerequisite.PrerequisiteOperation.EQUAL_TO, prerequisiteType = DungeonPrerequisite.PrerequisiteType.TILESET, requiredTileset = GlobalDungeonData.ValidTilesets.GUNGEON, requireTileset = true, comparisonValue = 1, encounteredObjectGuid = string.Empty, maxToCheck = TrackedMaximums.MOST_KEYS_HELD, requireDemoMode = false, requireCharacter = false, requiredCharacter = PlayableCharacters.Pilot, requireFlag = false, useSessionStatValue = false, encounteredRoom = null, requiredNumberOfEncounters = -1, saveFlagToCheck = GungeonFlags.TUTORIAL_COMPLETED, statToCheck = TrackedStats.GUNBERS_MUNCHED } }, CanBeForcedSecret = true, RandomNodeChildMinDistanceFromEntrance = 0, exactSecondaryRoom = null, framedCombatNodes = 0, }; BellySpecialMonsterRoomInjector = new ProceduralFlowModifierData() { annotation = "Secret Belly Monster Room", DEBUG_FORCE_SPAWN = false, OncePerRun = false, placementRules = new List <ProceduralFlowModifierData.FlowModifierPlacementType>() { ProceduralFlowModifierData.FlowModifierPlacementType.NO_LINKS }, roomTable = null, exactRoom = ExpandRoomPrefabs.Expand_Gungeon_HiddenMonsterRoom, IsWarpWing = true, RequiresMasteryToken = false, chanceToLock = 0, selectionWeight = 1, chanceToSpawn = 1, RequiredValidPlaceable = null, prerequisites = new DungeonPrerequisite[] { new DungeonPrerequisite() { prerequisiteOperation = DungeonPrerequisite.PrerequisiteOperation.EQUAL_TO, prerequisiteType = DungeonPrerequisite.PrerequisiteType.TILESET, requiredTileset = GlobalDungeonData.ValidTilesets.GUNGEON, requireTileset = true, comparisonValue = 1, encounteredObjectGuid = string.Empty, maxToCheck = TrackedMaximums.MOST_KEYS_HELD, requireDemoMode = false, requireCharacter = false, requiredCharacter = PlayableCharacters.Pilot, requireFlag = false, useSessionStatValue = false, encounteredRoom = null, requiredNumberOfEncounters = -1, saveFlagToCheck = GungeonFlags.TUTORIAL_COMPLETED, statToCheck = TrackedStats.GUNBERS_MUNCHED } }, CanBeForcedSecret = true, RandomNodeChildMinDistanceFromEntrance = 0, exactSecondaryRoom = null, framedCombatNodes = 0, }; GungeonInjectionData.InjectionData.Add(BellySpecialEntranceRoomInjector); GungeonInjectionData.InjectionData.Add(BellySpecialMonsterRoomInjector); SewersInjectionData.InjectionData.Add(JunkSecretRoomInjector); SecretFloorEntranceInjector = new ProceduralFlowModifierData() { annotation = "Secret Floor Entrance Room", DEBUG_FORCE_SPAWN = false, OncePerRun = false, placementRules = new List <ProceduralFlowModifierData.FlowModifierPlacementType>() { ProceduralFlowModifierData.FlowModifierPlacementType.NO_LINKS }, roomTable = null, // exactRoom = SewersInjectionData.InjectionData[0].exactRoom, exactRoom = ExpandRoomPrefabs.SecretExitRoom2, IsWarpWing = true, RequiresMasteryToken = false, chanceToLock = 0, selectionWeight = 1, chanceToSpawn = 1, RequiredValidPlaceable = null, prerequisites = new DungeonPrerequisite[0], CanBeForcedSecret = true, RandomNodeChildMinDistanceFromEntrance = 0, exactSecondaryRoom = null, framedCombatNodes = 0, }; SecretMiniElevatorInjector = new ProceduralFlowModifierData() { annotation = "Secret MiniElevator Room with Glitched Rats", DEBUG_FORCE_SPAWN = false, OncePerRun = false, placementRules = new List <ProceduralFlowModifierData.FlowModifierPlacementType>() { ProceduralFlowModifierData.FlowModifierPlacementType.RANDOM_NODE_CHILD }, roomTable = null, exactRoom = ExpandRoomPrefabs.SecretRatEntranceRoom, IsWarpWing = false, RequiresMasteryToken = false, chanceToLock = 0.25f, selectionWeight = 1, chanceToSpawn = 1, RequiredValidPlaceable = null, prerequisites = new DungeonPrerequisite[0], CanBeForcedSecret = true, RandomNodeChildMinDistanceFromEntrance = 0, exactSecondaryRoom = null, framedCombatNodes = 0, }; m_KeepJungleEntranceRooms = ScriptableObject.CreateInstance <GenericRoomTable>(); m_KeepJungleEntranceRooms.includedRoomTables = new List <GenericRoomTable>(0); m_KeepJungleEntranceRooms.includedRooms = new WeightedRoomCollection() { elements = new List <WeightedRoom>() { ExpandRoomPrefabs.GenerateWeightedRoom(ExpandRoomPrefabs.Expand_Keep_TreeRoom, Weight: 0.5f), ExpandRoomPrefabs.GenerateWeightedRoom(ExpandRoomPrefabs.Expand_Keep_TreeRoom2) } }; SecretJungleEntranceInjector = new ProceduralFlowModifierData() { annotation = "Secret Jungle Entrance Room", DEBUG_FORCE_SPAWN = false, OncePerRun = false, placementRules = new List <ProceduralFlowModifierData.FlowModifierPlacementType>() { ProceduralFlowModifierData.FlowModifierPlacementType.RANDOM_NODE_CHILD }, roomTable = m_KeepJungleEntranceRooms, exactRoom = null, IsWarpWing = false, RequiresMasteryToken = false, chanceToLock = 0, selectionWeight = 1, chanceToSpawn = 1, RequiredValidPlaceable = null, prerequisites = new DungeonPrerequisite[] { new DungeonPrerequisite() { prerequisiteOperation = DungeonPrerequisite.PrerequisiteOperation.EQUAL_TO, prerequisiteType = DungeonPrerequisite.PrerequisiteType.TILESET, requiredTileset = GlobalDungeonData.ValidTilesets.CASTLEGEON, requireTileset = true, comparisonValue = 1, encounteredObjectGuid = string.Empty, maxToCheck = TrackedMaximums.MOST_KEYS_HELD, requireDemoMode = false, requireCharacter = false, requiredCharacter = PlayableCharacters.Pilot, requireFlag = false, useSessionStatValue = false, encounteredRoom = null, requiredNumberOfEncounters = -1, saveFlagToCheck = GungeonFlags.TUTORIAL_COMPLETED, statToCheck = TrackedStats.GUNBERS_MUNCHED } }, CanBeForcedSecret = true, RandomNodeChildMinDistanceFromEntrance = 0, exactSecondaryRoom = null, framedCombatNodes = 0, }; HollowsInjectionData.InjectionData.Add(SecretFloorEntranceInjector); HollowsInjectionData.InjectionData.Add(SecretMiniElevatorInjector); CastleInjectionData.InjectionData.Add(SecretJungleEntranceInjector); RickRollSecretRoomInjector = new ProceduralFlowModifierData() { annotation = "RickRoll Secret Room", DEBUG_FORCE_SPAWN = false, OncePerRun = false, placementRules = new List <ProceduralFlowModifierData.FlowModifierPlacementType>() { ProceduralFlowModifierData.FlowModifierPlacementType.END_OF_CHAIN }, roomTable = null, exactRoom = ExpandRoomPrefabs.Expand_RickRollSecret, IsWarpWing = false, RequiresMasteryToken = false, chanceToLock = 0, selectionWeight = 1, chanceToSpawn = 0.25f, RequiredValidPlaceable = null, prerequisites = new DungeonPrerequisite[0], CanBeForcedSecret = true, RandomNodeChildMinDistanceFromEntrance = 1, exactSecondaryRoom = null, framedCombatNodes = 0 }; CustomSecretFloorSharedInjectionData = ScriptableObject.CreateInstance <SharedInjectionData>(); CustomSecretFloorSharedInjectionData.name = "Rick Roll Secret Room Injection Data"; CustomSecretFloorSharedInjectionData.InjectionData = new List <ProceduralFlowModifierData>() { RickRollSecretRoomInjector }; CustomSecretFloorSharedInjectionData.UseInvalidWeightAsNoInjection = true; CustomSecretFloorSharedInjectionData.IsNPCCell = false; CustomSecretFloorSharedInjectionData.PreventInjectionOfFailedPrerequisites = false; CustomSecretFloorSharedInjectionData.OnlyOne = false; CustomSecretFloorSharedInjectionData.ChanceToSpawnOne = 1; CustomSecretFloorSharedInjectionData.AttachedInjectionData = new List <SharedInjectionData>(0); // Don't build/add flows until injection data is created! Foyer_Flow = FlowHelpers.DuplicateDungeonFlow(sharedAssets2.LoadAsset <DungeonFlow>("Foyer Flow")); // List<DungeonFlow> m_knownFlows = new List<DungeonFlow>(); KnownFlows = new List <DungeonFlow>(); // Build and add custom flows to list. BossrushFlows.InitBossrushFlows(); KnownFlows.Add(custom_glitchchest_flow.Custom_GlitchChest_Flow()); KnownFlows.Add(test_west_floor_03a_flow.TEST_West_Floor_03a_Flow()); KnownFlows.Add(demo_stage_flow.DEMO_STAGE_FLOW()); KnownFlows.Add(complex_flow_test.Complex_Flow_Test()); KnownFlows.Add(custom_glitch_flow.Custom_Glitch_Flow()); KnownFlows.Add(really_big_flow.Really_Big_Flow()); KnownFlows.Add(fruit_loops.Fruit_Loops()); KnownFlows.Add(custom_glitchchestalt_flow.Custom_GlitchChestAlt_Flow()); KnownFlows.Add(test_traproom_flow.Test_TrapRoom_Flow()); KnownFlows.Add(test_customroom_flow.Test_CustomRoom_Flow()); KnownFlows.Add(apache_fucking_around_flow.Apache_Fucking_Around_Flow()); KnownFlows.Add(f1b_jungle_flow_01.F1b_Jungle_Flow_01()); KnownFlows.Add(f1b_jungle_flow_02.F1b_Jungle_Flow_02()); KnownFlows.Add(f2b_belly_flow_01.F2b_Belly_Flow_01()); KnownFlows.Add(f4c_west_flow_01.F4c_West_Flow_01()); // Fix issues with nodes so that things other then MainMenu can load Foyer flow Foyer_Flow.name = "Foyer_Flow"; Foyer_Flow.AllNodes[1].handlesOwnWarping = true; Foyer_Flow.AllNodes[2].handlesOwnWarping = true; Foyer_Flow.AllNodes[3].handlesOwnWarping = true; KnownFlows.Add(Foyer_Flow); KnownFlows.Add(FlowHelpers.DuplicateDungeonFlow(LoadOfficialFlow("npcparadise"))); KnownFlows.Add(FlowHelpers.DuplicateDungeonFlow(LoadOfficialFlow("secret_doublebeholster_flow"))); KnownFlows.Add(BossrushFlows.Bossrush_01_Castle); KnownFlows.Add(BossrushFlows.Bossrush_01a_Sewer); KnownFlows.Add(BossrushFlows.Bossrush_02_Gungeon); KnownFlows.Add(BossrushFlows.Bossrush_02a_Cathedral); KnownFlows.Add(BossrushFlows.Bossrush_03_Mines); KnownFlows.Add(BossrushFlows.Bossrush_04_Catacombs); KnownFlows.Add(BossrushFlows.Bossrush_05_Forge); KnownFlows.Add(BossrushFlows.Bossrush_06_BulletHell); KnownFlows.Add(BossrushFlows.MiniBossrush_01); // Add official flows to list (flows found in Dungeon asset bundles after AG&D) for (int i = 0; i < TutorialPrefab.PatternSettings.flows.Count; i++) { KnownFlows.Add(FlowHelpers.DuplicateDungeonFlow(TutorialPrefab.PatternSettings.flows[i])); } for (int i = 0; i < CastlePrefab.PatternSettings.flows.Count; i++) { KnownFlows.Add(FlowHelpers.DuplicateDungeonFlow(CastlePrefab.PatternSettings.flows[i])); } for (int i = 0; i < SewerPrefab.PatternSettings.flows.Count; i++) { KnownFlows.Add(FlowHelpers.DuplicateDungeonFlow(SewerPrefab.PatternSettings.flows[i])); } for (int i = 0; i < GungeonPrefab.PatternSettings.flows.Count; i++) { KnownFlows.Add(FlowHelpers.DuplicateDungeonFlow(GungeonPrefab.PatternSettings.flows[i])); } for (int i = 0; i < CathedralPrefab.PatternSettings.flows.Count; i++) { KnownFlows.Add(FlowHelpers.DuplicateDungeonFlow(CathedralPrefab.PatternSettings.flows[i])); } for (int i = 0; i < MinesPrefab.PatternSettings.flows.Count; i++) { KnownFlows.Add(FlowHelpers.DuplicateDungeonFlow(MinesPrefab.PatternSettings.flows[i])); } for (int i = 0; i < ResourcefulRatPrefab.PatternSettings.flows.Count; i++) { KnownFlows.Add(FlowHelpers.DuplicateDungeonFlow(ResourcefulRatPrefab.PatternSettings.flows[i])); } for (int i = 0; i < CatacombsPrefab.PatternSettings.flows.Count; i++) { KnownFlows.Add(FlowHelpers.DuplicateDungeonFlow(CatacombsPrefab.PatternSettings.flows[i])); } for (int i = 0; i < NakatomiPrefab.PatternSettings.flows.Count; i++) { KnownFlows.Add(FlowHelpers.DuplicateDungeonFlow(NakatomiPrefab.PatternSettings.flows[i])); } for (int i = 0; i < ForgePrefab.PatternSettings.flows.Count; i++) { KnownFlows.Add(FlowHelpers.DuplicateDungeonFlow(ForgePrefab.PatternSettings.flows[i])); } for (int i = 0; i < BulletHellPrefab.PatternSettings.flows.Count; i++) { KnownFlows.Add(FlowHelpers.DuplicateDungeonFlow(BulletHellPrefab.PatternSettings.flows[i])); } // Let's make things look cool and give all boss rush flows my new tiny exit room. :D BossrushFlows.Bossrush_01a_Sewer.AllNodes[2].overrideExactRoom = ExpandPrefabs.tiny_exit; BossrushFlows.Bossrush_02_Gungeon.AllNodes[6].overrideExactRoom = ExpandPrefabs.tiny_exit; BossrushFlows.Bossrush_02a_Cathedral.AllNodes[2].overrideExactRoom = ExpandPrefabs.oldbulletking_room_01; BossrushFlows.Bossrush_02a_Cathedral.AllNodes[3].overrideExactRoom = ExpandPrefabs.tiny_exit; BossrushFlows.Bossrush_03_Mines.AllNodes[6].overrideExactRoom = ExpandPrefabs.tiny_exit; BossrushFlows.Bossrush_04_Catacombs.AllNodes[6].overrideExactRoom = ExpandPrefabs.tiny_exit; // Fix Forge Bossrush so it uses the correct boss foyer room for Dragun. // Using the same foyer room for previous floors looks odd so I fixed it. :P BossrushFlows.Bossrush_05_Forge.AllNodes[1].overrideExactRoom = ExpandPrefabs.DragunBossFoyerRoom; BossrushFlows.Bossrush_05_Forge.AllNodes[3].overrideExactRoom = ExpandPrefabs.tiny_exit; TutorialPrefab = null; CastlePrefab = null; SewerPrefab = null; GungeonPrefab = null; CathedralPrefab = null; MinesPrefab = null; ResourcefulRatPrefab = null; CatacombsPrefab = null; NakatomiPrefab = null; ForgePrefab = null; BulletHellPrefab = null; }
public override void Start() { if (!string.IsNullOrEmpty(ExceptionText) | !string.IsNullOrEmpty(ExceptionText2)) { if (!string.IsNullOrEmpty(ExceptionText)) { ETGModConsole.Log(ExceptionText); } if (!string.IsNullOrEmpty(ExceptionText2)) { ETGModConsole.Log(ExceptionText2); } return; } ExpandSharedHooks.InstallRequiredHooks(); AssetBundle expandSharedAssets1 = ResourceManager.LoadAssetBundle(ModAssetBundleName); AssetBundle sharedAssets = ResourceManager.LoadAssetBundle("shared_auto_001"); AssetBundle sharedAssets2 = ResourceManager.LoadAssetBundle("shared_auto_002"); AssetBundle braveResources = ResourceManager.LoadAssetBundle("brave_resources_001"); AssetBundle enemiesBase = ResourceManager.LoadAssetBundle("enemies_base_001"); ExpandAssets.InitAudio(expandSharedAssets1, ModSoundBankName); ExpandObjectDatabase.BuildDatabase(); // Init Custom GameLevelDefinitions ExpandCustomDungeonPrefabs.InitCustomGameLevelDefinitions(braveResources); // Init Custom Sprite Collections ExpandPrefabs.InitSpriteCollections(expandSharedAssets1); ExpandCustomEnemyDatabase.InitSpriteCollections(expandSharedAssets1); // Init ItemAPI SetupItemAPI(expandSharedAssets1); try { // Init Prefab Databases ExpandPrefabs.InitCustomPrefabs(expandSharedAssets1, sharedAssets, sharedAssets2, braveResources, enemiesBase); // Init Custom Enemy Prefabs ExpandCustomEnemyDatabase.InitPrefabs(expandSharedAssets1); // Init Custom Room Prefabs ExpandRoomPrefabs.InitCustomRooms(expandSharedAssets1, sharedAssets, sharedAssets2, braveResources, enemiesBase); // Init Custom DungeonFlow(s) ExpandDungeonFlow.InitDungeonFlows(sharedAssets2); // Post Init // Things that need existing stuff created first have code run here BootlegGuns.PostInit(); // Dungeon Prefabs ExpandCustomDungeonPrefabs.InitDungoenPrefabs(expandSharedAssets1, sharedAssets, sharedAssets2, braveResources); ExpandLists.InvalidRatFloorRainRooms = new List <string>() { ExpandRoomPrefabs.SecretBossRoom.name, ExpandRoomPrefabs.ThwompCrossingVerticalNoRain.name, ExpandRoomPrefabs.SecretRewardRoom.name, ExpandPrefabs.DragunBossFoyerRoom.name, ExpandPrefabs.DraGunExitRoom.name, ExpandPrefabs.DraGunEndTimesRoom.name, ExpandPrefabs.BlacksmithShop.name, "Zelda Puzzle Room 1", "Zelda Puzzle Room 2", "Zelda Puzzle Room 3", "Special Entrance" }; } catch (Exception ex) { ETGModConsole.Log("[ExpandTheGungeon] ERROR: Exception occured while building prefabs!", true); Debug.LogException(ex); expandSharedAssets1 = null; sharedAssets = null; sharedAssets2 = null; braveResources = null; enemiesBase = null; return; } // Modified version of Anywhere mod DungeonFlowModule.Install(); InitConsoleCommands(ConsoleCommandName); GameManager.Instance.StartCoroutine(WaitForFoyerLoad()); if (ExpandSettings.EnableLanguageFix) { GameManager.Options.CurrentLanguage = StringTableManager.GungeonSupportedLanguages.ENGLISH; StringTableManager.CurrentLanguage = StringTableManager.GungeonSupportedLanguages.ENGLISH; } // Null bundles when done with them to avoid game crash issues expandSharedAssets1 = null; sharedAssets = null; sharedAssets2 = null; braveResources = null; enemiesBase = null; }
public override void Start() { if (!string.IsNullOrEmpty(ExceptionText)) { ETGModConsole.Log(ExceptionText); return; } ExpandSharedHooks.InstallRequiredHooks(); // Init ItemAPI SetupItemAPI(); try { // Init Prefab Databases ExpandPrefabs.InitCustomPrefabs(); // Init Custom Enemy Prefabs ExpandCustomEnemyDatabase.InitPrefabs(); // Init Custom Room Prefabs ExpandRoomPrefabs.InitCustomRooms(); // Init Custom DungeonFlow(s) ExpandDungeonFlow.InitDungeonFlows(); // Init Custom Dungeons Prefabs ExpandCustomDungeonPrefabs.InitCustomDungeons(); // Post Init // Things thta need existing stuff created first have code run here BootlegGuns.PostInit(); ExpandLists.InvalidRatFloorRainRooms = new List <string>() { ExpandRoomPrefabs.SecretBossRoom.name, ExpandRoomPrefabs.ThwompCrossingVerticalNoRain.name, ExpandRoomPrefabs.SecretRewardRoom.name, ExpandPrefabs.DragunBossFoyerRoom.name, ExpandPrefabs.DraGunExitRoom.name, ExpandPrefabs.DraGunEndTimesRoom.name, ExpandPrefabs.BlacksmithShop.name, "Zelda Puzzle Room 1", "Zelda Puzzle Room 2", "Zelda Puzzle Room 3", "Special Entrance" }; } catch (Exception ex) { ETGModConsole.Log("[ExpandTheGungeon] ERROR: Exception occured while building prefabs!", true); Debug.LogException(ex); ExpandPrefabs.sharedAssets = null; ExpandPrefabs.sharedAssets2 = null; ExpandPrefabs.braveResources = null; ExpandPrefabs.enemiesBase = null; return; } // Modified version of Anywhere mod DungeonFlowModule.Install(); InitConsoleCommands(ConsoleCommandName); // Null bundles when done with them to avoid game crash issues. ExpandPrefabs.sharedAssets = null; ExpandPrefabs.sharedAssets2 = null; ExpandPrefabs.braveResources = null; ExpandPrefabs.enemiesBase = null; }
public static void ApplyRoomData(AssetBundle[] Bundles, PrototypeDungeonRoom room, RoomData roomData, bool setRoomCategory, bool autoAssignToFloor, bool assignDecorationProperties, float?Weight) { // Tools.Print("Building Exits..."); if (roomData.exitPositions != null) { for (int i = 0; i < roomData.exitPositions.Length; i++) { DungeonData.Direction dir = (DungeonData.Direction)Enum.Parse(typeof(DungeonData.Direction), roomData.exitDirections[i].ToUpper()); AddExit(room, roomData.exitPositions[i], dir); } } else { AddExit(room, new Vector2(room.Width / 2, room.Height), DungeonData.Direction.NORTH); AddExit(room, new Vector2(room.Width / 2, 0), DungeonData.Direction.SOUTH); AddExit(room, new Vector2(room.Width, room.Height / 2), DungeonData.Direction.EAST); AddExit(room, new Vector2(0, room.Height / 2), DungeonData.Direction.WEST); } // Tools.Print("Adding Enemies..."); if (roomData.enemyPositions != null) { for (int i = 0; i < roomData.enemyPositions.Length; i++) { AddEnemyToRoom(room, roomData.enemyPositions[i], roomData.enemyGUIDs[i], roomData.enemyReinforcementLayers[i], roomData.randomizeEnemyPositions); } } // Tools.Print("Adding Objects..."); if (roomData.placeablePositions != null) { for (int i = 0; i < roomData.placeablePositions.Length; i++) { AddPlaceableToRoom(Bundles, room, roomData.placeablePositions[i], roomData.placeableGUIDs[i]); } } if (setRoomCategory | autoAssignToFloor) { // Set categories if (!string.IsNullOrEmpty(roomData.category)) { room.category = GetRoomCategory(roomData.category); } if (!string.IsNullOrEmpty(roomData.normalSubCategory)) { room.subCategoryNormal = GetRoomNormalSubCategory(roomData.normalSubCategory); } if (!string.IsNullOrEmpty(roomData.bossSubCategory)) { room.subCategoryBoss = GetRoomBossSubCategory(roomData.bossSubCategory); } if (!string.IsNullOrEmpty(roomData.specialSubCategory)) { room.subCategorySpecial = GetRoomSpecialSubCategory(roomData.specialSubCategory); } } if (autoAssignToFloor && roomData.floors != null) { if (!Weight.HasValue) { if (room.category == PrototypeDungeonRoom.RoomCategory.SECRET) { Weight = 15; // Normal secret rooms have weight of 15. } else { Weight = 1; } } if (room.category == PrototypeDungeonRoom.RoomCategory.SECRET) { // Secret rooms are generally shared across all floors via a specific room table. // Room Editor doesn't currently set this for secret rooms room.OverrideMusicState = DungeonFloorMusicController.DungeonMusicState.CALM; ExpandPrefabs.SecretRoomTable.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(room, Weight.Value)); } else { foreach (string floor in roomData.floors) { AssignRoomToFloorRoomTable(room, GetTileSet(floor), Weight); } /*ExpandPrefabs.CustomRoomTableSecretGlitchFloor.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(room, Weight.Value)); * ExpandPrefabs.CustomRoomTable.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(room, Weight.Value)); * ExpandPrefabs.CustomRoomTable2.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(room, Weight.Value));*/ } } if (assignDecorationProperties) { room.allowFloorDecoration = roomData.doFloorDecoration; room.allowWallDecoration = roomData.doWallDecoration; room.usesProceduralLighting = roomData.doLighting; } // Define FloorData in from second Texture object if one exists Texture2D m_ExtraFloorData = ExpandAssets.LoadAsset <Texture2D>(room.name + "_FloorData"); if (m_ExtraFloorData != null) { ApplyExtraFloorCellDataFromTexture2D(room, m_ExtraFloorData); } }