diff --git a/MCGalaxy/Blocks/BlockDefinitions.cs b/MCGalaxy/Blocks/BlockDefinitions.cs index 5ba029f21..1f34b58b1 100644 --- a/MCGalaxy/Blocks/BlockDefinitions.cs +++ b/MCGalaxy/Blocks/BlockDefinitions.cs @@ -69,9 +69,10 @@ namespace MCGalaxy { /// [ConfigInt(null, null, -1, -1, 15)] public int Brightness; /// - /// Does this block use the sun environment color for light casting? (for fancy lighting option) + /// Does this block use the lamplight environment color for light casting? (for fancy lighting option) + /// If false, uses the lavalight environment color /// - [ConfigBool] public bool UseSunBrightness; + [ConfigBool] public bool UseLampBrightness; public BlockID GetBlock() { return Block.FromRaw(RawID); } public void SetBlock(BlockID b) { RawID = Block.ToRaw(b); } @@ -98,7 +99,7 @@ namespace MCGalaxy { def.LeftTex = LeftTex; def.RightTex = RightTex; def.FrontTex = FrontTex; def.BackTex = BackTex; def.InventoryOrder = InventoryOrder; - def.Brightness = Brightness; def.UseSunBrightness = UseSunBrightness; + def.Brightness = Brightness; def.UseLampBrightness = UseLampBrightness; return def; } @@ -292,9 +293,9 @@ namespace MCGalaxy { /// /// Does not validate that the range falls within 0-15 /// - public void SetBrightness(int brightness, bool sun) { + public void SetBrightness(int brightness, bool lamp) { Brightness = brightness; - UseSunBrightness = sun; + UseLampBrightness = lamp; if (Brightness > 0) { FullBright = true; } else { FullBright = false; } } diff --git a/MCGalaxy/Commands/CPE/CustomBlockCommand.cs b/MCGalaxy/Commands/CPE/CustomBlockCommand.cs index 8e06dbc14..1fb6fa5f2 100644 --- a/MCGalaxy/Commands/CPE/CustomBlockCommand.cs +++ b/MCGalaxy/Commands/CPE/CustomBlockCommand.cs @@ -274,7 +274,7 @@ namespace MCGalaxy.Commands.CPE p.Message(" Order: " + def.InventoryOrder); } if (def.Brightness > 0) { - string word = def.UseSunBrightness ? "SunBrightness" : "Brightness"; + string word = def.UseLampBrightness ? "LampBrightness" : "LavaBrightness"; p.Message(" {0}: {1}", word, def.Brightness); } } @@ -556,17 +556,17 @@ namespace MCGalaxy.Commands.CPE order == def.RawID ? "default" : order.ToString()); return true; - case "brightness": + case "lavabrightness": int brightness = 0; - if (!CommandParser.GetInt(p, value, "brightness", ref brightness, 0, 15)) { + if (!CommandParser.GetInt(p, value, "lavabrightness", ref brightness, 0, 15)) { SendEditHelp(p, arg); return false; } def.SetBrightness(brightness, false); break; - case "sunbrightness": + case "lampbrightness": int sunBrightness = 0; - if (!CommandParser.GetInt(p, value, "sunbrightness", ref sunBrightness, 0, 15)) { + if (!CommandParser.GetInt(p, value, "lampbrightness", ref sunBrightness, 0, 15)) { SendEditHelp(p, arg); return false; } def.SetBrightness(sunBrightness, true); @@ -883,13 +883,13 @@ namespace MCGalaxy.Commands.CPE "The default position of a block is its ID.", "A position of 0 hides the block from the inventory." } }, - { "brightness", new string[] { "Type a number (0-15) for the brightness of the block.", + { "lavabrightness", new string[] { "Type a number (0-15) for the lava brightness of the block.", "You need Fancy Lighting to see differences between 1 and 15.", - "The block will glow using the \"blocklight\" env color" } + "The block will glow using the \"lavalight\" env color" } }, - { "sunbrightness", new string[] { "Type a number (0-15) for the sun-brightness of the block.", + { "lampbrightness", new string[] { "Type a number (0-15) for the lamp brightness of the block.", "You need Fancy Lighting to see differences between 1 and 15.", - "The block will glow using the \"sun\" env color" } + "The block will glow using the \"lamplight\" env color" } }, }; diff --git a/MCGalaxy/Levels/EnvPreset.cs b/MCGalaxy/Levels/EnvPreset.cs index a2b893da6..9282aadd7 100644 --- a/MCGalaxy/Levels/EnvPreset.cs +++ b/MCGalaxy/Levels/EnvPreset.cs @@ -21,10 +21,13 @@ using System.Collections.Generic; namespace MCGalaxy { internal sealed class EnvPreset { public string Fog, Sky, Clouds, Sun, Shadow; + public string LavaLight = "", LampLight = ""; public EnvPreset(string raw) { string[] args = raw.SplitSpaces(); Fog = args[0]; Sky = args[1]; Clouds = args[2]; Sun = args[3]; Shadow = args[4]; + LavaLight = args.Length > 5 ? args[5] : ""; + LampLight = args.Length > 6 ? args[6] : ""; } public static Dictionary Presets = new Dictionary() { diff --git a/MCGalaxy/Levels/LevelConfig.cs b/MCGalaxy/Levels/LevelConfig.cs index 26e724e47..0ed08ec03 100644 --- a/MCGalaxy/Levels/LevelConfig.cs +++ b/MCGalaxy/Levels/LevelConfig.cs @@ -130,9 +130,12 @@ namespace MCGalaxy /// Color of the skybox (Hex RGB color). Set to "" to use client defaults. [ConfigString("SkyboxColor", "Env", "", true)] public string SkyboxColor = ""; - /// Color emitted by bright blocks (Hex RGB color). Set to "" to use client defaults. - [ConfigString("BlockLightColor", "Env", "", true)] - public string BlockLightColor = ""; + /// Color emitted by bright natural blocks (Hex RGB color). Set to "" to use client defaults. + [ConfigString("LavaLightColor", "Env", "", true)] + public string LavaLightColor = ""; + /// Color emitted by bright artificial blocks (Hex RGB color). Set to "" to use client defaults. + [ConfigString("LampLightColor", "Env", "", true)] + public string LampLightColor = ""; public void ResetEnv() { // TODO: Rewrite using ConfigElement somehow @@ -152,16 +155,17 @@ namespace MCGalaxy EdgeBlock = Block.Invalid; ExpFog = ENV_USE_DEFAULT; - CloudColor = ""; - FogColor = ""; - SkyColor = ""; - ShadowColor = ""; - LightColor = ""; - SkyboxColor = ""; - BlockLightColor = ""; + CloudColor = ""; + FogColor = ""; + SkyColor = ""; + ShadowColor = ""; + LightColor = ""; + SkyboxColor = ""; + LavaLightColor = ""; + LampLightColor = ""; } - internal const int ENV_COLOR_COUNT = 6; + internal const int ENV_COLOR_COUNT = 7; public string GetColor(int i) { if (i == 0) return SkyColor; if (i == 1) return CloudColor; @@ -169,8 +173,9 @@ namespace MCGalaxy if (i == 3) return ShadowColor; if (i == 4) return LightColor; if (i == 5) return SkyboxColor; - if (i == 6) return BlockLightColor; - + if (i == 6) return LavaLightColor; + if (i == 7) return LampLightColor; + return null; } diff --git a/MCGalaxy/Levels/LevelEnv.cs b/MCGalaxy/Levels/LevelEnv.cs index 9dd9de7eb..2352d75b1 100644 --- a/MCGalaxy/Levels/LevelEnv.cs +++ b/MCGalaxy/Levels/LevelEnv.cs @@ -42,13 +42,14 @@ namespace MCGalaxy { new EnvOption("EdgeLevel", SetEdgeLevel, "&HSets the water height of the map"), new EnvOption("SidesOffset", SetSidesOffset, "&HSets offset of bedrock from water (default -2)"), new EnvOption("MaxFog", SetMaxFog, "&HSets maximum fog distance in the map (e.g. 16 for a horror map)"), - new EnvOption("Sky", SetSky, "&HSets color of the sky (default 99CCFF)"), - new EnvOption("Clouds", SetClouds, "&HSets color of the clouds (default FFFFFF)"), - new EnvOption("Fog", SetFog, "&HSets color of the fog (default FFFFFF)"), - new EnvOption("Sun", SetSun, "&HSets color of blocks in sunlight (default FFFFFF)"), - new EnvOption("Shadow", SetShadow, "&HSets color of blocks in darkness (default 9B9B9B)"), - new EnvOption("Skybox", SetSkybox, "&HSets color of the skybox (default FFFFFF)"), - new EnvOption("BlockLight", SetBlockLight, "&HSets color cast by bright blocks (default FFEBC6)"), + new EnvOption("Sky", SetSky, "&HSets color of the sky (default 99CCFF)"), + new EnvOption("Clouds", SetClouds, "&HSets color of the clouds (default FFFFFF)"), + new EnvOption("Fog", SetFog, "&HSets color of the fog (default FFFFFF)"), + new EnvOption("Sun", SetSun, "&HSets color of blocks in sunlight (default FFFFFF)"), + new EnvOption("Shadow", SetShadow, "&HSets color of blocks in darkness (default 9B9B9B)"), + new EnvOption("Skybox", SetSkybox, "&HSets color of the skybox (default FFFFFF)"), + new EnvOption("LavaLight", SetLavaLight, "&HSets color cast by bright natural blocks when fancy lighting is enabled (default FFEBC6)"), + new EnvOption("LampLight", SetLampLight, "&HSets color cast by bright artificial blocks when fancy lighting is enabled (default FFFFFF)"), new EnvOption("CloudsSpeed", SetCloudsSpeed, "&HSets how fast clouds move (negative moves in opposite direction)"), new EnvOption("WeatherSpeed", SetWeatherSpeed, "&HSets how fast rain/snow falls (negative falls upwards)"), new EnvOption("WeatherFade", SetWeatherFade, "&HSets how quickly rain/snow fades out over distance"), @@ -72,7 +73,9 @@ namespace MCGalaxy { if (opt.CaselessEq("CloudSpeed")) opt = "CloudsSpeed"; if (opt.CaselessEq("SkyboxHor")) opt = "SkyboxHorSpeed"; if (opt.CaselessEq("SkyboxVer")) opt = "SkyboxVerSpeed"; - + if (opt.CaselessEq("lavacolor")) opt = "LavaLight"; + if (opt.CaselessEq("lampcolor")) opt = "LampLight"; + foreach (EnvOption option in Options) { if (option.Name.CaselessEq(opt)) return option; } @@ -118,8 +121,11 @@ namespace MCGalaxy { static void SetSkybox(Player p, string area, EnvConfig cfg, string value) { SetColor(p, value, area, "skybox color", ref cfg.SkyboxColor); } - static void SetBlockLight(Player p, string area, EnvConfig cfg, string value) { - SetColor(p, value, area, "block light color", ref cfg.BlockLightColor); + static void SetLavaLight(Player p, string area, EnvConfig cfg, string value) { + SetColor(p, value, area, "block lava light color", ref cfg.LavaLightColor); + } + static void SetLampLight(Player p, string area, EnvConfig cfg, string value) { + SetColor(p, value, area, "block lamp light color", ref cfg.LampLightColor); } static void SetCloudsSpeed(Player p, string area, EnvConfig cfg, string value) { diff --git a/MCGalaxy/Network/Packets/Packet.cs b/MCGalaxy/Network/Packets/Packet.cs index b8e52ee36..f7b0b1ae1 100644 --- a/MCGalaxy/Network/Packets/Packet.cs +++ b/MCGalaxy/Network/Packets/Packet.cs @@ -748,10 +748,10 @@ namespace MCGalaxy.Network buffer[i++] = (byte)(def.BlocksLight ? 0 : 1); buffer[i++] = def.WalkSound; - // 0b_US--_LLLL where U = uses modern brightness, S = uses sun brightness, and L = brightness */ + // 0b_US--_LLLL where U = uses modern brightness, S = uses lamplight color, and L = brightness */ byte brightness = (byte)Math.Max(0, Math.Min(def.Brightness, 15)); - brightness |= 1 << 7; // Insert "use modern brightness" flag (otherwise client will interpret it as either 0 or 15 brightness) - if (def.UseSunBrightness) brightness |= 1 << 6; // Insert "use sun color" flag + brightness |= 1 << 7; // Insert "use modern brightness" flag (otherwise client will interpret it as either 0 or 15 lava brightness) + if (def.UseLampBrightness) brightness |= 1 << 6; // Insert "use lamplight color" flag buffer[i++] = brightness; }