From d63b498c31422b5c291b3b12ef032fb3977bdd19 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 22 Mar 2020 23:33:05 +1100 Subject: [PATCH] Make creating args virtual in DrawCmd --- MCGalaxy/Commands/building/DrawCmd.cs | 23 ++++++++++++++--------- MCGalaxy/Levels/Level.cs | 5 ----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/MCGalaxy/Commands/building/DrawCmd.cs b/MCGalaxy/Commands/building/DrawCmd.cs index 9f680b5be..8438666da 100644 --- a/MCGalaxy/Commands/building/DrawCmd.cs +++ b/MCGalaxy/Commands/building/DrawCmd.cs @@ -34,14 +34,7 @@ namespace MCGalaxy.Commands.Building { protected const string BrushHelpLine = " %HFor help about brushes, type %T/Help Brush"; public override void Use(Player p, string message, CommandData data) { - message = message.ToLower(); - string[] parts = message.SplitSpaces(); - - DrawArgs dArgs = new DrawArgs(); - dArgs.Message = message; - dArgs.Player = p; - dArgs.Mode = GetMode(parts); - dArgs.Op = GetDrawOp(dArgs); + DrawArgs dArgs = MakeArgs(p, message); if (dArgs.Op == null) return; // 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); } + 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) { DrawArgs dArgs = (DrawArgs)state; dArgs.Block = block; @@ -69,7 +74,7 @@ namespace MCGalaxy.Commands.Building { } BrushFactory MakeBrush(DrawArgs args) { - args.BrushName = args.Player.BrushName; + args.BrushName = args.Player.BrushName; args.BrushArgs = ""; GetBrush(args); diff --git a/MCGalaxy/Levels/Level.cs b/MCGalaxy/Levels/Level.cs index 0fff8486a..fd7175a8c 100644 --- a/MCGalaxy/Levels/Level.cs +++ b/MCGalaxy/Levels/Level.cs @@ -180,11 +180,6 @@ namespace MCGalaxy { } } - /// Returns whether the given coordinates are insides the boundaries of this level. - 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); } // Returns true if ListCheck does not already have an check in the position.