Make creating args virtual in DrawCmd

This commit is contained in:
UnknownShadow200 2020-03-22 23:33:05 +11:00
parent 4a2dc63947
commit d63b498c31
2 changed files with 14 additions and 14 deletions

View File

@ -34,14 +34,7 @@ namespace MCGalaxy.Commands.Building {
protected const string BrushHelpLine = " %HFor help about brushes, type %T/Help Brush"; protected const string BrushHelpLine = " %HFor help about brushes, type %T/Help Brush";
public override void Use(Player p, string message, CommandData data) { public override void Use(Player p, string message, CommandData data) {
message = message.ToLower(); DrawArgs dArgs = MakeArgs(p, message);
string[] parts = message.SplitSpaces();
DrawArgs dArgs = new DrawArgs();
dArgs.Message = message;
dArgs.Player = p;
dArgs.Mode = GetMode(parts);
dArgs.Op = GetDrawOp(dArgs);
if (dArgs.Op == null) return; if (dArgs.Op == null) return;
// Validate the brush syntax is correct // Validate the brush syntax is correct
@ -53,6 +46,18 @@ namespace MCGalaxy.Commands.Building {
p.MakeSelection(MarksCount, "Selecting " + SelectionType + " for %S" + dArgs.Op.Name, dArgs, DoDraw); p.MakeSelection(MarksCount, "Selecting " + SelectionType + " for %S" + dArgs.Op.Name, dArgs, DoDraw);
} }
protected virtual DrawArgs MakeArgs(Player p, string message) {
DrawArgs dArgs = new DrawArgs();
message = message.ToLower();
string[] parts = message.SplitSpaces();
dArgs.Message = message;
dArgs.Player = p;
dArgs.Mode = GetMode(parts);
dArgs.Op = GetDrawOp(dArgs);
return dArgs;
}
protected virtual bool DoDraw(Player p, Vec3S32[] marks, object state, BlockID block) { protected virtual bool DoDraw(Player p, Vec3S32[] marks, object state, BlockID block) {
DrawArgs dArgs = (DrawArgs)state; DrawArgs dArgs = (DrawArgs)state;
dArgs.Block = block; dArgs.Block = block;
@ -69,7 +74,7 @@ namespace MCGalaxy.Commands.Building {
} }
BrushFactory MakeBrush(DrawArgs args) { BrushFactory MakeBrush(DrawArgs args) {
args.BrushName = args.Player.BrushName; args.BrushName = args.Player.BrushName;
args.BrushArgs = ""; args.BrushArgs = "";
GetBrush(args); GetBrush(args);

View File

@ -180,11 +180,6 @@ namespace MCGalaxy {
} }
} }
/// <summary> Returns whether the given coordinates are insides the boundaries of this level. </summary>
public bool InBound(ushort x, ushort y, ushort z) {
return x >= 0 && y >= 0 && z >= 0 && x < Width && y < Height && z < Length;
}
public void SaveSettings() { if (!IsMuseum) Config.SaveFor(MapName); } public void SaveSettings() { if (!IsMuseum) Config.SaveFor(MapName); }
// Returns true if ListCheck does not already have an check in the position. // Returns true if ListCheck does not already have an check in the position.