예제 #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);
            }
        }
예제 #2
0
파일: CmdSpin.cs 프로젝트: rdebath/MCGalaxy
        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;

            // /Mirror used to be part of spin
            if (opt.CaselessStarts("mirror"))
            {
                p.Message("&T/Spin {0} &Sis deprecated. Use &T/Mirror &Sinstead", opt);
                return;
            }

            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);
        }
예제 #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);
            }
        }