mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-09 23:29:18 -04:00
add expfog to /env
This commit is contained in:
parent
5868869dbd
commit
de455d17a8
@ -55,8 +55,6 @@ namespace MCGalaxy.Gui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DateTime startTime = DateTime.UtcNow;
|
DateTime startTime = DateTime.UtcNow;
|
||||||
CheckDuplicateProcesses();
|
|
||||||
|
|
||||||
Logger.Init();
|
Logger.Init();
|
||||||
AppDomain.CurrentDomain.UnhandledException += GlobalExHandler;
|
AppDomain.CurrentDomain.UnhandledException += GlobalExHandler;
|
||||||
Application.ThreadException += ThreadExHandler;
|
Application.ThreadException += ThreadExHandler;
|
||||||
@ -160,17 +158,6 @@ namespace MCGalaxy.Gui {
|
|||||||
if (Server.restartOnError)
|
if (Server.restartOnError)
|
||||||
App.ExitProgram(true);
|
App.ExitProgram(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CheckDuplicateProcesses() {
|
|
||||||
Process[] duplicates = Process.GetProcessesByName("MCGalaxy");
|
|
||||||
if (duplicates.Length == 1) return;
|
|
||||||
|
|
||||||
Process proc = Process.GetCurrentProcess();
|
|
||||||
foreach (Process pr in duplicates) {
|
|
||||||
if (pr.MainModule.BaseAddress == proc.MainModule.BaseAddress)
|
|
||||||
if (pr.Id != proc.Id) pr.Kill();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,9 @@ namespace MCGalaxy.Commands {
|
|||||||
case "bedrock":
|
case "bedrock":
|
||||||
LevelEnv.SetBlock(p, value, EnvProp.SidesBlock,
|
LevelEnv.SetBlock(p, value, EnvProp.SidesBlock,
|
||||||
"sides block", Block.blackrock, ref lvl.EdgeBlock); break;
|
"sides block", Block.blackrock, ref lvl.EdgeBlock); break;
|
||||||
|
case "expfog":
|
||||||
|
LevelEnv.SetBool(p, value, EnvProp.ExpFog,
|
||||||
|
"exp fog", false, ref lvl.ExpFog); break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -201,7 +204,7 @@ namespace MCGalaxy.Commands {
|
|||||||
Player.Message(p, "%T/env [variable] [value]");
|
Player.Message(p, "%T/env [variable] [value]");
|
||||||
Player.Message(p, "%HVariables: fog, cloud, sky, sun, shadow, weather, level");
|
Player.Message(p, "%HVariables: fog, cloud, sky, sun, shadow, weather, level");
|
||||||
Player.Message(p, "%H horizon, border, preset, maxfog, cloudsheight");
|
Player.Message(p, "%H horizon, border, preset, maxfog, cloudsheight");
|
||||||
Player.Message(p, "%H cloudspeed, weatherspeed, weatherfade");
|
Player.Message(p, "%H cloudspeed, weatherspeed, weatherfade, expfog");
|
||||||
Player.Message(p, "%HUsing 'normal' as a value will reset the variable");
|
Player.Message(p, "%HUsing 'normal' as a value will reset the variable");
|
||||||
Player.Message(p, "%T/env normal %H- resets all variables");
|
Player.Message(p, "%T/env normal %H- resets all variables");
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace MCGalaxy.Commands {
|
|||||||
Player.Message(p, "Cannot use %T/{0} %Swhile muted.", cmd); return false;
|
Player.Message(p, "Cannot use %T/{0} %Swhile muted.", cmd); return false;
|
||||||
}
|
}
|
||||||
if (Server.chatmod && !p.voice) {
|
if (Server.chatmod && !p.voice) {
|
||||||
Player.Message(p, "Cannot use %T/{0} %Swhile chat moderation is on.", cmd); return false;
|
Player.Message(p, "Cannot use %T/{0} %Swhile chat moderation is on without %T/voice%S.", cmd); return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ namespace MCGalaxy.Levels.IO {
|
|||||||
lvl.roty = header[offset + 11];
|
lvl.roty = header[offset + 11];
|
||||||
|
|
||||||
gs.Read(lvl.blocks, 0, lvl.blocks.Length);
|
gs.Read(lvl.blocks, 0, lvl.blocks.Length);
|
||||||
ReadBlockDefsSection(lvl, gs);
|
ReadCustomBlocksSection(lvl, gs);
|
||||||
|
|
||||||
if (!metadata) return lvl;
|
if (!metadata) return lvl;
|
||||||
ReadPhysicsSection(lvl, gs);
|
ReadPhysicsSection(lvl, gs);
|
||||||
@ -76,7 +76,7 @@ namespace MCGalaxy.Levels.IO {
|
|||||||
return dims;
|
return dims;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ReadBlockDefsSection(Level lvl, Stream gs) {
|
static void ReadCustomBlocksSection(Level lvl, Stream gs) {
|
||||||
if (gs.ReadByte() != 0xBD) return;
|
if (gs.ReadByte() != 0xBD) return;
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
@ -144,6 +144,9 @@ namespace MCGalaxy {
|
|||||||
/// <summary> The block which will be displayed on the edge of the map. </summary>
|
/// <summary> The block which will be displayed on the edge of the map. </summary>
|
||||||
[ConfigInt("EdgeBlock", "Env", null, Block.blackrock, 0, 255)]
|
[ConfigInt("EdgeBlock", "Env", null, Block.blackrock, 0, 255)]
|
||||||
public int EdgeBlock = Block.blackrock;
|
public int EdgeBlock = Block.blackrock;
|
||||||
|
/// <summary> Whether exponential fog mode is used client-side. </summary>
|
||||||
|
[ConfigBool("ExpFog", "Env", null, false)]
|
||||||
|
public bool ExpFog = false;
|
||||||
|
|
||||||
|
|
||||||
// Permission settings
|
// Permission settings
|
||||||
|
@ -93,6 +93,25 @@ namespace MCGalaxy {
|
|||||||
UpdateEnvColor(p, envType, value);
|
UpdateEnvColor(p, envType, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetBool(Player p, string value, EnvProp prop,
|
||||||
|
string variable, bool defValue, ref bool target) {
|
||||||
|
if (IsResetString(value)) {
|
||||||
|
Player.Message(p, "Reset {0} for {1} %Sto normal", variable, p.level.ColoredName);
|
||||||
|
target = defValue;
|
||||||
|
} else if (value.CaselessEq("yes") || value.CaselessEq("on")) {
|
||||||
|
Player.Message(p, "Set {0} for {1} %Sto &aON", variable, p.level.ColoredName);
|
||||||
|
target = true;
|
||||||
|
} else if (value.CaselessEq("no") || value.CaselessEq("off")) {
|
||||||
|
Player.Message(p, "Set {0} for {1} %Sto &cOFF", variable, p.level.ColoredName);
|
||||||
|
target = false;
|
||||||
|
} else {
|
||||||
|
Player.Message(p, "Env: \"{0}\" is not a valid boolean.", value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SendCurrentMapAppearance(p.level, prop, target ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool CheckBlock(Player p, string value, string variable, ref int modify) {
|
static bool CheckBlock(Player p, string value, string variable, ref int modify) {
|
||||||
byte extBlock = 0;
|
byte extBlock = 0;
|
||||||
byte block = (byte)DrawCmd.GetBlock(p, value, out extBlock);
|
byte block = (byte)DrawCmd.GetBlock(p, value, out extBlock);
|
||||||
|
@ -179,6 +179,7 @@ namespace MCGalaxy {
|
|||||||
Send(Packet.EnvMapProperty(EnvProp.MaxFog, level.MaxFogDistance));
|
Send(Packet.EnvMapProperty(EnvProp.MaxFog, level.MaxFogDistance));
|
||||||
Send(Packet.EnvMapProperty(EnvProp.CloudsSpeed, level.CloudsSpeed));
|
Send(Packet.EnvMapProperty(EnvProp.CloudsSpeed, level.CloudsSpeed));
|
||||||
Send(Packet.EnvMapProperty(EnvProp.WeatherSpeed, level.WeatherSpeed));
|
Send(Packet.EnvMapProperty(EnvProp.WeatherSpeed, level.WeatherSpeed));
|
||||||
|
Send(Packet.EnvMapProperty(EnvProp.ExpFog, level.ExpFog ? 1 : 0));
|
||||||
} else if (HasCpeExt(CpeExt.EnvMapAppearance, 2)) {
|
} else if (HasCpeExt(CpeExt.EnvMapAppearance, 2)) {
|
||||||
string url = GetTextureUrl();
|
string url = GetTextureUrl();
|
||||||
// reset all other textures back to client default.
|
// reset all other textures back to client default.
|
||||||
@ -293,6 +294,6 @@ namespace MCGalaxy {
|
|||||||
public enum EnvProp : byte {
|
public enum EnvProp : byte {
|
||||||
SidesBlock = 0, EdgeBlock = 1, EdgeLevel = 2,
|
SidesBlock = 0, EdgeBlock = 1, EdgeLevel = 2,
|
||||||
CloudsLevel = 3, MaxFog = 4, CloudsSpeed = 5,
|
CloudsLevel = 3, MaxFog = 4, CloudsSpeed = 5,
|
||||||
WeatherSpeed = 6, WeatherFade = 7,
|
WeatherSpeed = 6, WeatherFade = 7, ExpFog = 8,
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user