diff --git a/Commands/building/CmdPaste.cs b/Commands/building/CmdPaste.cs index e99d61a94..c68b10a3a 100644 --- a/Commands/building/CmdPaste.cs +++ b/Commands/building/CmdPaste.cs @@ -41,10 +41,6 @@ namespace MCGalaxy.Commands.Building { string message = (string)state; CopyState cState = p.CopyBuffer; m[0] += cState.Offset; - - if (cState.X != cState.OriginX) m[0].X -= (cState.Width - 1); - if (cState.Y != cState.OriginY) m[0].Y -= (cState.Height - 1); - if (cState.Z != cState.OriginZ) m[0].Z -= (cState.Length - 1); if (message == "") { SimplePasteDrawOp simpleOp = new SimplePasteDrawOp(); diff --git a/Drawing/DrawOps/PasteDrawOp.cs b/Drawing/DrawOps/PasteDrawOp.cs index 6bd5e3467..3770969c1 100644 --- a/Drawing/DrawOps/PasteDrawOp.cs +++ b/Drawing/DrawOps/PasteDrawOp.cs @@ -28,6 +28,17 @@ namespace MCGalaxy.Drawing.Ops { return CopyState.UsedBlocks; } + public override void SetMarks(Vec3S32[] m) { + Origin = m[0]; + CopyState cState = CopyState; + if (cState.X != cState.OriginX) m[0].X -= (cState.Width - 1); + if (cState.Y != cState.OriginY) m[0].Y -= (cState.Height - 1); + if (cState.Z != cState.OriginZ) m[0].Z -= (cState.Length - 1); + + Min = m[0]; Max = m[0]; + Max.X += cState.Width; Max.Y += cState.Height; Max.Z += cState.Length; + } + public override void Perform(Vec3S32[] marks, Player p, Level lvl, Brush brush, Action output) { CopyState state = CopyState; bool pasteAir = state.PasteAir; @@ -41,22 +52,17 @@ namespace MCGalaxy.Drawing.Ops { ushort x = (ushort)(locX + x1), y = (ushort)(locY + y1), z = (ushort)(locZ + z1); if ((b != Block.air || pasteAir) && lvl.InBound(x, y, z)) - output(Place(x, y, z, b, extB)); + output(Place(x, y, z, b, extB)); } } } - public class PasteDrawOp : DrawOp { + public class PasteDrawOp : SimplePasteDrawOp { - public CopyState CopyState; public ExtBlock[] Include, Exclude; public override string Name { get { return "Paste"; } } - public override long BlocksAffected(Level lvl, Vec3S32[] marks) { - return CopyState.UsedBlocks; - } - public override void Perform(Vec3S32[] marks, Player p, Level lvl, Brush brush, Action output) { CopyState state = CopyState; bool pasteAir = state.PasteAir; @@ -88,7 +94,7 @@ namespace MCGalaxy.Drawing.Ops { for (int j = 0; j < include.Length; j++) { ExtBlock block = include[j]; if (b == block.Block && (b != Block.custom_block || extB == block.Ext)) { - output(Place(x, y, z, b, extB)); break; + output(Place(x, y, z, b, extB)); break; } } } diff --git a/Drawing/Transform/RotateTransform.cs b/Drawing/Transform/RotateTransform.cs index 6d48a1fd1..07917d86a 100644 --- a/Drawing/Transform/RotateTransform.cs +++ b/Drawing/Transform/RotateTransform.cs @@ -43,7 +43,7 @@ namespace MCGalaxy.Drawing.Transforms { DrawOp op, Brush brush, Action output) { P = (op.Min + op.Max) / 2; width = lvl.Width; height = lvl.Height; length = lvl.Length; - if (!CentreOrigin) P = op.Origin; + if (!CentreOrigin) P = op.Origin; op.Perform(marks, p, lvl, brush, b => OutputBlock(b, output)); } diff --git a/Drawing/TransformFactories/RotateTransform.cs b/Drawing/TransformFactories/RotateTransform.cs index 5cc4a6e74..005caeef9 100644 --- a/Drawing/TransformFactories/RotateTransform.cs +++ b/Drawing/TransformFactories/RotateTransform.cs @@ -46,6 +46,7 @@ namespace MCGalaxy.Drawing.Transforms { if (!args[args.Length - 1].CaselessEq("centre")) { Player.Message(p, "The mode must be either \"centre\", or not given."); return null; } + rotater.CentreOrigin = true; return rotater; } diff --git a/Drawing/TransformFactories/SimpleTransforms.cs b/Drawing/TransformFactories/SimpleTransforms.cs index f92078492..a19dd89ea 100644 --- a/Drawing/TransformFactories/SimpleTransforms.cs +++ b/Drawing/TransformFactories/SimpleTransforms.cs @@ -68,6 +68,7 @@ namespace MCGalaxy.Drawing.Transforms { if (!args[args.Length - 1].CaselessEq("centre")) { Player.Message(p, "The mode must be either \"centre\", or not given."); return null; } + scaler.CentreOrigin = true; return scaler; }