add /circleh (/sphere hollowcircle) for drawing hollow circles, fixes #300

This commit is contained in:
UnknownShadow200 2017-06-01 12:49:21 +10:00
parent c5a19db3ba
commit 003896e1ab
2 changed files with 11 additions and 7 deletions

View File

@ -27,7 +27,8 @@ namespace MCGalaxy.Commands.Building {
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("sphereh", null, "hollow"),
new CommandAlias("sph", null, "hollow"), new CommandAlias("circle", null, "circle" ) }; }
new CommandAlias("sph", null, "hollow"), new CommandAlias("circle", null, "circle" ),
new CommandAlias("circleh", null, "hollowcircle") }; }
}
protected override string PlaceMessage {
get { return "Place a block for the centre, then another for the radius."; }
@ -38,6 +39,7 @@ namespace MCGalaxy.Commands.Building {
if (msg == "solid") return DrawMode.solid;
else if (msg == "hollow") return DrawMode.hollow;
else if (msg == "circle") return DrawMode.circle;
else if (msg == "hollowcircle") return DrawMode.hcircle;
return DrawMode.normal;
}
@ -45,6 +47,7 @@ namespace MCGalaxy.Commands.Building {
switch (dArgs.Mode) {
case DrawMode.hollow: return new AdvHollowSphereDrawOp();
case DrawMode.circle: return new EllipsoidDrawOp();
case DrawMode.hcircle: return new EllipsoidHollowDrawOp();
}
return new AdvSphereDrawOp();
}
@ -66,7 +69,8 @@ namespace MCGalaxy.Commands.Building {
int dy = Math.Abs(m[0].Y - m[1].Y);
int dz = Math.Abs(m[0].Z - m[1].Z);
if (mode != DrawMode.circle) {
bool circle = mode == DrawMode.circle || mode == DrawMode.hcircle;
if (!circle) {
int R = (int)Math.Sqrt(dx * dx + dy * dy + dz * dz);
return new Vec3S32(R, R, R);
} else if (dx >= dy && dz >= dy) {
@ -85,7 +89,7 @@ namespace MCGalaxy.Commands.Building {
Player.Message(p, "%T/sphere <brush args> <mode>");
Player.Message(p, "%HCreates a sphere, with the first point as the centre, " +
"and second being the radius.");
Player.Message(p, " %HModes: &fsolid/hollow/circle");
Player.Message(p, " %HModes: &fsolid/hollow/circle/hollowcircle");
Player.Message(p, " %HFor help about brushes, type %T/help brush%H.");
}
}

View File

@ -108,6 +108,6 @@ namespace MCGalaxy.Commands.Building {
up, down, layer, verticalX, verticalZ, // fill
cone, hcone, icone, hicone, volcano, // draw
pyramid, hpyramid, ipyramid, hipyramid,// draw
sphere, hsphere, circle, // draw
sphere, hsphere, circle, hcircle // draw
}
}