Skip to content
Permalink
Browse files

Add skybox horizontal/vertical rotation to /env.

  • Loading branch information...
UnknownShadow200 committed Sep 27, 2017
1 parent af7baf5 commit 7b3e796d4227268bed6b6fd13ddd9f3b0b80c3c5
Showing with 38 additions and 5 deletions.
  1. +20 −5 fCraft/Commands/CpeCommands.cs
  2. +2 −0 fCraft/Network/CpeConstants.cs
  3. +8 −0 fCraft/World/World.cs
  4. +8 −0 fCraft/World/WorldManager.cs
@@ -741,7 +741,15 @@ static class CpeCommands {
"&NUse \"normal\" instead of a number to reset to default (0)." },
{ "weatherfade","&H/Env <WorldName> weatherfade <#>&N&S" +
"Sets how quickly rain/snow fades, relative to normal rate." +
"&NUse \"normal\" instead of a number to reset to default (0)." }
"&NUse \"normal\" instead of a number to reset to default (0)." },
{ "skyboxhorspeed","&H/Env <WorldName> skyoxhorspeed <#>&N&S" +
"Sets how quickly skybox rotates horizontally around." +
"&Ne.g. a value of 0.5 means it rotates 360 degrees every two seconds." +
"&NUse \"normal\" instead of a number to reset to default (0)." },
{ "skyboxverrspeed","&H/Env <WorldName> skyoxverspeed <#>&N&S" +
"Sets how quickly skybox rotates vertically around." +
"&Ne.g. a value of 0.5 means it rotates 360 degrees every two seconds." +
"&NUse \"normal\" instead of a number to reset to default (0)." },
},
Usage = "/Env <WorldName> <Variable>",
IsConsoleSafe = true,
@@ -844,10 +852,15 @@ static class CpeCommands {
SetEnvAppearanceFloat(player, world, value, EnvProp.WeatherSpeed, "weather speed",
-32767, 32767, 256, 256, ref world.WeatherSpeed);
break;
case "cloudspeed":
case "cloudsspeed":
SetEnvAppearanceFloat(player, world, value, EnvProp.CloudsSpeed, "clouds speed",
-32767, 32767, 256, 256, ref world.CloudsSpeed);
case "skyboxhorspeed":
case "skyboxhor":
SetEnvAppearanceFloat(player, world, value, EnvProp.SkyboxHorSpeed, "skybox horizontal speed",
-32767, 32767, 1024, 0, ref world.SkyboxHorSpeed);
break;
case "skyboxverspeed":
case "skyboxver":
SetEnvAppearanceFloat(player, world, value, EnvProp.SkyboxVerSpeed, "skybox vertical speed",
-32767, 32767, 1024, 0, ref world.SkyboxVerSpeed);
break;
case "horizon":
case "edge":
@@ -976,6 +989,8 @@ static class CpeCommands {
world.WeatherSpeed = 256;
world.CloudsSpeed = 256;
world.WeatherFade = 128;
world.SkyboxHorSpeed = 0;
world.SkyboxVerSpeed = 0;

Logger.Log(LogType.UserActivity,
"Env: {0} {1} reset environment settings for world {2}",
@@ -143,6 +143,8 @@ public enum EnvProp : byte {
WeatherFade = 7,
ExpFog = 8,
SidesOffset = 9,
SkyboxHorSpeed = 10,
SkyboxVerSpeed = 11,
}

public enum EntityProp : byte {
@@ -261,6 +261,8 @@ public sealed class World : IClassy {
CloudsSpeed = CloudsSpeed,
WeatherSpeed = WeatherSpeed,
WeatherFade = WeatherFade,
SkyboxHorSpeed = SkyboxHorSpeed,
SkyboxVerSpeed = SkyboxVerSpeed,
Buildable = Buildable,
Deletable = Deletable,
};
@@ -978,6 +980,12 @@ public sealed class World : IClassy {

/// <summary> Rain/Snow fade speed as seen by the player, in units of 128ths. The default value is 128 (1 speed). </summary>
public short WeatherFade = 128;

/// <summary> Skybox horizontal speed as seen by the player, in units of 1024ths. The default value is 0 (0 speed). </summary>
public short SkyboxHorSpeed = 0;

/// <summary> Skybox vertical speed as seen by the player, in units of 1024ths. The default value is 0 (0 speed). </summary>
public short SkyboxVerSpeed = 0;

/// <summary> The block which will be displayed on the horizon. </summary>
public byte HorizonBlock = (byte)Block.Water;
@@ -357,6 +357,12 @@ static void LoadWorldListEntry([NotNull] XElement el)
if ((attr = el.Attribute("weatherfade")) != null) {
world.WeatherFade = ParseShort(attr, worldName, 128, "normal rate");
}
if ((attr = el.Attribute("skyboxhorspeed")) != null) {
world.SkyboxHorSpeed = ParseShort(attr, worldName, 0, "normal speed");
}
if ((attr = el.Attribute("skyboxverspeed")) != null) {
world.SkyboxVerSpeed = ParseShort(attr, worldName, 0, "normal speed");
}

if ((attr = el.Attribute("terrain")) != null) {
world.Texture = ParseString(attr, worldName);
@@ -628,6 +634,8 @@ static void LoadWorldListEntry([NotNull] XElement el)
elEnv.Add(new XAttribute("weatherspeed", world.WeatherSpeed));
elEnv.Add(new XAttribute("cloudsspeed", world.CloudsSpeed));
elEnv.Add(new XAttribute("weatherfade", world.WeatherFade));
elEnv.Add(new XAttribute("skyboxhorspeed", world.SkyboxHorSpeed));
elEnv.Add(new XAttribute("skyboxverspeed", world.SkyboxVerSpeed));
temp.Add(elEnv);
}

0 comments on commit 7b3e796

Please sign in to comment.
You can’t perform that action at this time.