From 42bcb10c68be56ebb6cd9daa7c710f0e017bde38 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 23 Apr 2018 08:00:37 +1000 Subject: [PATCH] Optional argument for /rainbow for whether air is replaced over too --- MCGalaxy/Commands/building/CmdRainbow.cs | 13 ++++++++++--- MCGalaxy/Drawing/DrawOps/CuboidDrawOps.cs | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/MCGalaxy/Commands/building/CmdRainbow.cs b/MCGalaxy/Commands/building/CmdRainbow.cs index cb35d2fb6..85318bbb7 100644 --- a/MCGalaxy/Commands/building/CmdRainbow.cs +++ b/MCGalaxy/Commands/building/CmdRainbow.cs @@ -23,12 +23,19 @@ namespace MCGalaxy.Commands.Building { public sealed class CmdRainbow : DrawCmd { public override string name { get { return "Rainbow"; } } public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } } - protected override DrawOp GetDrawOp(DrawArgs dArgs) { return new RainbowDrawOp(); } protected override void GetBrush(DrawArgs dArgs) { dArgs.BrushName = "normal"; } + protected override DrawOp GetDrawOp(DrawArgs dArgs) { + string args = dArgs.Message; + RainbowDrawOp op = new RainbowDrawOp(); + if (args.Length > 0 && !CommandParser.GetBool(dArgs.Player, args, ref op.AllowAir)) return null; + return op; + } + public override void Help(Player p) { - Player.Message(p, "%T/Rainbow"); - Player.Message(p, "%HTaste the rainbow"); + Player.Message(p, "%T/Rainbow "); + Player.Message(p, "%HReplaces blocks with a rainbow between two points."); + Player.Message(p, "%H if given, also replaces over air."); } } } \ No newline at end of file diff --git a/MCGalaxy/Drawing/DrawOps/CuboidDrawOps.cs b/MCGalaxy/Drawing/DrawOps/CuboidDrawOps.cs index e97e7c742..2da4bbdd7 100644 --- a/MCGalaxy/Drawing/DrawOps/CuboidDrawOps.cs +++ b/MCGalaxy/Drawing/DrawOps/CuboidDrawOps.cs @@ -90,6 +90,7 @@ namespace MCGalaxy.Drawing.Ops { public class RainbowDrawOp : CuboidDrawOp { + public bool AllowAir; public override string Name { get { return "Rainbow"; } } public override void Perform(Vec3S32[] marks, Brush brush, DrawOpOutput output) { @@ -117,7 +118,7 @@ namespace MCGalaxy.Drawing.Ops { int startX = i; for (ushort x = p1.X; x <= p2.X; x++) { i = (i + stepX) % repeat; - if (!Level.IsAirAt(x, y, z)) { + if (AllowAir || !Level.IsAirAt(x, y, z)) { // Need this because RainbowBrush works on world coords Coords.X = (ushort)i; Coords.Y = 0; Coords.Z = 0; BlockID block = brush.NextBlock(this);