mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Add skybox horizontal/vertical rotation to /env.
This commit is contained in:
parent
13d78d9d2e
commit
42b232d480
@ -18,6 +18,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using MCGalaxy.Commands.Building;
|
||||
using MCGalaxy.Network;
|
||||
|
||||
namespace MCGalaxy.Commands.CPE {
|
||||
public sealed class CmdEnvironment : Command {
|
||||
@ -90,6 +91,12 @@ namespace MCGalaxy.Commands.CPE {
|
||||
} else if (opt == "expfog") {
|
||||
LevelEnv.SetBool(p, value, EnvProp.ExpFog,
|
||||
"exp fog", false, ref lvl.Config.ExpFog);
|
||||
} else if (opt == "skyboxhorspeed" || opt == "skyboxhor") {
|
||||
LevelEnv.SetFloat(p, value, EnvProp.SkyboxHorSpeed, 1024, "skybox horizontal speed",
|
||||
0, ref lvl.Config.SkyboxHorSpeed, -32767, 32767);
|
||||
} else if (opt == "skyboxverspeed" || opt == "skyboxver") {
|
||||
LevelEnv.SetFloat(p, value, EnvProp.SkyboxVerSpeed, 1024, "skybox vertical speed",
|
||||
0, ref lvl.Config.SkyboxVerSpeed, -32767, 32767);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -99,20 +106,32 @@ namespace MCGalaxy.Commands.CPE {
|
||||
|
||||
static void ResetEnv(Player p) {
|
||||
Level lvl = p.level;
|
||||
LevelConfig cfg = lvl.Config;
|
||||
SetPreset(p, "normal");
|
||||
LevelEnv.SetWeather(p, lvl, "normal");
|
||||
|
||||
LevelEnv.SetBlock(p, "normal", EnvProp.EdgeBlock,
|
||||
"edge block", Block.Water, ref lvl.Config.HorizonBlock);
|
||||
LevelEnv.SetBlock(p, "normal", EnvProp.SidesBlock,
|
||||
"sides block", Block.Bedrock, ref lvl.Config.EdgeBlock);
|
||||
|
||||
LevelEnv.SetShort(p, "normal", EnvProp.EdgeLevel,
|
||||
"water level", (short)(lvl.Height / 2), ref lvl.Config.EdgeLevel);
|
||||
LevelEnv.SetShort(p, "normal", EnvProp.SidesOffset,
|
||||
"bedrock offset", -2, ref lvl.Config.SidesOffset);
|
||||
LevelEnv.SetShort(p, "normal", EnvProp.CloudsLevel,
|
||||
"clouds height", (short)(lvl.Height + 2), ref lvl.Config.CloudsHeight);
|
||||
cfg.Weather = 0;
|
||||
cfg.CloudsHeight = (short)(lvl.Height + 2);
|
||||
cfg.EdgeLevel = (short)(lvl.Height / 2);
|
||||
cfg.SidesOffset = -2;
|
||||
cfg.MaxFogDistance = 0;
|
||||
cfg.CloudsSpeed = 256;
|
||||
cfg.WeatherSpeed = 256;
|
||||
cfg.WeatherFade = 128;
|
||||
cfg.EdgeBlock = Block.Bedrock;
|
||||
cfg.HorizonBlock = Block.Water;
|
||||
cfg.ExpFog = false;
|
||||
cfg.SkyboxHorSpeed = 0;
|
||||
cfg.SkyboxVerSpeed = 0;
|
||||
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player pl in players) {
|
||||
if (pl.level != lvl) continue;
|
||||
pl.SendCurrentMapAppearance();
|
||||
|
||||
if (pl.Supports(CpeExt.EnvWeatherType)) {
|
||||
pl.Send(Packet.EnvWeatherType(0));
|
||||
}
|
||||
}
|
||||
Level.SaveSettings(lvl);
|
||||
}
|
||||
|
||||
static bool SetPreset(Player p, string value) {
|
||||
@ -181,9 +200,10 @@ namespace MCGalaxy.Commands.CPE {
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/Environment [variable] [value]");
|
||||
Player.Message(p, "%HVariables: fog, cloud, sky, sun, shadow, weather, level");
|
||||
Player.Message(p, "%H horizon, border, preset, maxfog, cloudsheight");
|
||||
Player.Message(p, "%H cloudspeed, weatherspeed, weatherfade, expfog, sidesoffset");
|
||||
Player.Message(p, "%HVariables: fog, cloud, sky, sun, shadow, weather, level,");
|
||||
Player.Message(p, "%H horizon, border, preset, maxfog, cloudsheight, cloudspeed,");
|
||||
Player.Message(p, "%H weatherspeed, weatherfade, expfog, sidesoffset,");
|
||||
Player.Message(p, "%H skyboxhorspeed, skyboxverspeed");
|
||||
Player.Message(p, "%HUsing 'normal' as a value will reset the variable");
|
||||
Player.Message(p, "%T/Environment normal %H- resets all variables");
|
||||
}
|
||||
|
@ -94,6 +94,13 @@ namespace MCGalaxy {
|
||||
/// <summary> Weather fade, in units of 256ths. Default is 256 (1 speed). </summary>
|
||||
[ConfigInt("weather-fade", "Env", 128, short.MinValue, short.MaxValue)]
|
||||
public int WeatherFade = 128;
|
||||
/// <summary> Skybox horizontal speed, in units of 1024ths. Default is 0 (0 speed). </summary>
|
||||
[ConfigInt("skybox-hor-speed", "Env", 0, short.MinValue, short.MaxValue)]
|
||||
public int SkyboxHorSpeed = 0;
|
||||
/// <summary> Skybox vertical speed, in units of 1024ths. Default is 0 (0 speed). </summary>
|
||||
[ConfigInt("skybox-ver-speed", "Env", 0, short.MinValue, short.MaxValue)]
|
||||
public int SkyboxVerSpeed = 0;
|
||||
|
||||
/// <summary> The block which will be displayed on the horizon. </summary>
|
||||
[ConfigByte("HorizonBlock", "Env", Block.Water)]
|
||||
public byte HorizonBlock = Block.Water;
|
||||
|
@ -146,11 +146,11 @@ namespace MCGalaxy {
|
||||
return false;
|
||||
} else if (value < min || value > max) {
|
||||
Player.Message(p, "Env: \"{0}\" must be between {1} and {2}.",
|
||||
value, min.ToString("F2"), max.ToString("F2"));
|
||||
value, min.ToString("F4"), max.ToString("F4"));
|
||||
return false;
|
||||
} else {
|
||||
modify = (int)(value * scale);
|
||||
Player.Message(p, "Set {0} for {1} %Sto {2}", variable, p.level.ColoredName, value.ToString("F2"));
|
||||
Player.Message(p, "Set {0} for {1} %Sto {2}", variable, p.level.ColoredName, value.ToString("F4"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ namespace MCGalaxy {
|
||||
SidesBlock = 0, EdgeBlock = 1, EdgeLevel = 2,
|
||||
CloudsLevel = 3, MaxFog = 4, CloudsSpeed = 5,
|
||||
WeatherSpeed = 6, WeatherFade = 7, ExpFog = 8,
|
||||
SidesOffset = 9,
|
||||
SidesOffset = 9, SkyboxHorSpeed = 10, SkyboxVerSpeed = 11,
|
||||
}
|
||||
|
||||
public enum EntityProp : byte {
|
||||
|
Loading…
x
Reference in New Issue
Block a user