Beispiel #1
0
        void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType)
        {
            CatchPos cpos = (CatchPos)p.blockchangeObject;

            RevertAndClearState(p, x, y, z);
            int       offX = p.copyoffset[0] + x, offY = p.copyoffset[1] + y, offZ = p.copyoffset[2] + z;
            CopyState state = p.CopyBuffer;

            if (state.X != state.OriginX)
            {
                offX -= (state.Width - 1);
            }
            if (state.Y != state.OriginY)
            {
                offY -= (state.Height - 1);
            }
            if (state.Z != state.OriginZ)
            {
                offZ -= (state.Length - 1);
            }

            DrawOp op;

            if (cpos.message == "")
            {
                op = new SimplePasteDrawOp();
                ((SimplePasteDrawOp)op).CopyState = p.CopyBuffer;
            }
            else
            {
                op = new PasteDrawOp();
                ((PasteDrawOp)op).CopyState = p.CopyBuffer;
                string[] args = cpos.message.Split(' ');
                if (args[0].CaselessEq("not"))
                {
                    ((PasteDrawOp)op).Exclude = ReplaceBrush.GetBlocks(p, 1, args.Length, args);
                }
                else
                {
                    ((PasteDrawOp)op).Include = ReplaceBrush.GetBlocks(p, 0, args.Length, args);
                }
            }

            if (!DrawOp.DoDrawOp(op, null, p, (ushort)offX, (ushort)offY, (ushort)offZ, 0, 0, 0))
            {
                return;
            }
            if (p.staticCommands)
            {
                p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
            }
        }
Beispiel #2
0
        bool DoPaste(Player p, Vec3S32[] m, object state, byte type, byte extType)
        {
            string    message = (string)state;
            CopyState cState  = p.CopyBuffer;

            m[0] += cState.Offset;

            if (message == "")
            {
                SimplePasteDrawOp simpleOp = new SimplePasteDrawOp();
                simpleOp.CopyState = p.CopyBuffer;
                return(DrawOp.DoDrawOp(simpleOp, null, p, m));
            }

            PasteDrawOp op = new PasteDrawOp();

            op.CopyState = p.CopyBuffer;
            string[] args = message.Split(' ');

            if (args[0].CaselessEq("not"))
            {
                op.Exclude = ReplaceBrushFactory.GetBlocks(p, 1, args.Length, args);
                if (op.Exclude == null)
                {
                    return(false);
                }
            }
            else
            {
                op.Include = ReplaceBrushFactory.GetBlocks(p, 0, args.Length, args);
                if (op.Include == null)
                {
                    return(false);
                }
            }
            return(DrawOp.DoDrawOp(op, null, p, m));
        }