Cleanup /draw.

This commit is contained in:
UnknownShadow200 2016-01-04 11:50:54 +11:00
parent 3bebd876b5
commit 321ce469e6
3 changed files with 196 additions and 511 deletions

View File

@ -14,7 +14,7 @@
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses. permissions and limitations under the Licenses.
*/ */
using System; using System;
namespace MCGalaxy.Commands namespace MCGalaxy.Commands
{ {
@ -27,379 +27,151 @@ namespace MCGalaxy.Commands
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } } public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
public CmdDraw() { } public CmdDraw() { }
public override void Use(Player p, string message) public override void Use(Player p, string message) {
{ if (p == null) {
int height; Player.SendMessage(p, "This command can only be used in-game!"); return;
int radius;
if (p != null)
{
if (p.level.permissionbuild > p.group.Permission)
{
p.SendMessage("You can not edit this map.");
return;
} }
string[] message2 = message.Split(' '); if (p.level.permissionbuild > p.group.Permission) {
p.SendMessage("You can not edit this map."); return;
#region cones
if (message2[0].ToLower() == "cone")
{
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; }
if (message2.Length != 3)
goto Help;
try
{
height = Convert.ToUInt16(message2[1].Trim());
radius = Convert.ToUInt16(message2[2].Trim());
p.BcVar = new int[2] { height, radius };
}
catch
{
goto Help;
} }
p.SendMessage("Place a block"); string[] parts = message.Split(' ');
Player.BlockchangeEventHandler newHandler = null;
bool help;
switch (parts[0].ToLower()) {
case "cone":
if (!CheckTwoArgs(p, 1, parts, out help)) { if (help) Help(p); return; }
newHandler = new Player.BlockchangeEventHandler(BlockchangeCone); break;
case "hcone":
if (!CheckTwoArgs(p, 1, parts, out help)) { if (help) Help(p); return; }
newHandler = new Player.BlockchangeEventHandler(BlockchangeHCone); break;
case "icone":
if (!CheckTwoArgs(p, 1, parts, out help)) { if (help) Help(p); return; }
newHandler = new Player.BlockchangeEventHandler(BlockchangeICone); break;
case "hicone":
if (!CheckTwoArgs(p, 1, parts, out help)) { if (help) Help(p); return; }
newHandler = new Player.BlockchangeEventHandler(BlockchangeHICone); break;
case "pyramid":
if (!CheckTwoArgs(p, 2, parts, out help)) { if (help) Help(p); return; }
newHandler = new Player.BlockchangeEventHandler(BlockchangePyramid); break;
case "hpyramid":
if (!CheckTwoArgs(p, 2, parts, out help)) { if (help) Help(p); return; }
newHandler = new Player.BlockchangeEventHandler(BlockchangeHPyramid); break;
case "ipyramid":
if (!CheckTwoArgs(p, 2, parts, out help)) { if (help) Help(p); return; }
newHandler = new Player.BlockchangeEventHandler(BlockchangeIPyramid); break;
case "hipyramid":
if (!CheckTwoArgs(p, 2, parts, out help)) { if (help) Help(p); return; }
newHandler = new Player.BlockchangeEventHandler(BlockchangeHIPyramid); break;
case "sphere":
if (!CheckOneArg(p, 3, parts, out help)) { if (help) Help(p); return; }
newHandler = new Player.BlockchangeEventHandler(BlockchangeSphere); break;
case "hsphere":
if (!CheckOneArg(p, 3, parts, out help)) { if (help) Help(p); return; }
newHandler = new Player.BlockchangeEventHandler(BlockchangeHSphere); break;
case "volcano":
if (!CheckTwoArgs(p, 4, parts, out help)) { if (help) Help(p); return; }
newHandler = new Player.BlockchangeEventHandler(BlockchangeVolcano); break;
}
Player.SendMessage(p, "Place a block");
p.ClearBlockchange(); p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeCone); p.Blockchange += newHandler;
return;
}
if (message2[0].ToLower() == "hcone")
{
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; }
if (message2.Length != 3)
goto Help;
try
{
height = Convert.ToUInt16(message2[1].Trim());
radius = Convert.ToUInt16(message2[2].Trim());
p.BcVar = new int[2] { height, radius };
}
catch
{
goto Help;
} }
p.SendMessage("Place a block"); bool CheckTwoArgs(Player p, int addition, string[] parts, out bool help) {
p.ClearBlockchange(); if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, addition)) {
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHCone); Group group = Group.findPermInt(CommandOtherPerms.GetPerm(this, addition));
Player.SendMessage(p, "That commands addition is for " + group.name + "+");
return; help = false; return false;
} }
if (message2[0].ToLower() == "icone") help = true;
{ if (parts.Length != 3)
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; } return false;
if (message2.Length != 3) ushort height, radius;
goto Help; if (!ushort.TryParse(parts[1], out height) || !ushort.TryParse(parts[2], out radius))
return false;
try p.BcVar = new int[] { height, radius };
{ return true;
height = Convert.ToUInt16(message2[1].Trim());
radius = Convert.ToUInt16(message2[2].Trim());
p.BcVar = new int[2] { height, radius };
}
catch
{
goto Help;
} }
p.SendMessage("Place a block"); bool CheckOneArg(Player p, int addition, string[] parts, out bool help) {
p.ClearBlockchange(); if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, addition)) {
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeICone); Group group = Group.findPermInt(CommandOtherPerms.GetPerm(this, addition));
Player.SendMessage(p, "That commands addition is for " + group.name + "+");
return; help = false; return false;
}
if (message2[0].ToLower() == "hicone")
{
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; }
if (message2.Length != 3)
goto Help;
try
{
height = Convert.ToUInt16(message2[1].Trim());
radius = Convert.ToUInt16(message2[2].Trim());
p.BcVar = new int[2] { height, radius };
}
catch
{
goto Help;
} }
p.SendMessage("Place a block"); help = true;
p.ClearBlockchange(); if (parts.Length != 2)
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHICone); return false;
ushort radius;
return; if (!ushort.TryParse(parts[1], out radius))
} return false;
#endregion p.BcVar = new int[] { 0, radius };
#region pyramids return true;
if (message2[0].ToLower() == "pyramid")
{
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; }
if (message2.Length != 3)
goto Help;
try
{
height = Convert.ToUInt16(message2[1].Trim());
radius = Convert.ToUInt16(message2[2].Trim());
p.BcVar = new int[2] { height, radius };
}
catch
{
goto Help;
} }
p.SendMessage("Place a block"); public void BlockchangeCone(Player p, ushort x, ushort y, ushort z, byte type) {
p.ClearBlockchange(); RevertAndClearState(p, x, y, z);
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangePyramid); Util.SCOGenerator.Cone(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
return;
}
if (message2[0].ToLower() == "hpyramid")
{
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; }
if (message2.Length != 3)
goto Help;
try
{
height = Convert.ToUInt16(message2[1].Trim());
radius = Convert.ToUInt16(message2[2].Trim());
p.BcVar = new int[2] { height, radius };
}
catch
{
goto Help;
} }
p.SendMessage("Place a block"); public void BlockchangeHCone(Player p, ushort x, ushort y, ushort z, byte type) {
p.ClearBlockchange(); RevertAndClearState(p, x, y, z);
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHPyramid); Util.SCOGenerator.HCone(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
return;
}
if (message2[0].ToLower() == "ipyramid")
{
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; }
if (message2.Length != 3)
goto Help;
try
{
height = Convert.ToUInt16(message2[1].Trim());
radius = Convert.ToUInt16(message2[2].Trim());
p.BcVar = new int[2] { height, radius };
}
catch
{
goto Help;
} }
p.SendMessage("Place a block"); public void BlockchangeICone(Player p, ushort x, ushort y, ushort z, byte type) {
p.ClearBlockchange(); RevertAndClearState(p, x, y, z);
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeIPyramid); Util.SCOGenerator.ICone(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
return;
}
if (message2[0].ToLower() == "hipyramid")
{
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; }
if (message2.Length != 3)
goto Help;
try
{
height = Convert.ToUInt16(message2[1].Trim());
radius = Convert.ToUInt16(message2[2].Trim());
p.BcVar = new int[2] { height, radius };
}
catch
{
goto Help;
} }
p.SendMessage("Place a block"); public void BlockchangeHICone(Player p, ushort x, ushort y, ushort z, byte type) {
p.ClearBlockchange(); RevertAndClearState(p, x, y, z);
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHIPyramid); Util.SCOGenerator.HICone(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
return;
}
#endregion
#region spheres
if (message2[0].ToLower() == "sphere")
{
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 3)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name + "+"); return; }
if (message2.Length != 2)
goto Help;
try
{
radius = Convert.ToUInt16(message2[1].Trim());
p.BcVar = new int[2] { 0, radius };
}
catch
{
goto Help;
} }
p.SendMessage("Place a block"); public void BlockchangePyramid(Player p, ushort x, ushort y, ushort z, byte type) {
p.ClearBlockchange(); RevertAndClearState(p, x, y, z);
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeSphere); Util.SCOGenerator.Pyramid(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
return;
}
if (message2[0].ToLower() == "hsphere")
{
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 3)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name + "+"); return; }
if (message2.Length != 2)
goto Help;
try
{
radius = Convert.ToUInt16(message2[1].Trim());
p.BcVar = new int[2] { 0, radius };
}
catch
{
goto Help;
} }
p.SendMessage("Place a block"); public void BlockchangeHPyramid(Player p, ushort x, ushort y, ushort z, byte type) {
p.ClearBlockchange(); RevertAndClearState(p, x, y, z);
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHSphere); Util.SCOGenerator.HPyramid(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
return;
}
#endregion
#region other
if (message2[0].ToLower() == "volcano")
{
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 4)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 4)).name + "+"); return; }
if (message2.Length != 3)
goto Help;
try
{
height = Convert.ToUInt16(message2[1].Trim());
radius = Convert.ToUInt16(message2[2].Trim());
p.BcVar = new int[2] { height, radius };
}
catch
{
goto Help;
} }
p.SendMessage("Place a block"); public void BlockchangeIPyramid(Player p, ushort x, ushort y, ushort z, byte type) {
p.ClearBlockchange(); RevertAndClearState(p, x, y, z);
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeVolcano); Util.SCOGenerator.IPyramid(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
return;
} }
#endregion
Help: public void BlockchangeHIPyramid(Player p, ushort x, ushort y, ushort z, byte type) {
Help(p); RevertAndClearState(p, x, y, z);
return; Util.SCOGenerator.HIPyramid(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
}
public void BlockchangeSphere(Player p, ushort x, ushort y, ushort z, byte type) {
RevertAndClearState(p, x, y, z);
Util.SCOGenerator.Sphere(p, x, y, z, p.BcVar[1], type);
} }
Player.SendMessage(p, "This command can only be used in-game!");
public void BlockchangeHSphere(Player p, ushort x, ushort y, ushort z, byte type) {
RevertAndClearState(p, x, y, z);
Util.SCOGenerator.HSphere(p, x, y, z, p.BcVar[1], type);
} }
public override void Help(Player p)
{ public void BlockchangeVolcano(Player p, ushort x, ushort y, ushort z, byte type) {
RevertAndClearState(p, x, y, z);
Util.SCOGenerator.Volcano(p, x, y, z, p.BcVar[0], p.BcVar[1]);
}
public override void Help(Player p) {
p.SendMessage("/draw <shape> <height> <baseradius> - Draw an object in game- Valid Types cones, spheres, and pyramids, hspheres (hollow sphere), and hpyramids (hollow pyramid)"); p.SendMessage("/draw <shape> <height> <baseradius> - Draw an object in game- Valid Types cones, spheres, and pyramids, hspheres (hollow sphere), and hpyramids (hollow pyramid)");
} }
#region Cone Blockchanges
public void BlockchangeCone(Player p, ushort x, ushort y, ushort z, byte type)
{
int height = p.BcVar[0];
int radius = p.BcVar[1];
RevertAndClearState(p, x, y, z);
Util.SCOGenerator.Cone(p, x, y, z, height, radius, type);
}
public void BlockchangeHCone(Player p, ushort x, ushort y, ushort z, byte type)
{
int height = p.BcVar[0];
int radius = p.BcVar[1];
RevertAndClearState(p, x, y, z);
Util.SCOGenerator.HCone(p, x, y, z, height, radius, type);
}
public void BlockchangeICone(Player p, ushort x, ushort y, ushort z, byte type)
{
int height = p.BcVar[0];
int radius = p.BcVar[1];
RevertAndClearState(p, x, y, z);
Util.SCOGenerator.ICone(p, x, y, z, height, radius, type);
}
public void BlockchangeHICone(Player p, ushort x, ushort y, ushort z, byte type)
{
int height = p.BcVar[0];
int radius = p.BcVar[1];
RevertAndClearState(p, x, y, z);
Util.SCOGenerator.HICone(p, x, y, z, height, radius, type);
}
#endregion
#region Pyramid Blockchanges
public void BlockchangePyramid(Player p, ushort x, ushort y, ushort z, byte type)
{
int height = p.BcVar[0];
int radius = p.BcVar[1];
RevertAndClearState(p, x, y, z);
Util.SCOGenerator.Pyramid(p, x, y, z, height, radius, type);
}
public void BlockchangeHPyramid(Player p, ushort x, ushort y, ushort z, byte type)
{
int height = p.BcVar[0];
int radius = p.BcVar[1];
RevertAndClearState(p, x, y, z);
Util.SCOGenerator.HPyramid(p, x, y, z, height, radius, type);
}
public void BlockchangeIPyramid(Player p, ushort x, ushort y, ushort z, byte type)
{
int height = p.BcVar[0];
int radius = p.BcVar[1];
RevertAndClearState(p, x, y, z);
Util.SCOGenerator.IPyramid(p, x, y, z, height, radius, type);
}
public void BlockchangeHIPyramid(Player p, ushort x, ushort y, ushort z, byte type)
{
int height = p.BcVar[0];
int radius = p.BcVar[1];
RevertAndClearState(p, x, y, z);
Util.SCOGenerator.HIPyramid(p, x, y, z, height, radius, type);
}
#endregion
#region Sphere Blockchanges
public void BlockchangeSphere(Player p, ushort x, ushort y, ushort z, byte type)
{
int height = p.BcVar[0];
int radius = p.BcVar[1];
RevertAndClearState(p, x, y, z);
Util.SCOGenerator.Sphere(p, x, y, z, radius, type);
}
public void BlockchangeHSphere(Player p, ushort x, ushort y, ushort z, byte type)
{
int height = p.BcVar[0];
int radius = p.BcVar[1];
RevertAndClearState(p, x, y, z);
Util.SCOGenerator.HSphere(p, x, y, z, radius, type);
}
#endregion
#region Special Blockchanges
public void BlockchangeVolcano(Player p, ushort x, ushort y, ushort z, byte type)
{
int height = p.BcVar[0];
int radius = p.BcVar[1];
RevertAndClearState(p, x, y, z);
Util.SCOGenerator.Volcano(p, x, y, z, height, radius);
}
#endregion
} }
} }

View File

@ -37,18 +37,14 @@ namespace MCGalaxy {
} }
public sealed class RainbowBrush : Brush { public sealed class RainbowBrush : Brush {
readonly Random rnd; byte curBlock = Block.red;
public RainbowBrush() {
rnd = new Random();
}
public RainbowBrush(int seed) {
rnd = new Random(seed);
}
public override byte NextBlock() { public override byte NextBlock() {
return (byte)rnd.Next(Block.red, Block.darkgrey); byte block = curBlock;
curBlock++;
if (curBlock > Block.darkpink)
curBlock = Block.red;
return block;
} }
} }
@ -64,4 +60,20 @@ namespace MCGalaxy {
return (byte)rnd.Next(1, 11) <= 5 ? block : Block.Zero; return (byte)rnd.Next(1, 11) <= 5 ? block : Block.Zero;
} }
} }
public sealed class RandomRainbowBrush : Brush {
readonly Random rnd;
public RandomRainbowBrush() {
rnd = new Random();
}
public RandomRainbowBrush(int seed) {
rnd = new Random(seed);
}
public override byte NextBlock() {
return (byte)rnd.Next(Block.red, Block.darkgrey);
}
}
} }

View File

@ -211,13 +211,7 @@ namespace MCGalaxy.Util
{ {
if ((z + m) < 0 || (z + m) > p.level.Length) continue; if ((z + m) < 0 || (z + m) > p.level.Length) continue;
int ox = x; int cx = (x + j), cy = (y + k), cz = (z + m);
int oy = y;
int oz = z;
int cx = (x + j);
int cy = (y + k);
int cz = (z + m);
double currentheight = height - k; double currentheight = height - k;
@ -273,13 +267,7 @@ namespace MCGalaxy.Util
{ {
if ((z + m) < 0 || (z + m) > p.level.Length) continue; if ((z + m) < 0 || (z + m) > p.level.Length) continue;
int ox = x; int cx = (x + j), cy = (y + k), cz = (z + m);
int oy = y;
int oz = z;
int cx = (x + j);
int cy = (y + k);
int cz = (z + m);
double currentheight = height - k; double currentheight = height - k;
@ -335,13 +323,7 @@ namespace MCGalaxy.Util
{ {
if ((z + m) < 0 || (z + m) > p.level.Length) continue; if ((z + m) < 0 || (z + m) > p.level.Length) continue;
int ox = x; int cx = (x + j), cy = (y + k), cz = (z + m);
int oy = y;
int oz = z;
int cx = (x + j);
int cy = (y + k);
int cz = (z + m);
double currentheight = k; double currentheight = k;
@ -396,13 +378,7 @@ namespace MCGalaxy.Util
{ {
if ((z + m) < 0 || (z + m) > p.level.Length) continue; if ((z + m) < 0 || (z + m) > p.level.Length) continue;
int ox = x; int cx = (x + j), cy = (y + k), cz = (z + m);
int oy = y;
int oz = z;
int cx = (x + j);
int cy = (y + k);
int cz = (z + m);
double currentheight = k; double currentheight = k;
@ -457,13 +433,7 @@ namespace MCGalaxy.Util
{ {
if ((z + m) < 0 || (z + m) > p.level.Length) continue; if ((z + m) < 0 || (z + m) > p.level.Length) continue;
int ox = x; int cx = (x + j), cy = (y + k), cz = (z + m);
int oy = y;
int oz = z;
int cx = (x + j);
int cy = (y + k);
int cz = (z + m);
double currentheight = height - k; double currentheight = height - k;
@ -515,13 +485,7 @@ namespace MCGalaxy.Util
{ {
if ((z + m) < 0 || (z + m) > p.level.Length) continue; if ((z + m) < 0 || (z + m) > p.level.Length) continue;
int ox = x; int cx = (x + j), cy = (y + k), cz = (z + m);
int oy = y;
int oz = z;
int cx = (x + j);
int cy = (y + k);
int cz = (z + m);
double currentheight = height - k; double currentheight = height - k;
@ -573,13 +537,7 @@ namespace MCGalaxy.Util
{ {
if ((z + m) < 0 || (z + m) > p.level.Length) continue; if ((z + m) < 0 || (z + m) > p.level.Length) continue;
int ox = x; int cx = (x + j), cy = (y + k), cz = (z + m);
int oy = y;
int oz = z;
int cx = (x + j);
int cy = (y + k);
int cz = (z + m);
double currentheight = k; double currentheight = k;
@ -631,13 +589,7 @@ namespace MCGalaxy.Util
{ {
if ((z + m) < 0 || (z + m) > p.level.Length) continue; if ((z + m) < 0 || (z + m) > p.level.Length) continue;
int ox = x; int cx = (x + j), cy = (y + k), cz = (z + m);
int oy = y;
int oz = z;
int cx = (x + j);
int cy = (y + k);
int cz = (z + m);
double currentheight = k; double currentheight = k;
@ -781,13 +733,7 @@ namespace MCGalaxy.Util
{ {
if ((z + m) < 0 || (z + m) > p.level.Length) continue; if ((z + m) < 0 || (z + m) > p.level.Length) continue;
int ox = x; int cx = (x + j), cy = (y + k), cz = (z + m);
int oy = y;
int oz = z;
int cx = (x + j);
int cy = (y + k);
int cz = (z + m);
double currentheight = height - k; double currentheight = height - k;
@ -840,51 +786,6 @@ namespace MCGalaxy.Util
buffer = null; buffer = null;
} }
#region Stuff that's not used in MCGalaxy (at least not yet)
//public void ToAirMethod(List<string> toair)
//{
// if (toair.Count >= 1)
// {
// foreach (string s in toair)
// {
// try
// {
// string[] k = s.Split('^');
// Level l = Level.Find(k[0]);
// ushort x = Convert.ToUInt16(k[1]);
// ushort y = Convert.ToUInt16(k[2]);
// ushort z = Convert.ToUInt16(k[3]);
// l.Blockchange(x, y, z, 0);
// }
// catch { }
// }
// }
//}
//public void TNTthreader() //We may leave this because i cant think of an efficient way to do this.
//{
// while (true)
// {
// try
// {
// foreach (string t in TNTCHAIN.ToArray())
// {
// TNTCHAIN.Remove(t); //do first so if it fails its not there anymore :D
// string[] t2 = t.Split('^');
// Level l = Level.Find(t2[0]);
// ushort x = Convert.ToUInt16(t2[1]);
// ushort y = Convert.ToUInt16(t2[2]);
// ushort z = Convert.ToUInt16(t2[3]);
// TNT(l, x, y, z);
// }
// }
// catch { }
// Thread.Sleep(100);
// }
//}
#endregion
#region utilities #region utilities
static private double sqrt(double x) static private double sqrt(double x)
{ {