예제 #1
0
        public void LoadConfig()
        {
            if (sapi.LoadModConfig <PhysicsModConfig>("blockphysicsmod.json") == null)
            {
                SaveConfig(); return;
            }

            Config = sapi.LoadModConfig <PhysicsModConfig>("blockphysicsmod.json");
            SaveConfig();
        }
예제 #2
0
        public void GetWorldConfig()
        {
            byte[] configBytes = (sapi.WorldManager.SaveGame.GetData("ImmersionWorldGen"));
            ImmersionWorldgenConfig storedConfig = null;

            if (configBytes != null)
            {
                storedConfig = JsonUtil.FromBytes <ImmersionWorldgenConfig>(configBytes);
            }

            string wPath = Path.Combine("immersion", "worldgen.json");

            try
            {
                ImmersionWorldgenConfig config = sapi.LoadModConfig <ImmersionWorldgenConfig>(wPath);

                GenAquifers    = genAquifers = config?.genAquifers ?? true;
                GenRivers      = genRivers = config?.genRivers ?? true;
                GenPalms       = genPalms = config?.genPalms ?? true;
                GenDeepOreBits = genDeepOreBits = config?.genDeepOreBits ?? true;
            }
            catch (Exception)
            {
            }

            sapi.StoreModConfig(this, wPath);

            GenAquifers    = genAquifers = sapi.World.Config.TryGetBool("genAquifers") ?? storedConfig?.genAquifers ?? true;
            GenRivers      = genRivers = sapi.World.Config.TryGetBool("genRivers") ?? storedConfig?.genRivers ?? true;
            GenPalms       = genPalms = sapi.World.Config.TryGetBool("genPalms") ?? storedConfig?.genPalms ?? true;
            GenDeepOreBits = genDeepOreBits = sapi.World.Config.TryGetBool("genDeepOreBits") ?? storedConfig?.genDeepOreBits ?? true;

            SaveWorldConfig();
        }
예제 #3
0
 private static MeteorConfig LoadConfig(ICoreServerAPI api)
 {
     return(api.LoadModConfig <MeteorConfig>("MeteoricExpansionConfig.json"));
 }