Code cleanup.

This commit is contained in:
UnknownShadow200 2016-06-26 18:27:21 +10:00
parent 68c4576600
commit 714a49c503
41 changed files with 140 additions and 139 deletions

View File

@ -27,7 +27,7 @@ namespace MCGalaxy.Commands {
public override string shortcut { get { return ""; } }
protected override string Weapon { get { return "Gun"; } }
protected override void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
protected override void PlacedMark(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
p.RevertBlock(x, y, z);
if (!Block.canPlace(p, type)) { Player.Message(p, "You cannot place this block."); return; }

View File

@ -157,7 +157,7 @@ namespace MCGalaxy.Commands
cpos.x = 0; cpos.y = 0; cpos.z = 0;
p.blockchangeObject = cpos;
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
return;
}
if (s[2] == "layer")
@ -167,7 +167,7 @@ namespace MCGalaxy.Commands
cpos.x = 0; cpos.y = 0; cpos.z = 0;
p.blockchangeObject = cpos;
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
return;
}
@ -181,7 +181,7 @@ namespace MCGalaxy.Commands
cpos.x = 0; cpos.y = 0; cpos.z = 0;
p.blockchangeObject = cpos;
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
return;
}
if (s[1] == "settings")
@ -364,7 +364,7 @@ namespace MCGalaxy.Commands
}
}
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType)
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType)
{
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
@ -373,7 +373,7 @@ namespace MCGalaxy.Commands
{
cpos.x = x; cpos.y = y; cpos.z = z;
p.blockchangeObject = cpos;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
return;
}
@ -385,7 +385,7 @@ namespace MCGalaxy.Commands
Player.Message(p, "Position set! &b({0}, {1}, {2})", x, y, z);
}
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType)
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType)
{
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;

View File

@ -28,7 +28,7 @@ namespace MCGalaxy.Commands {
public override string shortcut { get { return ""; } }
protected override string Weapon { get { return "Missile"; } }
protected override void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
protected override void PlacedMark(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
if (!p.staticCommands) {
p.ClearBlockchange();
p.aiming = false;

View File

@ -980,7 +980,7 @@ namespace MCGalaxy.Commands {
CheckZone = false;
Player.Message(p, "TNT Wars: Place 2 blocks to create the zone for {0}!", msg);
//p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
break;
case "delete":
@ -997,7 +997,7 @@ namespace MCGalaxy.Commands {
CheckZone = false;
Player.Message(p, "TNT Wars: Place a block to delete the zone for {0}!", msg);
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
break;
case "check":
@ -1006,7 +1006,7 @@ namespace MCGalaxy.Commands {
CheckZone = true;
Player.Message(p, "TNT Wars: Place a block to check for no {0}!", msg);
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
break;
}
}
@ -1186,13 +1186,13 @@ namespace MCGalaxy.Commands {
}
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
if (DeleteZone == false && CheckZone == false) {
Player.Message(p, "TNT Wars: Place another block to mark the other corner of the zone!");
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
return;
}
@ -1222,7 +1222,7 @@ namespace MCGalaxy.Commands {
}
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
TntWarsGame.Zone Zn = new TntWarsGame.Zone();

View File

@ -149,7 +149,7 @@ using System.Threading;
Player.Message(theP, "Place a block for center of zombie spawn.");
theP.ClearBlockchange();
theP.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
theP.Blockchange += Blockchange1;
}
else
{

View File

@ -48,7 +48,7 @@ namespace MCGalaxy.Commands {
if (cpos.ending == EndType.Invalid) return;
p.blockchangeObject = cpos;
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark;
p.SendMessage(Weapon + " mode engaged, fire at will");
if (p.aiming) return;
@ -135,7 +135,7 @@ namespace MCGalaxy.Commands {
}
}
protected abstract void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType);
protected abstract void PlacedMark(Player p, ushort x, ushort y, ushort z, byte type, byte extType);
protected Player GetPlayer(Player p, Vec3U16 pos, bool skipSelf) {
Player[] players = PlayerInfo.Online.Items;

View File

@ -35,11 +35,10 @@ namespace MCGalaxy.Commands
if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
Player.Message(p, "Break/build a block to display information.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(AboutBlockchange);
}
p.Blockchange += PlacedBlock;
}
void AboutBlockchange(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedBlock(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
if (!p.staticCommands) p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
if (b == Block.Zero) { Player.Message(p, "Invalid Block(" + x + "," + y + "," + z + ")!"); return; }

View File

@ -40,17 +40,17 @@ namespace MCGalaxy.Commands {
p.blockchangeObject = cpos;
Player.Message(p, "Place two blocks to determine the edges.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
ushort minX = Math.Min(cpos.x, x), maxX = Math.Max(cpos.x, x);
@ -72,7 +72,7 @@ namespace MCGalaxy.Commands {
" Volume is " + (width * height * length) + " blocks." );
string name = " non-" + Block.Name(cpos.toIgnore);
Player.Message(p, "There are " + foundBlocks + name + " blocks in the area.");
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
if (p.staticCommands) p.Blockchange += PlacedMark1;
}
struct CatchPos { public ushort x, y, z; public byte toIgnore; }

View File

@ -34,21 +34,21 @@ namespace MCGalaxy.Commands {
if (LevelInfo.ExistsBackup(p.level.name, message)) {
p.blockchangeObject = new CatchPos() { backup = message };
p.ClearBlockchange();
p.Blockchange += Blockchange1;
p.Blockchange += PlacedMark1;
p.SendMessage("Select two corners for restore.");
} else {
Player.Message(p, "Backup " + message + " does not exist.");
}
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += Blockchange2;
p.Blockchange += PlacedMark2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
string path = LevelInfo.BackupPath(p.level.name, cpos.backup);
@ -58,7 +58,7 @@ namespace MCGalaxy.Commands {
if (!CopyBlocks(p, other, x, y, z, cpos)) return;
}
if (p.staticCommands)
p.Blockchange += Blockchange1;
p.Blockchange += PlacedMark1;
} catch (Exception ex) {
Server.ErrorLog(ex);
Server.s.Log("Restore selection failed");

View File

@ -40,18 +40,18 @@ namespace MCGalaxy.Commands {
Player.Message(p, "Place two blocks to determine the edges.");
p.ClearBlockchange();
p.blockchangeObject = cpos;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
cpos.x = x; cpos.y = y; cpos.z = z;
p.blockchangeObject = cpos;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
Player who = PlayerInfo.Find(cpos.message);

View File

@ -102,14 +102,14 @@ namespace MCGalaxy.Commands {
Player.Message(p, "Place two blocks to determine the edges.");
Player.Message(p, "Zone for: &b" + cpos.Owner + ".");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += Blockchange1;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += Blockchange2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {

View File

@ -12,16 +12,16 @@ namespace MCGalaxy.Commands.Building {
public override void Use(Player p, string message) {
Player.Message(p, "Place two blocks to determine the edges.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
p.blockchangeObject = new Vec3U16(x, y, z);
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
Vec3U16 start = (Vec3U16)p.blockchangeObject;
int xCen = (start.X + x) / 2, yCen = (start.Y + y) / 2, zCen = (start.Z + z) / 2;

View File

@ -89,19 +89,19 @@ namespace MCGalaxy.Commands.Building {
p.blockchangeObject = cpos;
Player.Message(p, "Place two blocks to determine the edges.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
p.copystart[0] = x; p.copystart[1] = y; p.copystart[2] = z;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
ushort minX = (ushort)Math.Min(x, cpos.x), maxX = (ushort)Math.Max(x, cpos.x);
@ -150,7 +150,7 @@ namespace MCGalaxy.Commands.Building {
Player.Message(p, format, state.UsedBlocks);
if (cpos.allowoffset != -1) {
Player.Message(p, "Place a block to determine where to paste from");
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange3);
p.Blockchange += Blockchange3;
}
}

View File

@ -30,7 +30,7 @@ namespace MCGalaxy.Commands.Building {
new CommandAlias("box"), new CommandAlias("hbox", null, "hollow") }; }
}
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
GetRealBlock(type, extType, p, ref cpos);
@ -63,7 +63,7 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(op, brush, p, cpos.x, cpos.y, cpos.z, x, y, z))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
protected override DrawMode ParseMode(string msg) {

View File

@ -41,7 +41,7 @@ namespace MCGalaxy.Commands.Building {
return DrawMode.normal;
}
protected override void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
protected override void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
GetRealBlock(type, extType, p, ref cpos);
@ -93,10 +93,10 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(op, brush, p, marks))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { }
protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { }
bool CheckTwoArgs(Player p, ref ushort radius, ref ushort height, string[] parts) {
if (parts.Length < 3) { Help(p); return false; }

View File

@ -36,7 +36,7 @@ namespace MCGalaxy.Commands.Building {
p.blockchangeObject = cpos;
Player.Message(p, "Destroy the block you wish to drill.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += Blockchange1;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {

View File

@ -37,7 +37,7 @@ namespace MCGalaxy.Commands.Building {
return DrawMode.normal;
}
protected override void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
protected override void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
p.ClearBlockchange();
CatchPos cpos = (CatchPos)p.blockchangeObject;
byte oldType = p.level.GetTile(x, y, z), oldExtType = 0;
@ -72,10 +72,10 @@ namespace MCGalaxy.Commands.Building {
op.Positions = null;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { }
protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { }
void FloodFill(Player p, ushort x, ushort y, ushort z, byte oldType, byte oldExtType, DrawMode fillType,
SparseBitSet bits, List<int> buffer, List<int> origins, int depth) {

View File

@ -39,17 +39,17 @@ namespace MCGalaxy.Commands.Building {
p.blockchangeObject = cpos;
Player.Message(p, "Place two blocks to determine the edges.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
@ -58,7 +58,7 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(op, null, p, x, y, z, cpos.x, cpos.y, cpos.z ))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
struct CatchPos {

View File

@ -74,7 +74,7 @@ namespace MCGalaxy.Commands.Building {
p.blockchangeObject = cpos;
Player.Message(p, "Place two blocks to determine direction.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
bool DownloadWebFile(string url, Player p) {
@ -97,14 +97,14 @@ namespace MCGalaxy.Commands.Building {
}
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
if (x == cpos.x && z == cpos.z) { Player.Message(p, "No direction was selected"); return; }

View File

@ -52,7 +52,7 @@ namespace MCGalaxy.Commands.Building {
return ParseMode(parts[parts.Length - 2]);
}
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
GetRealBlock(type, extType, p, ref cpos);
@ -81,7 +81,7 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(drawOp, brush, p, cpos.x, cpos.y, cpos.z, x, y, z))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
public override void Help(Player p) {

View File

@ -35,18 +35,18 @@ namespace MCGalaxy.Commands.Building {
Player.Message(p, "Place two blocks to determine the edges.");
p.ClearBlockchange();
p.blockchangeObject = cpos;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
cpos.x = x; cpos.y = y; cpos.z = z;
p.blockchangeObject = cpos;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
MazeDrawOp drawOp = new MazeDrawOp();
@ -55,7 +55,7 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(drawOp, null, p, cpos.x, cpos.y, cpos.z, x, y, z))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
public override void Help(Player p) {

View File

@ -61,7 +61,7 @@ namespace MCGalaxy.Commands.Building {
p.blockchangeObject = cpos;
Player.Message(p, "Place where you wish the message block to go."); p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark;
}
bool CheckCommand(Player p, string message) {
@ -83,7 +83,7 @@ namespace MCGalaxy.Commands.Building {
return message.CaselessEq(cmd) || message.CaselessStarts(cmd + " ");
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
p.ClearBlockchange();
CatchPos cpos = (CatchPos)p.blockchangeObject;
@ -99,7 +99,7 @@ namespace MCGalaxy.Commands.Building {
}
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark;
}
void UpdateDatabase(Player p, CatchPos cpos, ushort x, ushort y, ushort z) {

View File

@ -40,17 +40,17 @@ namespace MCGalaxy.Commands.Building {
p.blockchangeObject = cpos;
Player.Message(p, "Place two blocks to determine the edges.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
@ -60,7 +60,7 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(op, null, p, x, y, z, cpos.x, cpos.y, cpos.z ))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
struct CatchPos { public byte type, extType, newType, newExtType; public ushort x, y, z; }

View File

@ -39,10 +39,10 @@ namespace MCGalaxy.Commands.Building {
p.blockchangeObject = cpos;
Player.Message(p, "Place a block in the corner of where you want to paste.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedOrigin;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedOrigin(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
CatchPos cpos = (CatchPos)p.blockchangeObject;
RevertAndClearState(p, x, y, z);
int x1 = p.copyoffset[0] + x, y1 = p.copyoffset[1] + y, z1 = p.copyoffset[2] + z;
@ -67,7 +67,7 @@ namespace MCGalaxy.Commands.Building {
Vec3S32[] marks = { new Vec3S32(x1, y1, z1) };
if (!DrawOp.DoDrawOp(op, null, p, marks))
return;
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
if (p.staticCommands) p.Blockchange += PlacedOrigin;
}
struct CatchPos { public string message; }

View File

@ -25,7 +25,7 @@ namespace MCGalaxy.Commands.Building {
public override string name { get { return "pyramid"; } }
public override string shortcut { get { return "pd"; } }
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
GetRealBlock(type, extType, p, ref cpos);
@ -52,7 +52,7 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(drawOp, brush, p, cpos.x, cpos.y, cpos.z, x, y, z))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
protected override DrawMode ParseMode(string msg) {

View File

@ -32,17 +32,17 @@ namespace MCGalaxy.Commands.Building {
p.blockchangeObject = cpos;
Player.Message(p, "Place two blocks to determine the edges.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
@ -50,7 +50,7 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(op, null, p, x, y, z, cpos.x, cpos.y, cpos.z ))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
struct CatchPos { public ushort x, y, z; }

View File

@ -42,18 +42,18 @@ namespace MCGalaxy.Commands.Building {
Player.Message(p, "Place two blocks to determine the edges.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z;
p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
type = type < 128 ? p.bindings[type] : type;
@ -83,7 +83,7 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(drawOp, brush, p, cpos.x, cpos.y, cpos.z, x, y, z))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
protected virtual bool ReplaceNot { get { return false; } }

View File

@ -36,7 +36,7 @@ namespace MCGalaxy.Commands.Building {
p.blockchangeObject = cpos;
Player.Message(p, "Place two blocks to determine the edges.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
bool ParseArgs(Player p, string message, ref CatchPos cpos) {
@ -90,14 +90,14 @@ namespace MCGalaxy.Commands.Building {
return false;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
List<int> buffer = new List<int>();
@ -127,7 +127,7 @@ namespace MCGalaxy.Commands.Building {
p.level.AddCheck(index, true, cpos.extraInfo);
Player.Message(p, "Activated " + buffer.Count + " blocks.");
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
struct CatchPos { public ushort x, y, z; public PhysicsArgs extraInfo; }

View File

@ -52,17 +52,17 @@ namespace MCGalaxy.Commands.Building {
p.blockchangeObject = cpos;
Player.Message(p, "Place two blocks to determine direction.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
ushort distance = cpos.distance, interval = cpos.interval;
@ -97,7 +97,7 @@ namespace MCGalaxy.Commands.Building {
Player.Message(p, "Placed stone blocks " + interval + " apart");
else
Player.Message(p, "Placed stone blocks " + distance + " apart");
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
if (p.staticCommands) p.Blockchange += PlacedMark1;
}
struct CatchPos {

View File

@ -35,7 +35,7 @@ namespace MCGalaxy.Commands.Building {
return DrawMode.normal;
}
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
GetRealBlock(type, extType, p, ref cpos);
@ -63,7 +63,7 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(op, brush, p, marks))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
public override void Help(Player p) {

View File

@ -27,7 +27,7 @@ namespace MCGalaxy.Commands.Building {
get { return new[] { new CommandAlias("eh", null, "hollow"), new CommandAlias("cylinder", null, "vertical") }; }
}
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
GetRealBlock(type, extType, p, ref cpos);
@ -49,7 +49,7 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(op, brush, p, cpos.x, cpos.y, cpos.z, x, y, z))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
protected override DrawMode ParseMode(string msg) {

View File

@ -29,7 +29,7 @@ namespace MCGalaxy.Commands.Building {
}
protected override string PlaceMessage { get { return "Place a block for the centre, then another for the radius."; } }
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
GetRealBlock(type, extType, p, ref cpos);
@ -46,7 +46,7 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(drawOp, brush, p, marks))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
protected override DrawMode ParseMode(string msg) { return DrawMode.normal; }

View File

@ -49,11 +49,11 @@ namespace MCGalaxy.Commands.Building {
cpos.brushMsg = brushMsg;
p.ClearBlockchange();
p.blockchangeObject = cpos;
p.Blockchange += new Player.BlockchangeEventHandler(PlaceBlock1);
p.Blockchange += PlacedBase;
Player.Message(p, "Select where you wish your tree to grow");
}
void PlaceBlock1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedBase(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
type = type < 128 ? p.bindings[type] : type;
@ -75,7 +75,7 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(op, brush, p, marks))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(PlaceBlock1);
p.Blockchange += PlacedBase;
}
static Brush ParseBrush(string brushMsg, Player p, byte type, byte extType) {

View File

@ -27,15 +27,15 @@ namespace MCGalaxy.Commands.Building {
get { return "Place three blocks to determine the edges."; }
}
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
protected override void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x2 = x; bp.y2 = y; bp.z2 = z;
p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange3);
p.Blockchange += PlacedMark3;
}
void Blockchange3(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark3(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
GetRealBlock(type, extType, p, ref cpos);
@ -47,7 +47,7 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(new TriangleDrawOp(), brush, p, marks))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
protected override DrawMode ParseMode(string msg) {

View File

@ -48,17 +48,17 @@ namespace MCGalaxy.Commands.Building {
Player.Message(p, "Place two blocks to determine direction.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
type = type < 128 ? p.bindings[type] : type;
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
@ -73,7 +73,7 @@ namespace MCGalaxy.Commands.Building {
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
struct CatchPos { public byte scale, spacing; public ushort x, y, z; public string givenMessage; }

View File

@ -36,21 +36,21 @@ namespace MCGalaxy.Commands.Building {
p.blockchangeObject = cpos;
Player.Message(p, PlaceMessage);
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
// most draw commands use two coordinates, so implement this here to simplify implementation.
protected virtual void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
protected virtual void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z;
p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
protected virtual string PlaceMessage { get { return "Place two blocks to determine the edges."; } }
protected abstract void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType);
protected abstract void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType);
protected abstract DrawMode ParseMode(string mode);

View File

@ -34,18 +34,18 @@ namespace MCGalaxy.Commands.Building {
Player.Message(p, "Place two blocks to determine the edges.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z;
p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
p.Blockchange += PlacedMark2;
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedMark2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
BrushArgs args = new BrushArgs(p, cpos.message, type, extType);
@ -56,7 +56,7 @@ namespace MCGalaxy.Commands.Building {
if (!DrawOp.DoDrawOp(drawOp, brush, p, cpos.x, cpos.y, cpos.z, x, y, z))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedMark1;
}
protected virtual bool ReplaceNot { get { return false; } }

View File

@ -37,13 +37,13 @@ namespace MCGalaxy.Commands
p.level.C4list.Add(c4);
p.c4circuitNumber = numb;
Player.Message(p, "Place any block for c4 and place a &cred %Sblock for the detonator!");
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedNext;
} else {
Player.Message(p, "To use c4, the physics level must be 1, 2, 3 or 4");
}
}
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
void PlacedNext(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
p.ClearBlockchange();
if (type == Block.red) {
p.ManualChange(x, y, z, 1, Block.c4det);
@ -52,7 +52,7 @@ namespace MCGalaxy.Commands
} else if (type != Block.air) {
p.ManualChange(x, y, z, 1, Block.c4);
}
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
p.Blockchange += PlacedNext;
}
public override void Help(Player p) {

View File

@ -85,7 +85,7 @@ namespace MCGalaxy.Commands
cpos.x = 0; cpos.y = 0; cpos.z = 0; cpos.color = color; p.blockchangeObject = cpos;
Player.Message(p, "Place a block to determine where to place the flag.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(AddFlag);
p.Blockchange += AddFlag;
}
else if (message.Split(' ')[0].ToLower() == "reset")
{

View File

@ -14,17 +14,18 @@ permiusing MCGalaxy;ssions and limitations under the Licenses.
*/
using System;
using System.IO;
using System.Timers;
namespace MCGalaxy {
public static class Checktimer {
static System.Timers.Timer t;
static Timer t;
const StringComparison comp = StringComparison.OrdinalIgnoreCase;
public static void StartTimer() {
t = new System.Timers.Timer();
t = new Timer();
t.AutoReset = false;
t.Elapsed += new System.Timers.ElapsedEventHandler(t_Elapsed);
t.Elapsed += TimerElapsed;
t.Interval = GetInterval();
t.Start();
}
@ -34,7 +35,7 @@ namespace MCGalaxy {
return ((60 - now.Second) * 1000 - now.Millisecond);
}
static void t_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
static void TimerElapsed(object sender, System.Timers.ElapsedEventArgs e) {
t.Interval = GetInterval();
t.Start();
TRExpiryCheck(); // every 60 seconds

View File

@ -141,6 +141,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="Galaxy.ico" />
<Content Include="ProfilingSessions\Session20160626_154311.sdps" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.