mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Centre should place multiple blocks if axis length is even. (Thanks Empy)
This commit is contained in:
parent
93d4d01d42
commit
085d0ad854
@ -146,9 +146,9 @@ namespace MCGalaxy.Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
Player.Message(p, "/zone [add] [name] - Creates a zone only [name] can build in");
|
Player.Message(p, "%T/zone add [name] %H- Creates a zone only [name] can build in");
|
||||||
Player.Message(p, "/zone [add] [rank] - Creates a zone only [rank]+ can build in");
|
Player.Message(p, "%T/zone add [rank] %H- Creates a zone only [rank]+ can build in");
|
||||||
Player.Message(p, "/zone del - Deletes the zone clicked");
|
Player.Message(p, "%T/zone del %H- Deletes the zone clicked");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,15 +16,33 @@ namespace MCGalaxy.Commands.Building {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DoCentre(Player p, Vec3S32[] m, object state, byte type, byte extType) {
|
bool DoCentre(Player p, Vec3S32[] m, object state, byte type, byte extType) {
|
||||||
int xCen = (m[0].X + m[1].X) / 2, yCen = (m[0].Y + m[1].Y) / 2, zCen = (m[0].Z + m[1].Z) / 2;
|
int lenX = m[0].X + m[1].X, lenY = m[0].Y + m[1].Y, lenZ = m[0].Z + m[1].Z;
|
||||||
p.level.UpdateBlock(p, (ushort)xCen, (ushort)yCen, (ushort)zCen, Block.goldsolid, 0);
|
int x = lenX / 2, y = lenY / 2, z = lenZ / 2;
|
||||||
Player.Message(p, "A gold block was placed at ({0}, {1}, {2}).", xCen, yCen, zCen);
|
|
||||||
|
Place(p, x, y, z);
|
||||||
|
if ((lenX & 1) == 1) Place(p, x + 1, y, z);
|
||||||
|
if ((lenZ & 1) == 1) Place(p, x, y, z + 1);
|
||||||
|
if ((lenX & 1) == 1 && (lenZ & 1) == 1) Place(p, x + 1, y, z + 1);
|
||||||
|
|
||||||
|
// Top layer blocks
|
||||||
|
if ((lenY & 1) == 1) {
|
||||||
|
Place(p, x, y + 1, z);
|
||||||
|
if ((lenX & 1) == 1) Place(p, x + 1, y + 1, z);
|
||||||
|
if ((lenZ & 1) == 1) Place(p, x, y + 1, z + 1);
|
||||||
|
if ((lenX & 1) == 1 && (lenZ & 1) == 1) Place(p, x + 1, y + 1, z + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Player.Message(p, "Gold blocks were placed at ({0}, {1}, {2}).", x, y, z);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Place(Player p, int x, int y, int z) {
|
||||||
|
p.level.UpdateBlock(p, (ushort)x, (ushort)y, (ushort)z, Block.goldsolid, 0);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
Player.Message(p, "%T/center");
|
Player.Message(p, "%T/center");
|
||||||
Player.Message(p, "%HPlaces a block at the center of your selection");
|
Player.Message(p, "%HPlaces gold blocks at the center of your selection");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user