mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 04:32:50 -04:00
Add /f2d, /f3d aliases, implement 2d fill like fCraft. (Fixes #362)
This commit is contained in:
parent
6a11995882
commit
0aeaca75fb
@ -74,7 +74,7 @@ namespace MCGalaxy.Commands.Info {
|
||||
TimeSpan delta = expiry - DateTime.UtcNow;
|
||||
Player.Message(p, "Temp-banned %S by {1} %Sfor another {0}",
|
||||
delta.Shorten(), GetName(p, banner));
|
||||
if (reason != "") Player.Message(p, "Reason: {0}", reason);
|
||||
if (reason.Length > 0) Player.Message(p, "Reason: {0}", reason);
|
||||
}
|
||||
|
||||
static void DisplayDetails(Player p, string banner, string reason, DateTime time, string type) {
|
||||
|
@ -27,6 +27,10 @@ namespace MCGalaxy.Commands.Building {
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
|
||||
protected override string PlaceMessage { get { return "Place or break a block to mark the area you wish to fill."; } }
|
||||
public override int MarksCount { get { return 1; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("F3D"), new CommandAlias("F2D", "2d"),
|
||||
new CommandAlias("Fill3D"), new CommandAlias("Fill2D", "2d") }; }
|
||||
}
|
||||
|
||||
protected override DrawMode GetMode(string[] parts) {
|
||||
if (parts[parts.Length - 1].CaselessEq("confirm")) {
|
||||
@ -43,6 +47,7 @@ namespace MCGalaxy.Commands.Building {
|
||||
else if (msg == "layer") return DrawMode.layer;
|
||||
else if (msg == "vertical_x") return DrawMode.verticalX;
|
||||
else if (msg == "vertical_z") return DrawMode.verticalZ;
|
||||
else if (msg == "2d") return DrawMode.volcano;
|
||||
return DrawMode.normal;
|
||||
}
|
||||
|
||||
@ -60,6 +65,7 @@ namespace MCGalaxy.Commands.Building {
|
||||
ExtBlock old = p.level.GetBlock(x, y, z);
|
||||
if (!CommandParser.IsBlockAllowed(p, "fill over", old)) return false;
|
||||
|
||||
if (dArgs.Mode == DrawMode.volcano) dArgs.Mode = Calc2DFill(p, marks);
|
||||
FillDrawOp op = (FillDrawOp)dArgs.Op;
|
||||
op.Positions = FillDrawOp.FloodFill(p, p.level.PosToInt(x, y, z), old, dArgs.Mode);
|
||||
int count = op.Positions.Count;
|
||||
@ -70,12 +76,21 @@ namespace MCGalaxy.Commands.Building {
|
||||
Player.Message(p, "If you still want to fill, type %T/Fill {0} confirm", dArgs.Message);
|
||||
} else {
|
||||
success = base.DoDraw(p, marks, state, block);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
op.Positions = null;
|
||||
return success;
|
||||
}
|
||||
|
||||
static DrawMode Calc2DFill(Player p, Vec3S32[] marks) {
|
||||
int lenX = Math.Abs(p.Pos.BlockX - marks[0].X);
|
||||
int lenY = Math.Abs(p.Pos.BlockY - marks[0].Y);
|
||||
int lenZ = Math.Abs(p.Pos.BlockZ - marks[0].Z);
|
||||
|
||||
if (lenY >= lenX && lenY >= lenZ) return DrawMode.layer;
|
||||
return lenX >= lenZ ? DrawMode.verticalX : DrawMode.verticalZ;
|
||||
}
|
||||
|
||||
static bool IsConfirmed(string message) {
|
||||
return message.CaselessEq("confirm") || message.CaselessEnds(" confirm");
|
||||
}
|
||||
@ -83,7 +98,7 @@ namespace MCGalaxy.Commands.Building {
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/Fill [brush args] <mode>");
|
||||
Player.Message(p, "%HFills the area specified with the output of the current brush.");
|
||||
Player.Message(p, " %HModes: &fnormal/up/down/layer/vertical_x/vertical_z");
|
||||
Player.Message(p, " %HModes: &fnormal/up/down/layer/vertical_x/vertical_z/2d");
|
||||
Player.Message(p, BrushHelpLine);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using MCGalaxy.Commands.Moderation;
|
||||
|
||||
namespace MCGalaxy.Commands.Misc {
|
||||
public sealed class CmdFakeRank : Command {
|
||||
|
@ -19,7 +19,6 @@
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using MCGalaxy.Commands.Moderation;
|
||||
using MCGalaxy.Tasks;
|
||||
|
||||
namespace MCGalaxy.Commands.Misc {
|
||||
|
Loading…
x
Reference in New Issue
Block a user