Beispiel #1
0
        static void LoadSettings(ModSettings modSettings, ModSettingsChange change)
        {
            SettingMenuUnlock                 = modSettings.GetValue <int>("Gameplay", "MenuUnlock");
            SettingEntries                    = modSettings.GetValue <int>("Gameplay", "Entries");
            SettingSpawnItem                  = modSettings.GetBool("Gameplay", "ItemSpawning");
            SettingDefaultRotation            = modSettings.GetValue <int>("UserInterface", "DefaultMobOrientation");
            SettingAnimationUpdateDelay       = modSettings.GetValue <int>("UserInterface", "DelayBetweenAnimationFrames");
            SettingAnimate                    = modSettings.GetBool("UserInterface", "EnableAnimations");
            SettingEnableAllDirectionRotation = modSettings.GetBool("UserInterface", "EnableEightDirectionRotation");

            openMenuKeyCode = SetKeyFromText(modSettings.GetValue <string>("Controls", "Keybind"));
            InitializeUI();
        }
        static void LoadSettings(ModSettings modSettings, ModSettingsChange change)
        {
            MagicRegenType      = mod.GetSettings().GetValue <int>("Options", "RegenType");
            FlatOrPercent       = mod.GetSettings().GetValue <int>("Options", "FlatOrPercentageBased");
            TickRegenFrequency  = mod.GetSettings().GetValue <int>("Options", "TickFrequency");
            RegenAmountModifier = mod.GetSettings().GetValue <float>("Options", "RegenMulti");
            RestRegenModifier   = mod.GetSettings().GetValue <float>("Options", "RestMulti");

            EntityEffectBroker.OnNewMagicRound -= MagicRegenFlat_OnNewMagicRound;
            EntityEffectBroker.OnNewMagicRound -= MagicRegenPercent_OnNewMagicRound;

            if (MagicRegenType == 1 && FlatOrPercent == 0)
            {
                EntityEffectBroker.OnNewMagicRound += MagicRegenFlat_OnNewMagicRound;
            }
            else if (MagicRegenType == 1 && FlatOrPercent == 1)
            {
                EntityEffectBroker.OnNewMagicRound += MagicRegenPercent_OnNewMagicRound;
            }
        }
Beispiel #3
0
 private void LoadSettings(ModSettings settings, ModSettingsChange change)
 {
     AsesinoInventoryWindow.Amulet       = settings.GetString("SearchTags", "Amulet");
     AsesinoInventoryWindow.Bracelet     = settings.GetString("SearchTags", "Bracelet");
     AsesinoInventoryWindow.Bracer       = settings.GetString("SearchTags", "Bracer");
     AsesinoInventoryWindow.Ring         = settings.GetString("SearchTags", "Ring");
     AsesinoInventoryWindow.Mark         = settings.GetString("SearchTags", "Mark");
     AsesinoInventoryWindow.Crystal      = settings.GetString("SearchTags", "Crystal");
     AsesinoInventoryWindow.Head         = settings.GetString("SearchTags", "Head");
     AsesinoInventoryWindow.RightArm     = settings.GetString("SearchTags", "RightArm");
     AsesinoInventoryWindow.LeftArm      = settings.GetString("SearchTags", "LeftArm");
     AsesinoInventoryWindow.Cloak        = settings.GetString("SearchTags", "Cloak");
     AsesinoInventoryWindow.ChestArmor   = settings.GetString("SearchTags", "ChestArmor");
     AsesinoInventoryWindow.ChestClothes = settings.GetString("SearchTags", "ChestClothes");
     AsesinoInventoryWindow.RightHand    = settings.GetString("SearchTags", "RightHand");
     AsesinoInventoryWindow.LeftHand     = settings.GetString("SearchTags", "LeftHand");
     AsesinoInventoryWindow.LegsArmor    = settings.GetString("SearchTags", "LegsArmor");
     AsesinoInventoryWindow.LegsClothes  = settings.GetString("SearchTags", "LegsClothes");
     AsesinoInventoryWindow.Feet         = settings.GetString("SearchTags", "Feet");
 }
        /// <summary>
        /// Load settings and init window.
        /// </summary>
        private void LoadSettings(ModSettings settings, ModSettingsChange change)
        {
            guiDepth = settings.GetValue <int>("UiSettings", "GuiDepth");

            // General
            const string generalSection = "General";

            dungeons    = settings.GetBool(generalSection, "Dungeons");
            buildings   = settings.GetBool(generalSection, "Buildings");
            minimumWait = settings.GetInt(generalSection, "ShowForMinimum");
            pressAnyKey = settings.GetBool(generalSection, "PressAnyKey");

            // Death Screen
            const string deathScreenSection = "DeathScreen";

            deathScreen  = settings.GetBool(deathScreenSection, "Enable");
            disableVideo = settings.GetBool(deathScreenSection, "DisableVideo");

            window = new LoadingScreenWindow(settings);
            Toggle(true);
        }
        private void LoadSettings(ModSettings settings, ModSettingsChange change)
        {
            const string
                style = "Style",
                waterPlantsSection = "WaterPlants",
                grassSection       = "Grass",
                advancedSection    = "Advanced";

            options.WaterPlants = settings.GetBool(waterPlantsSection, "Enabled");
            var properties = new PrototypesProperties()
            {
                GrassHeight = settings.GetTupleFloat(grassSection, "Height"),
                GrassWidth  = settings.GetTupleFloat(grassSection, "Width"),
                NoiseSpread = settings.GetFloat(grassSection, "NoiseSpread"),
                GrassColors = new GrassColors()
                {
                    SpringHealthy       = settings.GetColor(grassSection, "SpringHealthy"),
                    SpringDry           = settings.GetColor(grassSection, "SpringDry"),
                    SummerHealty        = settings.GetColor(grassSection, "SummerHealty"),
                    SummerDry           = settings.GetColor(grassSection, "SummerDry"),
                    FallHealty          = settings.GetColor(grassSection, "FallHealty"),
                    FallDry             = settings.GetColor(grassSection, "FallDry"),
                    SeasonInterpolation = settings.GetBool(grassSection, "SeasonInterpolation")
                },
                UseGrassShader  = !settings.GetBool(style, "Billboard"),
                TextureOverride = settings.GetBool(advancedSection, "TextureOverride")
            };

            var density = new Density()
            {
                GrassThick   = settings.GetTupleInt(grassSection, "ThickDensity"),
                GrassThin    = settings.GetTupleInt(grassSection, "ThinDensity"),
                WaterPlants  = settings.GetTupleInt(waterPlantsSection, "Density"),
                DesertPlants = settings.GetTupleInt(waterPlantsSection, "DesertDensity"),
            };

            switch (settings.GetInt(style, "Stones"))
            {
            case 0:
                options.TerrainStones = false;
                break;

            case 1:
                options.TerrainStones = true;
                density.Rocks         = 2;
                break;

            case 2:
                options.TerrainStones = true;
                density.Rocks         = 4;
                break;
            }

            if (change.HasChanged(style, "Style"))
            {
                switch (settings.GetValue <int>(style, "Style"))
                {
                case 0:
                default:
                    options.GrassStyle = GrassStyle.Classic;
                    break;

                case 1:
                    options.GrassStyle = GrassStyle.Mixed;
                    break;

                case 2:
                    options.GrassStyle = GrassStyle.Full;
                    break;
                }
            }

            if (change.HasChanged(advancedSection))
            {
                options.DetailObjectDistance = settings.GetValue <int>(advancedSection, "DetailDistance");
                string detailDistanceOverride = settings.GetValue <string>(advancedSection, "DetailDistanceOverride");
                if (!string.IsNullOrWhiteSpace(detailDistanceOverride) && int.TryParse(detailDistanceOverride, out int value))
                {
                    options.DetailObjectDistance = value;
                    Debug.Log($"{this}: override detail distance with {value}", this);
                }

                options.DetailObjectDensity = settings.GetValue <float>(advancedSection, "DetailDensity");
                options.FlyingInsects       = settings.GetValue <bool>(advancedSection, "FlyingInsects");
            }

            detailPrototypesManager = new DetailPrototypesManager(mod, transform, options, properties);
            densityManager          = new DensityManager(mod, options, density);

            if (isEnabled)
            {
                RefreshTerrainDetailsAsync();
            }
        }
 static void LoadSettings(ModSettings settings, ModSettingsChange change)
 {
     instance.ScaleFactor = settings.GetFloat("Core", "ScaleFactor") / 100f;
     instance.BaseValue   = settings.GetInt("Core", "BaseValue");
     instance.RoleplayRealismItemsWeaponBalance = RoleplayRealismItemsWeaponBalanceCompatibility();
 }
        private void LoadSettings(ModSettings settings, ModSettingsChange change)
        {
            const string
                waterPlantsSection = "WaterPlants",
                grassSection       = "Grass",
                othersSection      = "Others",
                advancedSection    = "Advanced";

            // Optional details
            int waterPlantsMode = settings.GetInt(waterPlantsSection, "Mode");

            WaterPlants  = waterPlantsMode != 0;
            WinterPlants = waterPlantsMode == 2;

            // Detail prototypes settings
            var properties = new PrototypesProperties()
            {
                GrassHeight = settings.GetTupleFloat(grassSection, "Height"),
                GrassWidth  = settings.GetTupleFloat(grassSection, "Width"),
                NoiseSpread = settings.GetFloat(grassSection, "NoiseSpread"),
                GrassColors = new GrassColors()
                {
                    SpringHealthy = settings.GetColor(grassSection, "SpringHealthy"),
                    SpringDry     = settings.GetColor(grassSection, "SpringDry"),
                    SummerHealty  = settings.GetColor(grassSection, "SummerHealty"),
                    SummerDry     = settings.GetColor(grassSection, "SummerDry"),
                    FallHealty    = settings.GetColor(grassSection, "FallHealty"),
                    FallDry       = settings.GetColor(grassSection, "FallDry"),
                },
                UseGrassShader    = settings.GetInt(grassSection, "Shader") == 1,
                NoiseSpreadPlants = settings.GetFloat(waterPlantsSection, "NoiseSpread"),
                TextureOverride   = settings.GetBool(advancedSection, "TextureOverride")
            };

            // Detail prototypes density
            var density = new Density()
            {
                GrassThick   = settings.GetTupleInt(grassSection, "ThickDensity"),
                GrassThin    = settings.GetTupleInt(grassSection, "ThinDensity"),
                WaterPlants  = settings.GetTupleInt(waterPlantsSection, "Density"),
                DesertPlants = settings.GetTupleInt(waterPlantsSection, "DesertDensity"),
            };

            switch (settings.GetInt(othersSection, "Flowers"))
            {
            case 0:
                Flowers = false;
                break;

            case 1:
                Flowers         = true;
                density.Flowers = 5;
                break;

            case 2:
                Flowers         = true;
                density.Flowers = 25;
                break;

            case 3:
                Flowers         = true;
                density.Flowers = 50;
                break;
            }

            switch (settings.GetInt(othersSection, "Stones"))
            {
            case 0:
                TerrainStones = false;
                break;

            case 1:
                TerrainStones = true;
                density.Rocks = 2;
                break;

            case 2:
                TerrainStones = true;
                density.Rocks = 4;
                break;
            }

            if (change.HasChanged(grassSection, "Realistic"))
            {
                RealisticGrass = settings.GetValue <bool>(grassSection, "Realistic");
            }

            if (change.HasChanged(othersSection, "FlyingInsects"))
            {
                FlyingInsects = settings.GetValue <bool>(othersSection, "FlyingInsects");
            }

            if (change.HasChanged(advancedSection))
            {
                DetailObjectDistance = settings.GetValue <int>(advancedSection, "DetailDistance");
                DetailObjectDensity  = settings.GetValue <float>(advancedSection, "DetailDensity");
            }

            detailPrototypesManager = new DetailPrototypesManager(properties);
            densityManager          = new DensityManager(density);

            if (isEnabled)
            {
                RefreshTerrainDetailsAsync();
            }
        }