Exemplo n.º 1
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                message = "y";
            }
            if (p.CopyBuffer == null)
            {
                Player.Message(p, "You haven't copied anything yet"); return;
            }
            string opt = message.ToLower();

            // Mirroring
            if (opt == "mirrorx" || opt == "mirror x")
            {
                Flip.MirrorX(p.CopyBuffer);
                Player.Message(p, "Flipped copy across the X (east/west) axis.");
            }
            else if (opt == "mirrory" || opt == "mirror y" || opt == "u")
            {
                Flip.MirrorY(p.CopyBuffer);
                Player.Message(p, "Flipped copy across the Y (vertical) axis.");
            }
            else if (opt == "mirrorz" || opt == "mirror z" || opt == "m")
            {
                Flip.MirrorZ(p.CopyBuffer);
                Player.Message(p, "Flipped copy across the Z (north/south) axis.");
            }
            else
            {
                string[] args  = opt.Split(' ');
                char     axis  = 'Y';
                int      angle = 90;
                if (!Handle(ref axis, ref angle, args[0]))
                {
                    Help(p); return;
                }
                if (args.Length > 1 && !Handle(ref axis, ref angle, args[1]))
                {
                    Help(p); return;
                }

                if (angle == 0)
                {
                }
                else if (axis == 'X')
                {
                    p.CopyBuffer = Flip.RotateX(p.CopyBuffer, angle);
                }
                else if (axis == 'Y')
                {
                    p.CopyBuffer = Flip.RotateY(p.CopyBuffer, angle);
                }
                else if (axis == 'Z')
                {
                    p.CopyBuffer = Flip.RotateZ(p.CopyBuffer, angle);
                }
                Player.Message(p, "Rotated copy {0} degrees around the {1} axis", angle, axis);
            }
        }
Exemplo n.º 2
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            if (p.CurrentCopy == null)
            {
                p.Message("You haven't copied anything yet"); return;
            }

            CopyState cState = p.CurrentCopy;

            BlockDefinition[] defs = p.level.CustomBlockDefs;

            foreach (string arg in message.SplitSpaces())
            {
                if (arg.CaselessEq("x"))
                {
                    Flip.MirrorX(cState, defs);
                    p.Message("Flipped copy across the X (east/west) axis.");
                }
                else if (arg.CaselessEq("y") || arg.CaselessEq("u"))
                {
                    Flip.MirrorY(cState, defs);
                    p.Message("Flipped copy across the Y (vertical) axis.");
                }
                else if (arg.CaselessEq("z"))
                {
                    Flip.MirrorZ(cState, defs);
                    p.Message("Flipped copy across the Z (north/south) axis.");
                }
            }
        }
Exemplo n.º 3
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                message = "y";
            }
            if (p.CurrentCopy == null)
            {
                p.Message("You haven't copied anything yet"); return;
            }

            CopyState cState = p.CurrentCopy;
            string    opt    = message.ToLower();

            BlockDefinition[] defs = p.level.CustomBlockDefs;

            // Mirroring
            if (opt == "mirrorx" || opt == "mirror x")
            {
                Flip.MirrorX(cState, defs);
                p.Message("Flipped copy across the X (east/west) axis.");
            }
            else if (opt == "mirrory" || opt == "mirror y" || opt == "u")
            {
                Flip.MirrorY(cState, defs);
                p.Message("Flipped copy across the Y (vertical) axis.");
            }
            else if (opt == "mirrorz" || opt == "mirror z" || opt == "m")
            {
                Flip.MirrorZ(cState, defs);
                p.Message("Flipped copy across the Z (north/south) axis.");
            }
            else
            {
                string[] args  = opt.SplitSpaces();
                char     axis  = 'Y';
                int      angle = 90;
                if (!Handle(ref axis, ref angle, args[0]))
                {
                    Help(p); return;
                }
                if (args.Length > 1 && !Handle(ref axis, ref angle, args[1]))
                {
                    Help(p); return;
                }

                CopyState newState = cState;
                if (angle == 0)
                {
                }
                else if (axis == 'X')
                {
                    newState = Flip.RotateX(cState, angle, defs);
                }
                else if (axis == 'Y')
                {
                    newState = Flip.RotateY(cState, angle, defs);
                }
                else if (axis == 'Z')
                {
                    newState = Flip.RotateZ(cState, angle, defs);
                }

                newState.CopySource = cState.CopySource;
                newState.CopyTime   = cState.CopyTime;
                p.CurrentCopy       = newState;
                p.Message("Rotated copy {0} degrees around the {1} axis", angle, axis);
            }
        }