public static void LoadupEnvPreset(World world, string name) { EnvPresets preset = Find(name); world.SkyColor = preset.SkyColor; world.CloudColor = preset.CloudColor; world.FogColor = preset.FogColor; world.ShadowColor = preset.ShadowColor; world.LightColor = preset.LightColor; world.Texture = preset.TextureURL; Block Border, Horizon; Map.GetBlockByName(world, preset.BorderBlock.ToString(), false, out Border); if (Border == Block.None) { Border = Block.Admincrete; } Map.GetBlockByName(world, preset.HorizonBlock.ToString(), false, out Horizon); if (Horizon == Block.None) { Horizon = Block.Water; } world.EdgeBlock = (byte)Border; world.HorizonBlock = (byte)Horizon; world.EdgeLevel = preset.HorizonLevel; world.SidesOffset = preset.SidesOffset; world.CloudsHeight = preset.CloudLevel; world.MaxFogDistance = preset.MaxViewDistance; world.Weather = preset.WeatherType; foreach (Player p in world.Players) { p.SendEnvSettings(); } WorldManager.SaveWorldList(); }
public static void CreateEnvPreset(World world, string name) { EnvPresets preset = new EnvPresets(); preset.Name = name.ToLower(); preset.SkyColor = world.SkyColor; preset.CloudColor = world.CloudColor; preset.FogColor = world.FogColor; preset.ShadowColor = world.ShadowColor; preset.LightColor = world.LightColor; preset.TextureURL = world.Texture; preset.BorderBlock = (byte)world.EdgeBlock; preset.HorizonBlock = (byte)world.HorizonBlock; preset.HorizonLevel = (world.EdgeLevel == world.map.Height / 2 ? (short)-1 : world.EdgeLevel); preset.SidesOffset = world.SidesOffset; preset.CloudLevel = (world.CloudsHeight == world.map.Height + 2 ? short.MinValue : world.CloudsHeight); preset.MaxViewDistance = world.MaxFogDistance; preset.WeatherType = world.Weather; preset.CloudsSpeed = world.CloudsSpeed; preset.WeatherFade = world.WeatherFade; preset.WeatherSpeed = world.WeatherSpeed; preset.SkyboxHorSpeed = world.SkyboxHorSpeed; preset.SkyboxVerSpeed = world.SkyboxVerSpeed; Presets.Add(preset); SaveAll(); }
public static void RemoveEnvPreset(string name) { EnvPresets preset = Find(name); if (preset != null) { Presets.Remove(preset); } }