示例#1
0
        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();
        }
示例#2
0
        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();
        }