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(); }
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() { 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(); }
public override void SetupContent() { ProjectileLoader.SetDefaults(projectile, false); AutoStaticDefaults(); SetStaticDefaults(); ProjectileID.Search.Add(FullName, Type); }
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; } }
protected sealed override void Register() { ModTypeLookup <ModProjectile> .Register(this); projectile.type = ProjectileLoader.ReserveProjectileID(); DisplayName = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.ProjectileName.{Name}"); ProjectileLoader.projectiles.Add(this); }
protected sealed override void Register() { ProjectileLoader.VerifyGlobalProjectile(this); ModTypeLookup <GlobalProjectile> .Register(this); index = ProjectileLoader.globalProjectiles.Count; ProjectileLoader.globalProjectiles.Add(this); }
public void AddProjectile(string name, ModProjectile projectile, string texture) { int id = ProjectileLoader.ReserveProjectileID(); projectile.projectile.name = name; projectile.Name = name; projectile.projectile.type = id; projectiles[name] = projectile; ProjectileLoader.projectiles[id] = projectile; projectile.texture = texture; projectile.mod = this; }
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(); }
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; } }
internal void SetupContent() { foreach (ModItem item in items.Values) { ItemLoader.SetDefaults(item.item, false); item.AutoStaticDefaults(); item.SetStaticDefaults(); } foreach (ModPrefix prefix in prefixes.Values) { prefix.AutoDefaults(); prefix.SetDefaults(); } foreach (ModDust dust in dusts.Values) { dust.SetDefaults(); } foreach (ModTile tile in tiles.Values) { Main.tileTexture[tile.Type] = ModContent.GetTexture(tile.texture); TileLoader.SetDefaults(tile); if (TileID.Sets.HasOutlines[tile.Type]) { Main.highlightMaskTexture[tile.Type] = ModContent.GetTexture(tile.HighlightTexture); } if (!string.IsNullOrEmpty(tile.chest)) { TileID.Sets.BasicChest[tile.Type] = true; } } foreach (GlobalTile globalTile in globalTiles.Values) { globalTile.SetDefaults(); } foreach (ModWall wall in walls.Values) { Main.wallTexture[wall.Type] = ModContent.GetTexture(wall.texture); wall.SetDefaults(); } foreach (GlobalWall globalWall in globalWalls.Values) { globalWall.SetDefaults(); } foreach (ModProjectile projectile in projectiles.Values) { ProjectileLoader.SetDefaults(projectile.projectile, false); projectile.AutoStaticDefaults(); projectile.SetStaticDefaults(); } foreach (ModNPC npc in npcs.Values) { NPCLoader.SetDefaults(npc.npc, false); npc.AutoStaticDefaults(); npc.SetStaticDefaults(); } foreach (ModMountData modMountData in mountDatas.Values) { var mountData = modMountData.mountData; mountData.modMountData = modMountData; MountLoader.SetupMount(mountData); Mount.mounts[modMountData.Type] = mountData; } foreach (ModBuff buff in buffs.Values) { Main.buffTexture[buff.Type] = ModContent.GetTexture(buff.texture); buff.SetDefaults(); } foreach (ModWaterStyle waterStyle in waterStyles.Values) { LiquidRenderer.Instance._liquidTextures[waterStyle.Type] = ModContent.GetTexture(waterStyle.texture); Main.liquidTexture[waterStyle.Type] = ModContent.GetTexture(waterStyle.blockTexture); } foreach (ModWaterfallStyle waterfallStyle in waterfallStyles.Values) { Main.instance.waterfallManager.waterfallTexture[waterfallStyle.Type] = ModContent.GetTexture(waterfallStyle.texture); } }
/// <summary> /// Gets the ModProjectile instance corresponding to the specified type. /// </summary> /// <param name="type">The type of the projectile</param> /// <returns>The ModProjectile instance in the projectiles array, null if not found.</returns> public static ModProjectile GetModProjectile(int type) => ProjectileLoader.GetProjectile(type);