mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-17 11:18:55 -04:00
Cleanup /draw.
This commit is contained in:
parent
3bebd876b5
commit
321ce469e6
@ -1,405 +1,177 @@
|
||||
/*
|
||||
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
namespace MCGalaxy.Commands
|
||||
{
|
||||
public sealed class CmdDraw : Command
|
||||
{
|
||||
public override string name { get { return "draw"; } }
|
||||
public override string shortcut { get { return ""; } }
|
||||
public override string type { get { return CommandTypes.Building; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
public sealed class CmdDraw : Command
|
||||
{
|
||||
public override string name { get { return "draw"; } }
|
||||
public override string shortcut { get { return ""; } }
|
||||
public override string type { get { return CommandTypes.Building; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
|
||||
public CmdDraw() { }
|
||||
public CmdDraw() { }
|
||||
|
||||
public override void Use(Player p, string message)
|
||||
{
|
||||
int height;
|
||||
int radius;
|
||||
public override void Use(Player p, string message) {
|
||||
if (p == null) {
|
||||
Player.SendMessage(p, "This command can only be used in-game!"); return;
|
||||
}
|
||||
if (p.level.permissionbuild > p.group.Permission) {
|
||||
p.SendMessage("You can not edit this map."); return;
|
||||
}
|
||||
|
||||
string[] parts = message.Split(' ');
|
||||
Player.BlockchangeEventHandler newHandler = null;
|
||||
bool help;
|
||||
|
||||
if (p != null)
|
||||
{
|
||||
if (p.level.permissionbuild > p.group.Permission)
|
||||
{
|
||||
p.SendMessage("You can not edit this map.");
|
||||
return;
|
||||
}
|
||||
string[] message2 = message.Split(' ');
|
||||
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;
|
||||
|
||||
#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;
|
||||
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.Blockchange += newHandler;
|
||||
}
|
||||
|
||||
bool CheckTwoArgs(Player p, int addition, string[] parts, out bool help) {
|
||||
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, addition)) {
|
||||
Group group = Group.findPermInt(CommandOtherPerms.GetPerm(this, addition));
|
||||
Player.SendMessage(p, "That commands addition is for " + group.name + "+");
|
||||
help = false; return false;
|
||||
}
|
||||
|
||||
help = true;
|
||||
if (parts.Length != 3)
|
||||
return false;
|
||||
ushort height, radius;
|
||||
if (!ushort.TryParse(parts[1], out height) || !ushort.TryParse(parts[2], out radius))
|
||||
return false;
|
||||
p.BcVar = new int[] { height, radius };
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CheckOneArg(Player p, int addition, string[] parts, out bool help) {
|
||||
if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, addition)) {
|
||||
Group group = Group.findPermInt(CommandOtherPerms.GetPerm(this, addition));
|
||||
Player.SendMessage(p, "That commands addition is for " + group.name + "+");
|
||||
help = false; return false;
|
||||
}
|
||||
|
||||
help = true;
|
||||
if (parts.Length != 2)
|
||||
return false;
|
||||
ushort radius;
|
||||
if (!ushort.TryParse(parts[1], out radius))
|
||||
return false;
|
||||
p.BcVar = new int[] { 0, radius };
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
height = Convert.ToUInt16(message2[1].Trim());
|
||||
radius = Convert.ToUInt16(message2[2].Trim());
|
||||
p.BcVar = new int[2] { height, radius };
|
||||
}
|
||||
catch
|
||||
{
|
||||
goto Help;
|
||||
}
|
||||
public void BlockchangeCone(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||
RevertAndClearState(p, x, y, z);
|
||||
Util.SCOGenerator.Cone(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||
}
|
||||
|
||||
public void BlockchangeHCone(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||
RevertAndClearState(p, x, y, z);
|
||||
Util.SCOGenerator.HCone(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||
}
|
||||
|
||||
public void BlockchangeICone(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||
RevertAndClearState(p, x, y, z);
|
||||
Util.SCOGenerator.ICone(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||
}
|
||||
|
||||
public void BlockchangeHICone(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||
RevertAndClearState(p, x, y, z);
|
||||
Util.SCOGenerator.HICone(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||
}
|
||||
|
||||
p.SendMessage("Place a block");
|
||||
p.ClearBlockchange();
|
||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeCone);
|
||||
public void BlockchangePyramid(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||
RevertAndClearState(p, x, y, z);
|
||||
Util.SCOGenerator.Pyramid(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||
}
|
||||
|
||||
public void BlockchangeHPyramid(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||
RevertAndClearState(p, x, y, z);
|
||||
Util.SCOGenerator.HPyramid(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||
}
|
||||
|
||||
public void BlockchangeIPyramid(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||
RevertAndClearState(p, x, y, z);
|
||||
Util.SCOGenerator.IPyramid(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||
}
|
||||
|
||||
public void BlockchangeHIPyramid(Player p, ushort x, ushort y, ushort z, byte type) {
|
||||
RevertAndClearState(p, x, y, z);
|
||||
Util.SCOGenerator.HIPyramid(p, x, y, z, p.BcVar[0], p.BcVar[1], type);
|
||||
}
|
||||
|
||||
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;
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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");
|
||||
p.ClearBlockchange();
|
||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHCone);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (message2[0].ToLower() == "icone")
|
||||
{
|
||||
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");
|
||||
p.ClearBlockchange();
|
||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeICone);
|
||||
|
||||
return;
|
||||
}
|
||||
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");
|
||||
p.ClearBlockchange();
|
||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHICone);
|
||||
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
#region pyramids
|
||||
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");
|
||||
p.ClearBlockchange();
|
||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangePyramid);
|
||||
|
||||
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");
|
||||
p.ClearBlockchange();
|
||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHPyramid);
|
||||
|
||||
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");
|
||||
p.ClearBlockchange();
|
||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeIPyramid);
|
||||
|
||||
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");
|
||||
p.ClearBlockchange();
|
||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHIPyramid);
|
||||
|
||||
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");
|
||||
p.ClearBlockchange();
|
||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeSphere);
|
||||
|
||||
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");
|
||||
p.ClearBlockchange();
|
||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHSphere);
|
||||
|
||||
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");
|
||||
p.ClearBlockchange();
|
||||
p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeVolcano);
|
||||
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
|
||||
Help:
|
||||
Help(p);
|
||||
return;
|
||||
|
||||
}
|
||||
Player.SendMessage(p, "This command can only be used in-game!");
|
||||
}
|
||||
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)");
|
||||
}
|
||||
|
||||
#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
|
||||
}
|
||||
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)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,22 +37,18 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
public sealed class RainbowBrush : Brush {
|
||||
readonly Random rnd;
|
||||
|
||||
public RainbowBrush() {
|
||||
rnd = new Random();
|
||||
}
|
||||
|
||||
public RainbowBrush(int seed) {
|
||||
rnd = new Random(seed);
|
||||
}
|
||||
byte curBlock = Block.red;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class RandomBrush : Brush {
|
||||
public sealed class RandomBrush : Brush {
|
||||
readonly Random rnd = new Random();
|
||||
readonly byte block;
|
||||
|
||||
@ -64,4 +60,20 @@ namespace MCGalaxy {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -211,13 +211,7 @@ namespace MCGalaxy.Util
|
||||
{
|
||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||
|
||||
int ox = x;
|
||||
int oy = y;
|
||||
int oz = z;
|
||||
|
||||
int cx = (x + j);
|
||||
int cy = (y + k);
|
||||
int cz = (z + m);
|
||||
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||
|
||||
double currentheight = height - k;
|
||||
|
||||
@ -273,13 +267,7 @@ namespace MCGalaxy.Util
|
||||
{
|
||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||
|
||||
int ox = x;
|
||||
int oy = y;
|
||||
int oz = z;
|
||||
|
||||
int cx = (x + j);
|
||||
int cy = (y + k);
|
||||
int cz = (z + m);
|
||||
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||
|
||||
double currentheight = height - k;
|
||||
|
||||
@ -335,13 +323,7 @@ namespace MCGalaxy.Util
|
||||
{
|
||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||
|
||||
int ox = x;
|
||||
int oy = y;
|
||||
int oz = z;
|
||||
|
||||
int cx = (x + j);
|
||||
int cy = (y + k);
|
||||
int cz = (z + m);
|
||||
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||
|
||||
double currentheight = k;
|
||||
|
||||
@ -396,13 +378,7 @@ namespace MCGalaxy.Util
|
||||
{
|
||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||
|
||||
int ox = x;
|
||||
int oy = y;
|
||||
int oz = z;
|
||||
|
||||
int cx = (x + j);
|
||||
int cy = (y + k);
|
||||
int cz = (z + m);
|
||||
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||
|
||||
double currentheight = k;
|
||||
|
||||
@ -457,13 +433,7 @@ namespace MCGalaxy.Util
|
||||
{
|
||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||
|
||||
int ox = x;
|
||||
int oy = y;
|
||||
int oz = z;
|
||||
|
||||
int cx = (x + j);
|
||||
int cy = (y + k);
|
||||
int cz = (z + m);
|
||||
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||
|
||||
double currentheight = height - k;
|
||||
|
||||
@ -515,13 +485,7 @@ namespace MCGalaxy.Util
|
||||
{
|
||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||
|
||||
int ox = x;
|
||||
int oy = y;
|
||||
int oz = z;
|
||||
|
||||
int cx = (x + j);
|
||||
int cy = (y + k);
|
||||
int cz = (z + m);
|
||||
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||
|
||||
double currentheight = height - k;
|
||||
|
||||
@ -573,13 +537,7 @@ namespace MCGalaxy.Util
|
||||
{
|
||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||
|
||||
int ox = x;
|
||||
int oy = y;
|
||||
int oz = z;
|
||||
|
||||
int cx = (x + j);
|
||||
int cy = (y + k);
|
||||
int cz = (z + m);
|
||||
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||
|
||||
double currentheight = k;
|
||||
|
||||
@ -631,13 +589,7 @@ namespace MCGalaxy.Util
|
||||
{
|
||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||
|
||||
int ox = x;
|
||||
int oy = y;
|
||||
int oz = z;
|
||||
|
||||
int cx = (x + j);
|
||||
int cy = (y + k);
|
||||
int cz = (z + m);
|
||||
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||
|
||||
double currentheight = k;
|
||||
|
||||
@ -781,13 +733,7 @@ namespace MCGalaxy.Util
|
||||
{
|
||||
if ((z + m) < 0 || (z + m) > p.level.Length) continue;
|
||||
|
||||
int ox = x;
|
||||
int oy = y;
|
||||
int oz = z;
|
||||
|
||||
int cx = (x + j);
|
||||
int cy = (y + k);
|
||||
int cz = (z + m);
|
||||
int cx = (x + j), cy = (y + k), cz = (z + m);
|
||||
|
||||
double currentheight = height - k;
|
||||
|
||||
@ -840,51 +786,6 @@ namespace MCGalaxy.Util
|
||||
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
|
||||
static private double sqrt(double x)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user