Cuboid modes holes and random should read given arguments. (Thanks goodlyay)

This commit is contained in:
UnknownShadow200 2016-03-11 19:21:12 +11:00
parent ded5647e6d
commit 7d22d75111
5 changed files with 19 additions and 10 deletions

View File

@ -32,7 +32,7 @@ namespace MCGalaxy.Commands
CatchPos cpos = (CatchPos)p.blockchangeObject;
GetRealBlock(type, extType, p, ref cpos);
DrawOp drawOp = null;
Brush brush = null;
Func<BrushArgs, Brush> constructor = null;
switch (cpos.mode) {
case DrawMode.solid:
@ -44,16 +44,16 @@ namespace MCGalaxy.Commands
drawOp = new CuboidWallsDrawOp(); break;
case DrawMode.holes:
drawOp = new CuboidDrawOp();
brush = new CheckeredBrush(cpos.type, cpos.extType, 0, 0); break;
constructor = CheckeredBrush.Process; break;
case DrawMode.wire:
drawOp = new CuboidWireframeDrawOp(); break;
case DrawMode.random:
drawOp = new CuboidDrawOp();
brush = new RandomBrush(cpos.type, cpos.extType); break;
constructor = RandomBrush.Process; break;
}
int brushOffset = cpos.mode == DrawMode.normal ? 0 : 1;
if (brush == null) brush = GetBrush(p, cpos, brushOffset);
Brush brush = GetBrush(p, cpos, brushOffset, constructor);
if (brush == null) return;
if (!DrawOp.DoDrawOp(drawOp, brush, p, cpos.x, cpos.y, cpos.z, x, y, z))
return;

View File

@ -86,7 +86,8 @@ namespace MCGalaxy.Commands {
return type;
}
protected static Brush GetBrush(Player p, CatchPos cpos, int usedFromEnd) {
protected static Brush GetBrush(Player p, CatchPos cpos,
int usedFromEnd, Func<BrushArgs, Brush> constructor = null) {
int end = cpos.message.Length;
string brushMsg = "";
for (int i = 0; i < usedFromEnd; i++) {
@ -95,7 +96,7 @@ namespace MCGalaxy.Commands {
}
if (end >= 0) brushMsg = cpos.message.Substring(0, end);
var constructor = Brush.Brushes[p.BrushName];
if (constructor == null) constructor = Brush.Brushes[p.BrushName];
BrushArgs args = new BrushArgs(p, brushMsg, cpos.type, cpos.extType);
return constructor(args);
}

View File

@ -75,6 +75,15 @@ namespace MCGalaxy.Drawing.Brushes {
public override string[] Help { get { return new string[0]; } }
public static Brush Process(BrushArgs args) {
if (args.Message == "")
return new RandomBrush(args.Type, args.ExtType);
byte extType;
byte type = DrawCmd.GetBlock(args.Player, args.Message, out extType);
if (type == Block.Zero) return null;
return new RandomBrush(type, extType);
}
public override byte NextBlock(DrawOp op) {
return (byte)rnd.Next(1, 11) <= 5 ? type : Block.Zero;
}

View File

@ -1082,9 +1082,8 @@ return;
overallDeath++;
}
if ( Server.deathcount )
if ( overallDeath > 0 && overallDeath % 10 == 0 )
SendChatFrom(this, this.FullName + Server.DefaultColor + " has died &3" + overallDeath + " times", false);
if (Server.deathcount && (overallDeath > 0 && overallDeath % 10 == 0))
Chat.GlobalChatLevel(this, FullName + " %Shas died &3" + overallDeath + " times", false);
}
lastDeath = DateTime.Now;