mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-25 22:30:52 -04:00
Cuboid modes holes and random should read given arguments. (Thanks goodlyay)
This commit is contained in:
parent
ded5647e6d
commit
7d22d75111
@ -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;
|
||||
|
@ -74,7 +74,7 @@ namespace MCGalaxy.Commands {
|
||||
Player.SendMessage(p, "Available brushes: " + CmdBrush.AvailableBrushes);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
string brushMessage = parts.Length > 2 ? parts[2].ToLower() : "";
|
||||
BrushArgs args = new BrushArgs(p, brushMessage, type, extType);
|
||||
Brush brush = Brush.Brushes[brushName](args);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user