public static void Initialize()
    {
        if (ConfigurationManager.GeneralConfig?.InitializeWithCreatures?.Value ?? false)
        {
            string configPath = Path.Combine(Paths.ConfigPath, SpawnSystemConfigurationManager.SimpleConfigFile);
            if (!File.Exists(configPath))
            {
                ConfigFile file   = new ConfigFile(configPath, true);
                var        config = new SimpleConfigurationFile();

                Log.LogDebug($"Initializing {SpawnSystemConfigurationManager.SimpleConfigFile}.");

                CreateEntry(file, "Crow");
                CreateEntry(file, "FireFlies");
                CreateEntry(file, "Deer");
                CreateEntry(file, "Fish1");
                CreateEntry(file, "Fish2");
                CreateEntry(file, "Fish3");
                CreateEntry(file, "Seagal");
                CreateEntry(file, "Leviathan");
                CreateEntry(file, "Boar");
                CreateEntry(file, "Neck");
                CreateEntry(file, "Greyling");
                CreateEntry(file, "Greydwarf");
                CreateEntry(file, "Greydwarf_Elite");
                CreateEntry(file, "Greydwarf_shaman");
                CreateEntry(file, "Troll");
                CreateEntry(file, "Ghost");
                CreateEntry(file, "Skeleton");
                CreateEntry(file, "Skeleton_NoArcher");
                CreateEntry(file, "Skeleton_poison");
                CreateEntry(file, "Blob");
                CreateEntry(file, "BlobElite");
                CreateEntry(file, "Draugr");
                CreateEntry(file, "Draugr_Ranged");
                CreateEntry(file, "Draugr_Elite");
                CreateEntry(file, "Leech");
                CreateEntry(file, "Surtling");
                CreateEntry(file, "Wraith");
                CreateEntry(file, "Wolf");
                CreateEntry(file, "Hatchling");
                CreateEntry(file, "StoneGolem");
                CreateEntry(file, "Fenring");
                CreateEntry(file, "Deathsquito");
                CreateEntry(file, "Lox");
                CreateEntry(file, "Goblin");
                CreateEntry(file, "GoblinArcher");
                CreateEntry(file, "GoblinBrute");
                CreateEntry(file, "GoblinShaman");
                CreateEntry(file, "Serpent");

                Log.LogDebug($"Finished initializing {SpawnSystemConfigurationManager.SimpleConfigFile}.");
            }
        }
    }
Ejemplo n.º 2
0
    protected override void BeforePack()
    {
        TemplatesById = new(WorldSpawnTemplateManager.TemplatesById);

        SimpleConfig = SpawnSystemConfigurationManager.SimpleConfig;

        Log.LogDebug($"Packaged world spawner configurations: {TemplatesById?.Count ?? 0}");
        Log.LogDebug($"Packaged simple world spawner configurations: {SimpleConfig?.Subsections?.Count ?? 0}");

        RegisterType(TemplatesById.Values.SelectMany(x => x.SpawnConditions));
        RegisterType(TemplatesById.Values.SelectMany(x => x.SpawnPositionConditions));
        RegisterType(TemplatesById.Values.SelectMany(x => x.SpawnModifiers));
    }
    public static void LoadAllConfigurations()
    {
        Stopwatch stopwatch = Stopwatch.StartNew();

        SimpleConfig      = LoadSimpleConfig();
        SpawnSystemConfig = LoadSpawnSystemConfiguration();

        stopwatch.Stop();

        Log.LogInfo("Config loading took: " + stopwatch.Elapsed);
        if (stopwatch.Elapsed > TimeSpan.FromSeconds(5) &&
            ConfigurationManager.GeneralConfig?.StopTouchingMyConfigs?.Value == false)
        {
            Log.LogInfo("Long loading time detected. Consider setting \"StopTouchingMyConfigs=true\" in spawn_that.cfg to improve loading speed.");
        }
    }