internal static void UnloadStaticFields() { tConfigWrapper.ReportErrors = false; tConfigWrapper.ModsPath = null; searchDict = null; containsName = null; getID = null; LoadStep.UnloadStaticFields(); //Loaders.AssemblyLoader.UnloadStaticFields(); ModState.UnloadStaticFields(); }
internal static void LoadStaticFields() { tConfigWrapper.ReportErrors = false; tConfigWrapper.ModsPath = Main.SavePath + "\\tConfigWrapper\\Mods"; searchDict = new ConcurrentDictionary <string, object>(); containsName = typeof(IdDictionary).GetMethod("ContainsName"); getID = typeof(IdDictionary).GetMethod("GetId"); LoadStep.LoadStaticFields(); //Loaders.AssemblyLoader.LoadStaticFields(); ModState.LoadStaticFields(); }
public override void ModifyWorldGenTasks(List <GenPass> tasks, ref float totalWeight) // Runs on world creation, so that mods are serialized even if you don't enter the world. { if (ModState.PrevLoadedWorldMods.ContainsKey($"{Main.worldID}:{Main.worldName}")) { ModState.PrevLoadedWorldMods.Remove($"{Main.worldID}:{Main.worldName}"); } ModState.PrevLoadedWorldMods.Add($"{Main.worldID}:{Main.worldName}", new PrevMods { PrevEnabledMods = new HashSet <string>(ModState.EnabledMods) }); ModState.SerializePreviousWorldMods(); }
public override void SetupStartInventory(IList <Item> items, bool mediumcoreDeath) // Runs on player creation, so that mods are serialized even if you don't enter the world. { if (ModState.PrevLoadedPlayerMods.ContainsKey(player.name)) { ModState.PrevLoadedPlayerMods.Remove(player.name); } ModState.PrevLoadedPlayerMods.Add(player.name, new PrevMods { PrevEnabledMods = new HashSet <string>(ModState.EnabledMods) }); ModState.SerializePreviousPlayerMods(); }
public override void OnEnterWorld(Player player) { if (ModState.PrevLoadedPlayerMods.ContainsKey(player.name)) { ModState.PrevLoadedPlayerMods.Remove(player.name); } ModState.PrevLoadedPlayerMods.Add(player.name, new PrevMods { PrevEnabledMods = new HashSet <string>(ModState.EnabledMods) }); ModState.SerializePreviousPlayerMods(); if (ModState.PrevLoadedWorldMods.ContainsKey($"{Main.worldID}:{Main.worldName}")) { ModState.PrevLoadedWorldMods.Remove($"{Main.worldID}:{Main.worldName}"); } ModState.PrevLoadedWorldMods.Add($"{Main.worldID}:{Main.worldName}", new PrevMods { PrevEnabledMods = new HashSet <string>(ModState.EnabledMods) }); ModState.SerializePreviousWorldMods(); }