public override void Perform(Vec3S32[] marks, Brush brush, DrawOpOutput output)
        {
            Vec3U16 p1 = Clamp(Min), p2 = Clamp(Max);

            baseOp.Setup(Player, Level, marks);
            wallOp.Setup(Player, Level, marks);

            while (true)
            {
                wallOp.Perform(marks, brush, output);
                if (p1.Y >= Level.Height || Math.Abs(p2.X - p1.X) <= 1 || Math.Abs(p2.Z - p1.Z) <= 1)
                {
                    return;
                }

                p1.X++; p2.X--;
                p1.Z++; p2.Z--;
                wallOp.Min = p1; wallOp.Max = p2;
                baseOp.Min = p1; baseOp.Max = p2;

                baseOp.Perform(marks, airBrush, output);
                p1.Y       = (ushort)(p1.Y + yDir); p2.Y = p1.Y;
                wallOp.Min = p1; wallOp.Max = p2;
                baseOp.Min = p1; baseOp.Max = p2;
            }
        }
Exemple #2
0
        public static bool Do(DrawOp op, Brush brush, Player p,
                              Vec3S32[] marks, bool checkLimit = true)
        {
            Level lvl = p.level;

            op.Setup(p, lvl, marks);

            if (lvl != null && !lvl.Config.Drawing && !op.AlwaysUsable)
            {
                p.Message("Drawing commands are turned off on this map.");
                return(false);
            }
            if (lvl != null && CannotBuildIn(p, lvl))
            {
                return(false);
            }

            long affected = op.BlocksAffected(lvl, marks);

            if (op.AffectedByTransform)
            {
                p.Transform.GetBlocksAffected(ref affected);
            }
            if (checkLimit && !op.CanDraw(marks, p, affected))
            {
                return(false);
            }

            if (brush != null && affected != -1)
            {
                const string format = "{0}({1}): affecting up to {2} blocks";
                if (!p.Ignores.DrawOutput)
                {
                    p.Message(format, op.Name, brush.Name, affected);
                }
            }
            else if (affected != -1)
            {
                const string format = "{0}: affecting up to {1} blocks";
                if (!p.Ignores.DrawOutput)
                {
                    p.Message(format, op.Name, affected);
                }
            }

            DoQueuedDrawOp(p, op, brush, marks);
            return(true);
        }
        public override void Perform(Vec3S32[] marks, Brush brush, DrawOpOutput output)
        {
            Vec3S32 p1 = Min, p2 = Max;

            baseOp.Setup(Player, Level, marks);

            while (p1.Y >= 0 && p1.Y < Level.Height && p1.X <= p2.X && p1.Z <= p2.Z)
            {
                baseOp.Min = p1; baseOp.Max = p2;
                baseOp.Perform(marks, brush, output);

                p1.X++; p2.X--;
                p1.Z++; p2.Z--;
                p1.Y += yDir; p2.Y = p1.Y;
            }
        }