//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; } }
protected override void Register() { ModTypeLookup <ModGore> .Register(this); GoreLoader.RegisterModGore(this); }
//TODO: Unhardcode ALL of this. internal static void Unload() { ContentInstance.Clear(); ModTypeLookup.Clear(); ItemLoader.Unload(); EquipLoader.Unload(); PrefixLoader.Unload(); DustLoader.Unload(); TileLoader.Unload(); TileEntity.manager.Reset(); WallLoader.Unload(); ProjectileLoader.Unload(); NPCLoader.Unload(); NPCHeadLoader.Unload(); BossBarLoader.Unload(); PlayerHooks.Unload(); BuffLoader.Unload(); MountLoader.Unload(); RarityLoader.Unload(); DamageClassLoader.Unload(); InfoDisplayLoader.Unload(); GoreLoader.Unload(); SoundLoader.Unload(); DisposeMusic(); BackgroundTextureLoader.Unload(); UgBgStyleLoader.Unload(); SurfaceBgStyleLoader.Unload(); GlobalBgStyleLoader.Unload(); WaterStyleLoader.Unload(); WaterfallStyleLoader.Unload(); PlayerDrawLayerLoader.Unload(); SystemHooks.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(); RecipeLoader.Unload(); CommandLoader.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 void Autoload() { if (Code == null) { return; } Interface.loadMods.SubProgressText = Language.GetTextValue("tModLoader.MSFinishingResourceLoading"); while (AsyncLoadQueue.Count > 0) { AsyncLoadQueue.Dequeue().Wait(); } AutoloadLocalization(); ModSourceBestiaryInfoElement = new GameContent.Bestiary.ModSourceBestiaryInfoElement(this, DisplayName, Assets); IList <Type> modSounds = new List <Type>(); Type modType = GetType(); foreach (Type type in Code.GetTypes().OrderBy(type => type.FullName, StringComparer.InvariantCulture)) { if (type == modType) { continue; } if (type.IsAbstract) { continue; } if (type.ContainsGenericParameters) { continue; } if (type.GetConstructor(new Type[0]) == null) { continue; //don't autoload things with no default constructor } if (type.IsSubclassOf(typeof(ModSound))) { modSounds.Add(type); } else if (typeof(ILoadable).IsAssignableFrom(type)) { var autoload = AutoloadAttribute.GetValue(type); if (autoload.NeedsAutoloading) { AddContent((ILoadable)Activator.CreateInstance(type)); } } } if (Properties.AutoloadGores) { GoreLoader.AutoloadGores(this); } if (Properties.AutoloadSounds) { AutoloadSounds(modSounds); } if (Properties.AutoloadBackgrounds) { AutoloadBackgrounds(); } }