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(); }
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(); }
protected override sealed void Register() { Type = ModDust.ReserveDustID(); ModTypeLookup <ModDust> .Register(this); ModDust.dusts.Add(this); Texture2D = !string.IsNullOrEmpty(Texture) ? ModContent.GetTexture(Texture).Value : TextureAssets.Dust.Value; }
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 int DustType(string name) { ModDust dust = GetDust(name); if (dust == null) { return(0); } return(dust.Type); }
//in Terraria.Dust.UpdateDust after incrementing Dust.dCount call this internal static void SetupUpdateType(Dust dust) { ModDust modDust = GetDust(dust.type); if (modDust != null && modDust.updateType >= 0) { dust.realType = dust.type; dust.type = modDust.updateType; } }
//in Terraria.Dust.NewDust after initializing dust properties call ModDust.SetupDust(dust); internal static void SetupDust(Dust dust) { ModDust modDust = GetDust(dust.type); if (modDust != null) { dust.frame.X = 0; dust.frame.Y %= 30; modDust.OnSpawn(dust); } }
private void AutoloadDust(Type type) { ModDust dust = (ModDust)Activator.CreateInstance(type); dust.mod = this; string name = type.Name; string texture = (type.Namespace + "." + type.Name).Replace('.', '/'); if (dust.Autoload(ref name, ref texture)) { AddDust(name, dust, texture); } }
public void AddDust(string name, ModDust dust, string texture = "") { dust.Name = name; if (texture.Length > 0) { dust.Texture = ModLoader.GetTexture(texture); } else { dust.Texture = Main.dustTexture; } dust.mod = this; dusts[name] = dust; }
public void AddDust(string name, ModDust dust, string texture = "") { dust.Name = name; if(texture.Length > 0) { dust.Texture = ModLoader.GetTexture(texture); } else { dust.Texture = Main.dustTexture; } dust.mod = this; dusts[name] = dust; }
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(); }
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(); }
public void AddDust(string name, ModDust dust, string texture = "") { int id = ModDust.ReserveDustID(); ModDust.dusts[id] = dust; dust.Type = id; dust.Name = name; if (texture.Length > 0) { dust.Texture = ModLoader.GetTexture(texture); } else { dust.Texture = Main.dustTexture; } dust.mod = this; dusts[name] = dust; }
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; } }
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(); }
public void AddDust(string name, ModDust dust, string texture = "") { int id = ModDust.ReserveDustID(); ModDust.dusts.Add(dust); dust.Type = id; dust.Name = name; dust.Texture = texture.Length > 0 ? ModLoader.GetTexture(texture) : Main.dustTexture; dust.mod = this; dusts[name] = dust; }
/// <summary> /// Gets the ModDust instance with the given type. Returns null if no ModDust with the given type exists. /// </summary> public static ModDust GetModDust(int type) => ModDust.GetDust(type);