private static void ResizeArrays(bool unloading = false) { ItemLoader.ResizeArrays(unloading); EquipLoader.ResizeAndFillArrays(); ModPrefix.ResizeArrays(); Main.InitializeItemAnimations(); ModDust.ResizeArrays(); TileLoader.ResizeArrays(unloading); WallLoader.ResizeArrays(unloading); ProjectileLoader.ResizeArrays(); NPCLoader.ResizeArrays(unloading); NPCHeadLoader.ResizeAndFillArrays(); ModGore.ResizeAndFillArrays(); SoundLoader.ResizeAndFillArrays(); MountLoader.ResizeArrays(); BuffLoader.ResizeArrays(); PlayerHooks.RebuildHooks(); BackgroundTextureLoader.ResizeAndFillArrays(); UgBgStyleLoader.ResizeAndFillArrays(); SurfaceBgStyleLoader.ResizeAndFillArrays(); GlobalBgStyleLoader.ResizeAndFillArrays(unloading); WaterStyleLoader.ResizeArrays(); WaterfallStyleLoader.ResizeArrays(); WorldHooks.ResizeArrays(); foreach (LocalizedText text in LanguageManager.Instance._localizedTexts.Values) { text.Override = null; } }
internal static void Unload() { while (loadOrder.Count > 0) { GetMod(loadOrder.Pop()).UnloadContent(); } loadedMods.Clear(); ItemLoader.Unload(); EquipLoader.Unload(); ModDust.Unload(); TileLoader.Unload(); WallLoader.Unload(); ProjectileLoader.Unload(); NPCLoader.Unload(); NPCHeadLoader.Unload(); PlayerHooks.Unload(); BuffLoader.Unload(); MountLoader.Unload(); ModGore.Unload(); SoundLoader.Unload(); textures.Clear(); sounds.Clear(); mods.Clear(); ResizeArrays(true); MapLoader.UnloadModMap(); modHotKeys.Clear(); }
public void AddBossHeadTexture(string texture) { int slot = NPCHeadLoader.ReserveBossHeadSlot(texture); NPCHeadLoader.bossHeads[texture] = slot; ModLoader.GetTexture(texture); }
/// <summary> /// Assigns a head texture to the given town NPC type. /// </summary> /// <param name="npcType">Type of the NPC.</param> /// <param name="texture">The texture.</param> /// <returns>The boss head txture slot</returns> /// <exception cref="MissingResourceException"></exception> public int AddNPCHeadTexture(int npcType, string texture) { if (!loading) { throw new Exception("AddNPCHeadTexture can only be called from Mod.Load or Mod.Autoload"); } int slot = NPCHeadLoader.ReserveHeadSlot(); NPCHeadLoader.heads[texture] = slot; if (!Main.dedServ) { ModContent.GetTexture(texture); } /*else if (Main.dedServ && !(ModLoader.FileExists(texture + ".png") || ModLoader.FileExists(texture + ".rawimg"))) * { * throw new MissingResourceException(texture); * }*/ NPCHeadLoader.npcToHead[npcType] = slot; NPCHeadLoader.headToNPC[slot] = npcType; return(slot); }
internal static void Unload() { ContentInstance.Clear(); ModTypeLookup.Clear(); ItemLoader.Unload(); EquipLoader.Unload(); ModPrefix.Unload(); ModDust.Unload(); TileLoader.Unload(); ModTileEntity.UnloadAll(); WallLoader.Unload(); ProjectileLoader.Unload(); NPCLoader.Unload(); NPCHeadLoader.Unload(); PlayerHooks.Unload(); BuffLoader.Unload(); MountLoader.Unload(); RarityLoader.Unload(); DamageClassLoader.Unload(); ModGore.Unload(); SoundLoader.Unload(); DisposeMusic(); BackgroundTextureLoader.Unload(); UgBgStyleLoader.Unload(); SurfaceBgStyleLoader.Unload(); GlobalBgStyleLoader.Unload(); WaterStyleLoader.Unload(); WaterfallStyleLoader.Unload(); WorldHooks.Unload(); ResizeArrays(true); for (int k = 0; k < Recipe.maxRecipes; k++) { Main.recipe[k] = new Recipe(); } Recipe.numRecipes = 0; RecipeGroupHelper.ResetRecipeGroups(); Recipe.SetupRecipes(); MapLoader.UnloadModMap(); ItemSorting.SetupWhiteLists(); HotKeyLoader.Unload(); RecipeHooks.Unload(); CommandManager.Unload(); TagSerializer.Reload(); ModNet.Unload(); Config.ConfigManager.Unload(); CustomCurrencyManager.Initialize(); EffectsTracker.RemoveModEffects(); // ItemID.Search = IdDictionary.Create<ItemID, short>(); // NPCID.Search = IdDictionary.Create<NPCID, short>(); // ProjectileID.Search = IdDictionary.Create<ProjectileID, short>(); // TileID.Search = IdDictionary.Create<TileID, ushort>(); // WallID.Search = IdDictionary.Create<WallID, ushort>(); // BuffID.Search = IdDictionary.Create<BuffID, int>(); ContentSamples.Initialize(); CleanupModReferences(); }
internal static void Unload() { while (loadOrder.Count > 0) { GetMod(loadOrder.Pop()).UnloadContent(); } loadOrder.Clear(); loadedMods = new Mod[0]; ItemLoader.Unload(); EquipLoader.Unload(); ModPrefix.Unload(); ModDust.Unload(); TileLoader.Unload(); ModTileEntity.Unload(); WallLoader.Unload(); ProjectileLoader.Unload(); NPCLoader.Unload(); NPCHeadLoader.Unload(); PlayerHooks.Unload(); BuffLoader.Unload(); MountLoader.Unload(); ModGore.Unload(); SoundLoader.Unload(); DisposeMusic(); BackgroundTextureLoader.Unload(); UgBgStyleLoader.Unload(); SurfaceBgStyleLoader.Unload(); GlobalBgStyleLoader.Unload(); WaterStyleLoader.Unload(); WaterfallStyleLoader.Unload(); mods.Clear(); WorldHooks.Unload(); ResizeArrays(true); for (int k = 0; k < Recipe.maxRecipes; k++) { Main.recipe[k] = new Recipe(); } Recipe.numRecipes = 0; RecipeGroupHelper.ResetRecipeGroups(); Recipe.SetupRecipes(); MapLoader.UnloadModMap(); ItemSorting.SetupWhiteLists(); modHotKeys.Clear(); RecipeHooks.Unload(); CommandManager.Unload(); TagSerializer.Reload(); ModNet.Unload(); GameContent.UI.CustomCurrencyManager.Initialize(); CleanupModReferences(); if (!Main.dedServ && Main.netMode != 1) //disable vanilla client compatiblity restrictions when reloading on a client { ModNet.AllowVanillaClients = false; } }
public void AddNPCHeadTexture(int npcType, string texture) { int slot = NPCHeadLoader.ReserveHeadSlot(); NPCHeadLoader.heads[texture] = slot; ModLoader.GetTexture(texture); NPCHeadLoader.npcToHead[npcType] = slot; NPCHeadLoader.headToNPC[slot] = npcType; }
private static void ResizeArrays(bool unloading = false) { ItemLoader.ResizeArrays(); EquipLoader.ResizeAndFillArrays(); Main.InitializeItemAnimations(); TileLoader.ResizeArrays(unloading); WallLoader.ResizeArrays(unloading); ProjectileLoader.ResizeArrays(); NPCLoader.ResizeArrays(); ModGore.ResizeArrays(); NPCHeadLoader.ResizeAndFillArrays(); ModSound.ResizeArrays(); }
/// <summary> /// Assigns a head texture that can be used by NPCs on the map. /// </summary> /// <param name="texture">The texture.</param> /// <param name="npcType">An optional npc id for NPCID.Sets.BossHeadTextures</param> public void AddBossHeadTexture(string texture, int npcType = -1) { if (!loading) { throw new Exception("AddBossHeadTexture can only be called from Mod.Load or Mod.Autoload"); } int slot = NPCHeadLoader.ReserveBossHeadSlot(texture); NPCHeadLoader.bossHeads[texture] = slot; ModContent.GetTexture(texture); if (npcType >= 0) { NPCHeadLoader.npcToBossHead[npcType] = slot; } }
internal static void Unload() { ItemLoader.Unload(); EquipLoader.Unload(); ModPrefix.Unload(); ModDust.Unload(); TileLoader.Unload(); ModTileEntity.Unload(); WallLoader.Unload(); ProjectileLoader.Unload(); NPCLoader.Unload(); NPCHeadLoader.Unload(); PlayerHooks.Unload(); BuffLoader.Unload(); MountLoader.Unload(); ModGore.Unload(); SoundLoader.Unload(); DisposeMusic(); BackgroundTextureLoader.Unload(); UgBgStyleLoader.Unload(); SurfaceBgStyleLoader.Unload(); GlobalBgStyleLoader.Unload(); WaterStyleLoader.Unload(); WaterfallStyleLoader.Unload(); WorldHooks.Unload(); ResizeArrays(true); for (int k = 0; k < Recipe.maxRecipes; k++) { Main.recipe[k] = new Recipe(); } Recipe.numRecipes = 0; RecipeGroupHelper.ResetRecipeGroups(); Recipe.SetupRecipes(); MapLoader.UnloadModMap(); ItemSorting.SetupWhiteLists(); modHotKeys.Clear(); RecipeHooks.Unload(); CommandManager.Unload(); TagSerializer.Reload(); ModNet.Unload(); Config.ConfigManager.Unload(); CustomCurrencyManager.Initialize(); EffectsTracker.RemoveModEffects(); CleanupModReferences(); }
internal static void Unload() { while (loadOrder.Count > 0) { GetMod(loadOrder.Pop()).UnloadContent(); } loadOrder.Clear(); loadedMods = new Mod[0]; ItemLoader.Unload(); EquipLoader.Unload(); ModDust.Unload(); TileLoader.Unload(); WallLoader.Unload(); ProjectileLoader.Unload(); NPCLoader.Unload(); NPCHeadLoader.Unload(); PlayerHooks.Unload(); BuffLoader.Unload(); MountLoader.Unload(); ModGore.Unload(); SoundLoader.Unload(); BackgroundTextureLoader.Unload(); UgBgStyleLoader.Unload(); SurfaceBgStyleLoader.Unload(); GlobalBgStyleLoader.Unload(); WaterStyleLoader.Unload(); WaterfallStyleLoader.Unload(); mods.Clear(); ResizeArrays(true); MapLoader.UnloadModMap(); ItemSorting.SetupWhiteLists(); modHotKeys.Clear(); WorldHooks.Unload(); RecipeHooks.Unload(); if (!Main.dedServ && Main.netMode != 1) //disable vanilla client compatiblity restrictions when reloading on a client { ModNet.AllowVanillaClients = false; } }
internal static void Unload() { foreach (Mod mod in mods.Values) { mod.Unload(); } loadedMods.Clear(); ItemLoader.Unload(); EquipLoader.Unload(); TileLoader.Unload(); WallLoader.Unload(); ProjectileLoader.Unload(); NPCLoader.Unload(); ModGore.Unload(); NPCHeadLoader.Unload(); ModSound.Unload(); textures.Clear(); sounds.Clear(); mods.Clear(); ResizeArrays(true); }
private static void ResizeArrays(bool unloading = false) { ItemLoader.ResizeArrays(); EquipLoader.ResizeAndFillArrays(); Main.InitializeItemAnimations(); ModDust.ResizeArrays(); TileLoader.ResizeArrays(unloading); WallLoader.ResizeArrays(unloading); ProjectileLoader.ResizeArrays(); NPCLoader.ResizeArrays(); NPCHeadLoader.ResizeAndFillArrays(); ModGore.ResizeAndFillArrays(); SoundLoader.ResizeAndFillArrays(); MountLoader.ResizeArrays(); BuffLoader.ResizeArrays(); BackgroundTextureLoader.ResizeAndFillArrays(); UgBgStyleLoader.ResizeAndFillArrays(); SurfaceBgStyleLoader.ResizeAndFillArrays(); GlobalBgStyleLoader.ResizeAndFillArrays(unloading); WaterStyleLoader.ResizeArrays(); WaterfallStyleLoader.ResizeArrays(); }
//TODO: Unhardcode ALL of this. private static void ResizeArrays(bool unloading = false) { DamageClassLoader.ResizeArrays(); ItemLoader.ResizeArrays(unloading); EquipLoader.ResizeAndFillArrays(); PrefixLoader.ResizeArrays(); DustLoader.ResizeArrays(); TileLoader.ResizeArrays(unloading); WallLoader.ResizeArrays(unloading); TileIO.ResizeArrays(); ProjectileLoader.ResizeArrays(); NPCLoader.ResizeArrays(unloading); NPCHeadLoader.ResizeAndFillArrays(); MountLoader.ResizeArrays(); BuffLoader.ResizeArrays(); PlayerHooks.RebuildHooks(); PlayerDrawLayerLoader.ResizeArrays(); SystemHooks.ResizeArrays(); if (!Main.dedServ) { SoundLoader.ResizeAndFillArrays(); BackgroundTextureLoader.ResizeAndFillArrays(); UgBgStyleLoader.ResizeAndFillArrays(); SurfaceBgStyleLoader.ResizeAndFillArrays(); GlobalBgStyleLoader.ResizeAndFillArrays(unloading); GoreLoader.ResizeAndFillArrays(); WaterStyleLoader.ResizeArrays(); WaterfallStyleLoader.ResizeArrays(); } foreach (LocalizedText text in LanguageManager.Instance._localizedTexts.Values) { text.Override = null; } }
/// <summary> /// Gets the index of the head texture corresponding to the given texture path. /// </summary> /// <param name="texture">Relative texture path</param> /// <returns>The index of the texture in the heads array, -1 if not found.</returns> public static int GetModHeadSlot(string texture) => NPCHeadLoader.GetHeadSlot(texture);