mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Optional argument for /rainbow for whether air is replaced over too
This commit is contained in:
parent
58e546dad4
commit
42bcb10c68
@ -23,12 +23,19 @@ namespace MCGalaxy.Commands.Building {
|
|||||||
public sealed class CmdRainbow : DrawCmd {
|
public sealed class CmdRainbow : DrawCmd {
|
||||||
public override string name { get { return "Rainbow"; } }
|
public override string name { get { return "Rainbow"; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
|
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 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) {
|
public override void Help(Player p) {
|
||||||
Player.Message(p, "%T/Rainbow");
|
Player.Message(p, "%T/Rainbow <replace air>");
|
||||||
Player.Message(p, "%HTaste the rainbow");
|
Player.Message(p, "%HReplaces blocks with a rainbow between two points.");
|
||||||
|
Player.Message(p, "%H<replace air> if given, also replaces over air.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -90,6 +90,7 @@ namespace MCGalaxy.Drawing.Ops {
|
|||||||
|
|
||||||
public class RainbowDrawOp : CuboidDrawOp {
|
public class RainbowDrawOp : CuboidDrawOp {
|
||||||
|
|
||||||
|
public bool AllowAir;
|
||||||
public override string Name { get { return "Rainbow"; } }
|
public override string Name { get { return "Rainbow"; } }
|
||||||
|
|
||||||
public override void Perform(Vec3S32[] marks, Brush brush, DrawOpOutput output) {
|
public override void Perform(Vec3S32[] marks, Brush brush, DrawOpOutput output) {
|
||||||
@ -117,7 +118,7 @@ namespace MCGalaxy.Drawing.Ops {
|
|||||||
int startX = i;
|
int startX = i;
|
||||||
for (ushort x = p1.X; x <= p2.X; x++) {
|
for (ushort x = p1.X; x <= p2.X; x++) {
|
||||||
i = (i + stepX) % repeat;
|
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
|
// Need this because RainbowBrush works on world coords
|
||||||
Coords.X = (ushort)i; Coords.Y = 0; Coords.Z = 0;
|
Coords.X = (ushort)i; Coords.Y = 0; Coords.Z = 0;
|
||||||
BlockID block = brush.NextBlock(this);
|
BlockID block = brush.NextBlock(this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user