fix /static mode being turned off if a draw op execees rank draw limit. (Thanks ozy)

This commit is contained in:
UnknownShadow200 2017-07-10 21:38:05 +10:00
parent 65bfe62051
commit ba6b80fa44
11 changed files with 26 additions and 13 deletions

View File

@ -42,7 +42,8 @@ namespace MCGalaxy.Commands.Building {
bool DoHollow(Player p, Vec3S32[] marks, object state, ExtBlock block) { bool DoHollow(Player p, Vec3S32[] marks, object state, ExtBlock block) {
HollowDrawOp op = new HollowDrawOp(); HollowDrawOp op = new HollowDrawOp();
op.Skip = (byte)state; op.Skip = (byte)state;
return DrawOpPerformer.Do(op, null, p, marks); DrawOpPerformer.Do(op, null, p, marks);
return true;
} }
public override void Help(Player p) { public override void Help(Player p) {

View File

@ -39,7 +39,8 @@ namespace MCGalaxy.Commands.Building {
bool DoMaze(Player p, Vec3S32[] marks, object state, ExtBlock block) { bool DoMaze(Player p, Vec3S32[] marks, object state, ExtBlock block) {
MazeDrawOp op = new MazeDrawOp(); MazeDrawOp op = new MazeDrawOp();
op.randomizer = (int)state; op.randomizer = (int)state;
return DrawOpPerformer.Do(op, null, p, marks); DrawOpPerformer.Do(op, null, p, marks);
return true;
} }
public override void Help(Player p) { public override void Help(Player p) {

View File

@ -55,7 +55,8 @@ namespace MCGalaxy.Commands.Building {
Brush brush = factory.Construct(bArgs); Brush brush = factory.Construct(bArgs);
if (brush == null) return false; if (brush == null) return false;
return DrawOpPerformer.Do(op, brush, p, marks); DrawOpPerformer.Do(op, brush, p, marks);
return true;
} }
struct DrawArgs { public ExtBlock target; public string brushArgs; } struct DrawArgs { public ExtBlock target; public string brushArgs; }

View File

@ -50,7 +50,8 @@ namespace MCGalaxy.Commands.Building {
PasteDrawOp op = new PasteDrawOp(); PasteDrawOp op = new PasteDrawOp();
op.CopyState = p.CopyBuffer; op.CopyState = p.CopyBuffer;
return DrawOpPerformer.Do(op, (Brush)state, p, m); DrawOpPerformer.Do(op, (Brush)state, p, m);
return true;
} }
public override void Help(Player p) { public override void Help(Player p) {

View File

@ -33,7 +33,8 @@ namespace MCGalaxy.Commands.Building {
} }
bool DoRainbow(Player p, Vec3S32[] marks, object state, ExtBlock block) { bool DoRainbow(Player p, Vec3S32[] marks, object state, ExtBlock block) {
return DrawOpPerformer.Do(new RainbowDrawOp(), null, p, marks); DrawOpPerformer.Do(new RainbowDrawOp(), null, p, marks);
return true;
} }
public override void Help(Player p) { public override void Help(Player p) {

View File

@ -78,7 +78,9 @@ namespace MCGalaxy.Commands.Building {
DrawOp op = null; DrawOp op = null;
if (ReplaceNot) op = new ReplaceNotDrawOp(target); if (ReplaceNot) op = new ReplaceNotDrawOp(target);
else op = new ReplaceDrawOp(target); else op = new ReplaceDrawOp(target);
return DrawOpPerformer.Do(op, brush, p, marks);
DrawOpPerformer.Do(op, brush, p, marks);
return true;
} }
protected virtual bool ReplaceNot { get { return false; } } protected virtual bool ReplaceNot { get { return false; } }

View File

@ -79,7 +79,8 @@ namespace MCGalaxy.Commands.Building {
Brush brush = null; Brush brush = null;
if (dArgs.brushMsg != "") brush = ParseBrush(dArgs.brushMsg, p, block); if (dArgs.brushMsg != "") brush = ParseBrush(dArgs.brushMsg, p, block);
return DrawOpPerformer.Do(op, brush, p, marks); DrawOpPerformer.Do(op, brush, p, marks);
return true;
} }

View File

@ -58,8 +58,10 @@ namespace MCGalaxy.Commands.Building {
WriteDrawOp op = new WriteDrawOp(); WriteDrawOp op = new WriteDrawOp();
op.Text = wArgs.message; op.Text = wArgs.message;
op.Scale = wArgs.scale; op.Spacing = wArgs.spacing; op.Scale = wArgs.scale; op.Spacing = wArgs.spacing;
Brush brush = new SolidBrush(block); Brush brush = new SolidBrush(block);
return DrawOpPerformer.Do(op, brush, p, marks); DrawOpPerformer.Do(op, brush, p, marks);
return true;
} }
struct WriteArgs { public byte scale, spacing; public string message; } struct WriteArgs { public byte scale, spacing; public string message; }

View File

@ -59,7 +59,10 @@ namespace MCGalaxy.Commands.Building {
BrushFactory factory = BrushFactory.Find(GetBrush(p, dArgs, ref offset)); BrushFactory factory = BrushFactory.Find(GetBrush(p, dArgs, ref offset));
BrushArgs bArgs = GetBrushArgs(dArgs, offset); BrushArgs bArgs = GetBrushArgs(dArgs, offset);
Brush brush = factory.Construct(bArgs); Brush brush = factory.Construct(bArgs);
return brush != null && DrawOpPerformer.Do(dArgs.Op, brush, p, marks); if (brush == null) return false;
DrawOpPerformer.Do(dArgs.Op, brush, p, marks);
return true;
} }
protected virtual string PlaceMessage { protected virtual string PlaceMessage {

View File

@ -48,7 +48,8 @@ namespace MCGalaxy.Commands.Building {
if (brush == null) return false; if (brush == null) return false;
DrawOp op = new CuboidDrawOp(); DrawOp op = new CuboidDrawOp();
return DrawOpPerformer.Do(op, brush, p, marks); DrawOpPerformer.Do(op, brush, p, marks);
return true;
} }
public override void Help(Player p) { public override void Help(Player p) {

View File

@ -59,9 +59,8 @@ namespace MCGalaxy.Drawing.Ops {
Player.Message(p, "Drawing commands are turned off on this map."); Player.Message(p, "Drawing commands are turned off on this map.");
return false; return false;
} }
if (lvl != null && lvl.BuildAccess.Check(p) == AccessResult.Blacklisted) { if (lvl != null && !lvl.BuildAccess.CheckDetailed(p)) {
Player.Message(p, "You are blacklisted from building in this map, " + Player.Message(p, "Hence you cannot use draw commands on this map.");
"hence you cannot draw in this map");
return false; return false;
} }