Merge branch 'master' of github.com:Hetal728/MCGalaxy

This commit is contained in:
UnknownShadow200 2016-04-14 09:50:33 +10:00
commit 1fdb33efbb
4 changed files with 24 additions and 20 deletions

View File

@ -150,18 +150,15 @@ namespace MCGalaxy.Commands
}
}
string[] args = value.Split(' ');
bool noTypeArg = value == "" || args.Length == 3;
string type = noTypeArg ? "flat" : args[args.Length - 1];
if (MapGen.IsRecognisedFormat(type)) {
Player.SendMessage(p, "Creating a new map for you: " + level);
string cmdArgs = args.Length <= 1 ? "128 64 128" : value;
if (args.Length <= 3) cmdArgs += " " + type;
Command.all.Find("newlvl").Use(p, level + " " + cmdArgs);
} else {
Player.SendMessage(p, "Invalid map type was specified.");
MapGen.PrintValidFormats(p);
}
if (value == "") value = "128 64 128 flat";
else if (value.IndexOf(' ') == -1) value = "128 64 128 " + value;
string[] args = value.TrimEnd().Split(' ');
if (args.Length == 3) value += " flat";
Player.SendMessage(p, "Creating a new map for you: " + level);
Command.all.Find("newlvl").Use(p, level + " " + value);
} else if (cmd == "PHYSICS") {
if (value == "0" || value == "1" || value == "2" || value == "3" || value == "4" || value == "5")
Command.all.Find("physics").Use(p, p.level.name + " " + value);

View File

@ -96,7 +96,7 @@ namespace MCGalaxy.Commands
MapGen.PrintValidFormats(p);
Player.SendMessage(p, "The seed is optional, and controls how the level is generated.");
Player.SendMessage(p, "If the seed is the same, the generated level will be the same.");
Player.SendMessage(p, "The seed does not do anything on flat and pixel type maps.");
Player.SendMessage(p, "For flat maps the seed (if given) is used for the grass level.");
}
}
}

View File

@ -1153,7 +1153,7 @@ txtBackupLocation.Text = folderDialog.SelectedPath;
Command[] commands = null;
using(FileDialog fileDialog = new OpenFileDialog()) {
fileDialog.RestoreDirectory = true;
fileDialog.Filter = "Accepted File Types (*.cs, *.vb, *.dll)|*.cs;*.vb;*.dll|C# Source (*.cs)|*.cs|Visual Basic Source (*.vb)|*.vb|.NET Assemblies (*.dll)|*.dll";
if ( fileDialog.ShowDialog() == DialogResult.OK ) {

View File

@ -51,12 +51,19 @@ namespace MCGalaxy {
switch (type) {
case "flat":
for (int y = 0; y <= half; ++y)
for (int z = 0; z < length; ++z)
for (int x = 0; x < width; ++x)
{
blocks[index++] = y < half ? Block.dirt : Block.grass;
} return;
int grassHeight = height / 2;
if (useSeed && seed >= 0 && seed < height) {
lvl.EdgeLevel = (short)seed;
grassHeight = seed;
}
int dirtEnd = grassHeight * width * length;
int grassEnd = (grassHeight + 1) * width * length;
for (int i = 0; i < dirtEnd; i++)
blocks[i] = Block.dirt;
for (int i = dirtEnd; i < grassEnd; i++)
blocks[i] = Block.grass;
return;
case "pixel":
for (int y = 0; y < height; ++y)
for (int z = 0; z < length; ++z)