internal static void ResizeArrays(bool unloading = false) { //Textures Array.Resize(ref TextureAssets.Wall, nextWall); //Sets LoaderUtils.ReloadSets(typeof(WallID.Sets)); //Etc Array.Resize(ref Main.wallHouse, nextWall); Array.Resize(ref Main.wallDungeon, nextWall); Array.Resize(ref Main.wallLight, nextWall); Array.Resize(ref Main.wallBlend, nextWall); Array.Resize(ref Main.wallLargeFrames, nextWall); Array.Resize(ref Main.wallFrame, nextWall); Array.Resize(ref Main.wallFrameCounter, nextWall); ModLoader.BuildGlobalHook(ref HookKillSound, globalWalls, g => g.KillSound); ModLoader.BuildGlobalHook(ref HookNumDust, globalWalls, g => g.NumDust); ModLoader.BuildGlobalHook(ref HookCreateDust, globalWalls, g => g.CreateDust); ModLoader.BuildGlobalHook(ref HookDrop, globalWalls, g => g.Drop); ModLoader.BuildGlobalHook(ref HookKillWall, globalWalls, g => g.KillWall); ModLoader.BuildGlobalHook(ref HookCanExplode, globalWalls, g => g.CanExplode); ModLoader.BuildGlobalHook(ref HookModifyLight, globalWalls, g => g.ModifyLight); ModLoader.BuildGlobalHook(ref HookRandomUpdate, globalWalls, g => g.RandomUpdate); ModLoader.BuildGlobalHook(ref HookPreDraw, globalWalls, g => g.PreDraw); ModLoader.BuildGlobalHook(ref HookPostDraw, globalWalls, g => g.PostDraw); ModLoader.BuildGlobalHook(ref HookPlaceInWorld, globalWalls, g => g.PlaceInWorld); if (!unloading) { loaded = true; } }
internal static void ResizeArrays() { //Sets LoaderUtils.ReloadSets(typeof(MountID.Sets)); //Etc Array.Resize(ref Mount.mounts, MountCount); }
//change initial size of Terraria.Player.npcTypeNoAggro and NPCBannerBuff to NPCLoader.NPCCount() //in Terraria.Main.MouseText replace 251 with NPCLoader.NPCCount() //in Terraria.Main.DrawNPCs and Terraria.NPC.NPCLoot remove type too high check //replace a lot of 540 immediates //in Terraria.GameContent.UI.EmoteBubble make CountNPCs internal internal static void ResizeArrays(bool unloading) { //Textures Array.Resize(ref TextureAssets.Npc, nextNPC); //Sets LoaderUtils.ReloadSets(typeof(NPCID.Sets)); //Etc Array.Resize(ref Main.townNPCCanSpawn, nextNPC); Array.Resize(ref Main.slimeRainNPC, nextNPC); Array.Resize(ref Main.npcCatchable, nextNPC); Array.Resize(ref Main.npcFrameCount, nextNPC); Array.Resize(ref NPC.killCount, nextNPC); Array.Resize(ref NPC.npcsFoundForCheckActive, nextNPC); Array.Resize(ref Lang._npcNameCache, nextNPC); Array.Resize(ref EmoteBubble.CountNPCs, nextNPC); Array.Resize(ref WorldGen.TownManager._hasRoom, nextNPC); for (int k = NPCID.Count; k < nextNPC; k++) { Main.npcFrameCount[k] = 1; Lang._npcNameCache[k] = LocalizedText.Empty; } InstancedGlobals = globalNPCs.Where(g => g.InstancePerEntity).ToArray(); for (int i = 0; i < InstancedGlobals.Length; i++) { InstancedGlobals[i].instanceIndex = i; } foreach (var hook in hooks) { hook.arr = ModLoader.BuildGlobalHook(globalNPCs, hook.method); } if (!unloading) { loaded = true; } }
//in Terraria.GameContent.ChildSafety make SafeGore internal and not readonly internal static void ResizeAndFillArrays() { //Textures Array.Resize(ref TextureAssets.Gore, nextGore); //Sets LoaderUtils.ReloadSets(typeof(GoreID.Sets)); Array.Resize(ref ChildSafety.SafeGore, nextGore); for (int k = GoreID.Count; k < nextGore; k++) { GoreID.Sets.DisappearSpeed[k] = 1; GoreID.Sets.DisappearSpeedAlpha[k] = 1; } foreach (string texture in gores.Keys) { TextureAssets.Gore[gores[texture]] = ModContent.GetTexture(texture); } }
//change initial size of Terraria.Player.ownedProjectileCounts to ProjectileLoader.ProjectileCount() internal static void ResizeArrays() { //Textures Array.Resize(ref TextureAssets.Projectile, nextProjectile); //Sets LoaderUtils.ReloadSets(typeof(ProjectileID.Sets)); //Etc Array.Resize(ref Main.projHostile, nextProjectile); Array.Resize(ref Main.projHook, nextProjectile); Array.Resize(ref Main.projFrames, nextProjectile); Array.Resize(ref Main.projPet, nextProjectile); Array.Resize(ref Lang._projectileNameCache, nextProjectile); for (int k = ProjectileID.Count; k < nextProjectile; k++) { Main.projFrames[k] = 1; Lang._projectileNameCache[k] = LocalizedText.Empty; } Array.Resize(ref Projectile.perIDStaticNPCImmunity, nextProjectile); for (int i = 0; i < nextProjectile; i++) { Projectile.perIDStaticNPCImmunity[i] = new uint[200]; } InstancedGlobals = globalProjectiles.Where(g => g.InstancePerEntity).ToArray(); for (int i = 0; i < InstancedGlobals.Length; i++) { InstancedGlobals[i].instanceIndex = i; } foreach (var hook in hooks) { hook.arr = ModLoader.BuildGlobalHook(globalProjectiles, hook.method); } }
internal static void ResizeArrays() { //Textures Array.Resize(ref TextureAssets.Buff, nextBuff); //Sets LoaderUtils.ReloadSets(typeof(BuffID.Sets)); //Etc Array.Resize(ref Main.pvpBuff, nextBuff); Array.Resize(ref Main.persistentBuff, nextBuff); Array.Resize(ref Main.vanityPet, nextBuff); Array.Resize(ref Main.lightPet, nextBuff); Array.Resize(ref Main.meleeBuff, nextBuff); Array.Resize(ref Main.debuff, nextBuff); Array.Resize(ref Main.buffNoSave, nextBuff); Array.Resize(ref Main.buffNoTimeDisplay, nextBuff); Array.Resize(ref Main.buffDoubleApply, nextBuff); Array.Resize(ref Main.buffAlpha, nextBuff); Array.Resize(ref Lang._buffNameCache, nextBuff); Array.Resize(ref Lang._buffDescriptionCache, nextBuff); for (int k = BuffID.Count; k < nextBuff; k++) { Lang._buffNameCache[k] = LocalizedText.Empty; Lang._buffDescriptionCache[k] = LocalizedText.Empty; } extraPlayerBuffCount = ModLoader.Mods.Any() ? ModLoader.Mods.Max(m => (int)m.ExtraPlayerBuffSlots) : 0; //Hooks ModLoader.BuildGlobalHook(ref HookUpdatePlayer, globalBuffs, g => g.Update); ModLoader.BuildGlobalHook(ref HookUpdateNPC, globalBuffs, g => g.Update); ModLoader.BuildGlobalHook(ref HookReApplyPlayer, globalBuffs, g => g.ReApply); ModLoader.BuildGlobalHook(ref HookReApplyNPC, globalBuffs, g => g.ReApply); ModLoader.BuildGlobalHook(ref HookModifyBuffTip, globalBuffs, g => g.ModifyBuffTip); ModLoader.BuildGlobalHook(ref HookCustomBuffTipSize, globalBuffs, g => g.CustomBuffTipSize); ModLoader.BuildGlobalHook(ref HookDrawCustomBuffTip, globalBuffs, g => g.DrawCustomBuffTip); }
internal static void ResizeArrays(bool unloading = false) { //Textures Array.Resize(ref TextureAssets.Tile, nextTile); Array.Resize(ref TextureAssets.HighlightMask, nextTile); //Sets LoaderUtils.ReloadSets(typeof(TileID.Sets)); //Etc Array.Resize(ref Main.tileLighted, nextTile); Array.Resize(ref Main.tileMergeDirt, nextTile); Array.Resize(ref Main.tileCut, nextTile); Array.Resize(ref Main.tileAlch, nextTile); Array.Resize(ref Main.tileShine, nextTile); Array.Resize(ref Main.tileShine2, nextTile); Array.Resize(ref Main.tileStone, nextTile); Array.Resize(ref Main.tileAxe, nextTile); Array.Resize(ref Main.tileHammer, nextTile); Array.Resize(ref Main.tileWaterDeath, nextTile); Array.Resize(ref Main.tileLavaDeath, nextTile); Array.Resize(ref Main.tileTable, nextTile); Array.Resize(ref Main.tileBlockLight, nextTile); Array.Resize(ref Main.tileNoSunLight, nextTile); Array.Resize(ref Main.tileDungeon, nextTile); Array.Resize(ref Main.tileSpelunker, nextTile); Array.Resize(ref Main.tileSolidTop, nextTile); Array.Resize(ref Main.tileSolid, nextTile); Array.Resize(ref Main.tileBouncy, nextTile); Array.Resize(ref Main.tileLargeFrames, nextTile); Array.Resize(ref Main.tileRope, nextTile); Array.Resize(ref Main.tileBrick, nextTile); Array.Resize(ref Main.tileMoss, nextTile); Array.Resize(ref Main.tileNoAttach, nextTile); Array.Resize(ref Main.tileNoFail, nextTile); Array.Resize(ref Main.tileObsidianKill, nextTile); Array.Resize(ref Main.tileFrameImportant, nextTile); Array.Resize(ref Main.tilePile, nextTile); Array.Resize(ref Main.tileBlendAll, nextTile); Array.Resize(ref Main.tileGlowMask, nextTile); Array.Resize(ref Main.tileContainer, nextTile); Array.Resize(ref Main.tileSign, nextTile); Array.Resize(ref Main.tileSand, nextTile); Array.Resize(ref Main.tileFlame, nextTile); Array.Resize(ref Main.tileFrame, nextTile); Array.Resize(ref Main.tileFrameCounter, nextTile); Array.Resize(ref Main.SceneMetrics._tileCounts, nextTile); Array.Resize(ref Main.tileMerge, nextTile); Array.Resize(ref Main.tileOreFinderPriority, nextTile); for (int k = 0; k < nextTile; k++) //oh dear { Array.Resize(ref Main.tileMerge[k], nextTile); } Array.Resize(ref WorldGen.tileCounts, nextTile); Array.Resize(ref WorldGen.houseTile, nextTile); //Array.Resize(ref GameContent.Biomes.CaveHouseBiome._blacklistedTiles, nextTile); Array.Resize(ref GameContent.Biomes.CorruptionPitBiome.ValidTiles, nextTile); while (TileObjectData._data.Count < nextTile) { TileObjectData._data.Add(null); } //Hooks ModLoader.BuildGlobalHook(ref HookKillSound, globalTiles, g => g.KillSound); ModLoader.BuildGlobalHook(ref HookNumDust, globalTiles, g => g.NumDust); ModLoader.BuildGlobalHook(ref HookCreateDust, globalTiles, g => g.CreateDust); ModLoader.BuildGlobalHook(ref HookDropCritterChance, globalTiles, g => g.DropCritterChance); ModLoader.BuildGlobalHook(ref HookDrop, globalTiles, g => g.Drop); ModLoader.BuildGlobalHook(ref HookCanKillTile, globalTiles, g => g.CanKillTile); ModLoader.BuildGlobalHook(ref HookKillTile, globalTiles, g => g.KillTile); ModLoader.BuildGlobalHook(ref HookCanExplode, globalTiles, g => g.CanExplode); ModLoader.BuildGlobalHook(ref HookNearbyEffects, globalTiles, g => g.NearbyEffects); ModLoader.BuildGlobalHook(ref HookModifyLight, globalTiles, g => g.ModifyLight); ModLoader.BuildGlobalHook(ref HookDangersense, globalTiles, g => g.Dangersense); ModLoader.BuildGlobalHook(ref HookSetSpriteEffects, globalTiles, g => g.SetSpriteEffects); ModLoader.BuildGlobalHook(ref HookAnimateTile, globalTiles, g => g.AnimateTile); ModLoader.BuildGlobalHook(ref HookPreDraw, globalTiles, g => g.PreDraw); ModLoader.BuildGlobalHook(ref HookDrawEffects, globalTiles, g => g.DrawEffects); ModLoader.BuildGlobalHook(ref HookPostDraw, globalTiles, g => g.PostDraw); ModLoader.BuildGlobalHook(ref HookSpecialDraw, globalTiles, g => g.SpecialDraw); ModLoader.BuildGlobalHook(ref HookRandomUpdate, globalTiles, g => g.RandomUpdate); ModLoader.BuildGlobalHook(ref HookTileFrame, globalTiles, g => g.TileFrame); ModLoader.BuildGlobalHook(ref HookCanPlace, globalTiles, g => g.CanPlace); ModLoader.BuildGlobalHook(ref HookAdjTiles, globalTiles, g => g.AdjTiles); ModLoader.BuildGlobalHook(ref HookRightClick, globalTiles, g => g.RightClick); ModLoader.BuildGlobalHook(ref HookMouseOver, globalTiles, g => g.MouseOver); ModLoader.BuildGlobalHook(ref HookMouseOverFar, globalTiles, g => g.MouseOverFar); ModLoader.BuildGlobalHook(ref HookAutoSelect, globalTiles, g => g.AutoSelect); ModLoader.BuildGlobalHook(ref HookPreHitWire, globalTiles, g => g.PreHitWire); ModLoader.BuildGlobalHook(ref HookHitWire, globalTiles, g => g.HitWire); ModLoader.BuildGlobalHook(ref HookSlope, globalTiles, g => g.Slope); ModLoader.BuildGlobalHook(ref HookFloorVisuals, globalTiles, g => g.FloorVisuals); ModLoader.BuildGlobalHook(ref HookChangeWaterfallStyle, globalTiles, g => g.ChangeWaterfallStyle); ModLoader.BuildGlobalHook(ref HookSaplingGrowthType, globalTiles, g => g.SaplingGrowthType); ModLoader.BuildGlobalHook(ref HookPlaceInWorld, globalTiles, g => g.PlaceInWorld); if (!unloading) { loaded = true; } }