mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Add "LampLight" env color variable and rename "BlockLight" to "LavaLight"
This commit is contained in:
parent
bf23984370
commit
003ad37acb
@ -69,9 +69,10 @@ namespace MCGalaxy {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[ConfigInt(null, null, -1, -1, 15)] public int Brightness;
|
[ConfigInt(null, null, -1, -1, 15)] public int Brightness;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ConfigBool] public bool UseSunBrightness;
|
[ConfigBool] public bool UseLampBrightness;
|
||||||
|
|
||||||
public BlockID GetBlock() { return Block.FromRaw(RawID); }
|
public BlockID GetBlock() { return Block.FromRaw(RawID); }
|
||||||
public void SetBlock(BlockID b) { RawID = Block.ToRaw(b); }
|
public void SetBlock(BlockID b) { RawID = Block.ToRaw(b); }
|
||||||
@ -98,7 +99,7 @@ namespace MCGalaxy {
|
|||||||
def.LeftTex = LeftTex; def.RightTex = RightTex;
|
def.LeftTex = LeftTex; def.RightTex = RightTex;
|
||||||
def.FrontTex = FrontTex; def.BackTex = BackTex;
|
def.FrontTex = FrontTex; def.BackTex = BackTex;
|
||||||
def.InventoryOrder = InventoryOrder;
|
def.InventoryOrder = InventoryOrder;
|
||||||
def.Brightness = Brightness; def.UseSunBrightness = UseSunBrightness;
|
def.Brightness = Brightness; def.UseLampBrightness = UseLampBrightness;
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,9 +293,9 @@ namespace MCGalaxy {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does not validate that the range falls within 0-15
|
/// Does not validate that the range falls within 0-15
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetBrightness(int brightness, bool sun) {
|
public void SetBrightness(int brightness, bool lamp) {
|
||||||
Brightness = brightness;
|
Brightness = brightness;
|
||||||
UseSunBrightness = sun;
|
UseLampBrightness = lamp;
|
||||||
if (Brightness > 0) { FullBright = true; } else { FullBright = false; }
|
if (Brightness > 0) { FullBright = true; } else { FullBright = false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ namespace MCGalaxy.Commands.CPE
|
|||||||
p.Message(" Order: " + def.InventoryOrder);
|
p.Message(" Order: " + def.InventoryOrder);
|
||||||
}
|
}
|
||||||
if (def.Brightness > 0) {
|
if (def.Brightness > 0) {
|
||||||
string word = def.UseSunBrightness ? "SunBrightness" : "Brightness";
|
string word = def.UseLampBrightness ? "LampBrightness" : "LavaBrightness";
|
||||||
p.Message(" {0}: {1}", word, def.Brightness);
|
p.Message(" {0}: {1}", word, def.Brightness);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -556,17 +556,17 @@ namespace MCGalaxy.Commands.CPE
|
|||||||
order == def.RawID ? "default" : order.ToString());
|
order == def.RawID ? "default" : order.ToString());
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case "brightness":
|
case "lavabrightness":
|
||||||
int brightness = 0;
|
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;
|
SendEditHelp(p, arg); return false;
|
||||||
}
|
}
|
||||||
def.SetBrightness(brightness, false);
|
def.SetBrightness(brightness, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "sunbrightness":
|
case "lampbrightness":
|
||||||
int sunBrightness = 0;
|
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;
|
SendEditHelp(p, arg); return false;
|
||||||
}
|
}
|
||||||
def.SetBrightness(sunBrightness, true);
|
def.SetBrightness(sunBrightness, true);
|
||||||
@ -883,13 +883,13 @@ namespace MCGalaxy.Commands.CPE
|
|||||||
"The default position of a block is its ID.",
|
"The default position of a block is its ID.",
|
||||||
"A position of 0 hides the block from the inventory." }
|
"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.",
|
"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.",
|
"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" }
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,10 +21,13 @@ using System.Collections.Generic;
|
|||||||
namespace MCGalaxy {
|
namespace MCGalaxy {
|
||||||
internal sealed class EnvPreset {
|
internal sealed class EnvPreset {
|
||||||
public string Fog, Sky, Clouds, Sun, Shadow;
|
public string Fog, Sky, Clouds, Sun, Shadow;
|
||||||
|
public string LavaLight = "", LampLight = "";
|
||||||
|
|
||||||
public EnvPreset(string raw) {
|
public EnvPreset(string raw) {
|
||||||
string[] args = raw.SplitSpaces();
|
string[] args = raw.SplitSpaces();
|
||||||
Fog = args[0]; Sky = args[1]; Clouds = args[2]; Sun = args[3]; Shadow = args[4];
|
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<string, string> Presets = new Dictionary<string, string>() {
|
public static Dictionary<string, string> Presets = new Dictionary<string, string>() {
|
||||||
|
@ -130,9 +130,12 @@ namespace MCGalaxy
|
|||||||
/// <summary> Color of the skybox (Hex RGB color). Set to "" to use client defaults. </summary>
|
/// <summary> Color of the skybox (Hex RGB color). Set to "" to use client defaults. </summary>
|
||||||
[ConfigString("SkyboxColor", "Env", "", true)]
|
[ConfigString("SkyboxColor", "Env", "", true)]
|
||||||
public string SkyboxColor = "";
|
public string SkyboxColor = "";
|
||||||
/// <summary> Color emitted by bright blocks (Hex RGB color). Set to "" to use client defaults. </summary>
|
/// <summary> Color emitted by bright natural blocks (Hex RGB color). Set to "" to use client defaults. </summary>
|
||||||
[ConfigString("BlockLightColor", "Env", "", true)]
|
[ConfigString("LavaLightColor", "Env", "", true)]
|
||||||
public string BlockLightColor = "";
|
public string LavaLightColor = "";
|
||||||
|
/// <summary> Color emitted by bright artificial blocks (Hex RGB color). Set to "" to use client defaults. </summary>
|
||||||
|
[ConfigString("LampLightColor", "Env", "", true)]
|
||||||
|
public string LampLightColor = "";
|
||||||
|
|
||||||
public void ResetEnv() {
|
public void ResetEnv() {
|
||||||
// TODO: Rewrite using ConfigElement somehow
|
// TODO: Rewrite using ConfigElement somehow
|
||||||
@ -152,16 +155,17 @@ namespace MCGalaxy
|
|||||||
EdgeBlock = Block.Invalid;
|
EdgeBlock = Block.Invalid;
|
||||||
ExpFog = ENV_USE_DEFAULT;
|
ExpFog = ENV_USE_DEFAULT;
|
||||||
|
|
||||||
CloudColor = "";
|
CloudColor = "";
|
||||||
FogColor = "";
|
FogColor = "";
|
||||||
SkyColor = "";
|
SkyColor = "";
|
||||||
ShadowColor = "";
|
ShadowColor = "";
|
||||||
LightColor = "";
|
LightColor = "";
|
||||||
SkyboxColor = "";
|
SkyboxColor = "";
|
||||||
BlockLightColor = "";
|
LavaLightColor = "";
|
||||||
|
LampLightColor = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
internal const int ENV_COLOR_COUNT = 6;
|
internal const int ENV_COLOR_COUNT = 7;
|
||||||
public string GetColor(int i) {
|
public string GetColor(int i) {
|
||||||
if (i == 0) return SkyColor;
|
if (i == 0) return SkyColor;
|
||||||
if (i == 1) return CloudColor;
|
if (i == 1) return CloudColor;
|
||||||
@ -169,8 +173,9 @@ namespace MCGalaxy
|
|||||||
if (i == 3) return ShadowColor;
|
if (i == 3) return ShadowColor;
|
||||||
if (i == 4) return LightColor;
|
if (i == 4) return LightColor;
|
||||||
if (i == 5) return SkyboxColor;
|
if (i == 5) return SkyboxColor;
|
||||||
if (i == 6) return BlockLightColor;
|
if (i == 6) return LavaLightColor;
|
||||||
|
if (i == 7) return LampLightColor;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,13 +42,14 @@ namespace MCGalaxy {
|
|||||||
new EnvOption("EdgeLevel", SetEdgeLevel, "&HSets the water height of the map"),
|
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("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("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("Sky", SetSky, "&HSets color of the sky (default 99CCFF)"),
|
||||||
new EnvOption("Clouds", SetClouds, "&HSets color of the clouds (default FFFFFF)"),
|
new EnvOption("Clouds", SetClouds, "&HSets color of the clouds (default FFFFFF)"),
|
||||||
new EnvOption("Fog", SetFog, "&HSets color of the fog (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("Sun", SetSun, "&HSets color of blocks in sunlight (default FFFFFF)"),
|
||||||
new EnvOption("Shadow", SetShadow, "&HSets color of blocks in darkness (default 9B9B9B)"),
|
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("Skybox", SetSkybox, "&HSets color of the skybox (default FFFFFF)"),
|
||||||
new EnvOption("BlockLight", SetBlockLight, "&HSets color cast by bright blocks (default FFEBC6)"),
|
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("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("WeatherSpeed", SetWeatherSpeed, "&HSets how fast rain/snow falls (negative falls upwards)"),
|
||||||
new EnvOption("WeatherFade", SetWeatherFade, "&HSets how quickly rain/snow fades out over distance"),
|
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("CloudSpeed")) opt = "CloudsSpeed";
|
||||||
if (opt.CaselessEq("SkyboxHor")) opt = "SkyboxHorSpeed";
|
if (opt.CaselessEq("SkyboxHor")) opt = "SkyboxHorSpeed";
|
||||||
if (opt.CaselessEq("SkyboxVer")) opt = "SkyboxVerSpeed";
|
if (opt.CaselessEq("SkyboxVer")) opt = "SkyboxVerSpeed";
|
||||||
|
if (opt.CaselessEq("lavacolor")) opt = "LavaLight";
|
||||||
|
if (opt.CaselessEq("lampcolor")) opt = "LampLight";
|
||||||
|
|
||||||
foreach (EnvOption option in Options) {
|
foreach (EnvOption option in Options) {
|
||||||
if (option.Name.CaselessEq(opt)) return option;
|
if (option.Name.CaselessEq(opt)) return option;
|
||||||
}
|
}
|
||||||
@ -118,8 +121,11 @@ namespace MCGalaxy {
|
|||||||
static void SetSkybox(Player p, string area, EnvConfig cfg, string value) {
|
static void SetSkybox(Player p, string area, EnvConfig cfg, string value) {
|
||||||
SetColor(p, value, area, "skybox color", ref cfg.SkyboxColor);
|
SetColor(p, value, area, "skybox color", ref cfg.SkyboxColor);
|
||||||
}
|
}
|
||||||
static void SetBlockLight(Player p, string area, EnvConfig cfg, string value) {
|
static void SetLavaLight(Player p, string area, EnvConfig cfg, string value) {
|
||||||
SetColor(p, value, area, "block light color", ref cfg.BlockLightColor);
|
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) {
|
static void SetCloudsSpeed(Player p, string area, EnvConfig cfg, string value) {
|
||||||
|
@ -748,10 +748,10 @@ namespace MCGalaxy.Network
|
|||||||
buffer[i++] = (byte)(def.BlocksLight ? 0 : 1);
|
buffer[i++] = (byte)(def.BlocksLight ? 0 : 1);
|
||||||
buffer[i++] = def.WalkSound;
|
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));
|
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)
|
brightness |= 1 << 7; // Insert "use modern brightness" flag (otherwise client will interpret it as either 0 or 15 lava brightness)
|
||||||
if (def.UseSunBrightness) brightness |= 1 << 6; // Insert "use sun color" flag
|
if (def.UseLampBrightness) brightness |= 1 << 6; // Insert "use lamplight color" flag
|
||||||
|
|
||||||
buffer[i++] = brightness;
|
buffer[i++] = brightness;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user