Commands for placing specific blocks (solid, water, grass), and switching block placement modes (paint, bind).
コード例 #1
0
ファイル: BitmapDrawOp.cs プロジェクト: takaaptech/ProCraft
        public void Draw(Bitmap img)
        {
            //guess how big the draw will be
            int white = System.Drawing.Color.White.ToArgb();
            int left, right, top, bottom;
            int count = Crop(img, out left, out right, out top, out bottom);

            //check if player can make the drawing
            if (!player.CanDraw(count))
            {
                player.Message(String.Format("You are only allowed to run commands that affect up to {0} blocks. " +
                                             "This one would affect {1} blocks.",
                                             player.Info.Rank.DrawLimit, count));
                return;
            }

            int dirX = 0, dirY = 0;

            if (direction == Direction.PlusX)
            {
                dirX = 1;
            }
            if (direction == Direction.MinusX)
            {
                dirX = -1;
            }
            if (direction == Direction.PlusZ)
            {
                dirY = 1;
            }
            if (direction == Direction.MinusZ)
            {
                dirY = -1;
            }
            if (dirX == 0 && dirY == 0)
            {
                return;                         //if blockcount = 0, message is shown and returned
            }
            for (int yy = top; yy <= bottom; yy++)
            {
                for (int xx = left; xx <= right; xx++)
                {
                    if (img.GetPixel(xx, yy).ToArgb() == white)
                    {
                        continue;
                    }
                    int dx = xx - left, dy = bottom - yy;

                    Vector3I coords = new Vector3I(origin.X + dirX * dx, origin.Y + dirY * dx, origin.Z + dy);
                    BuildingCommands.DrawOneBlock(
                        player, player.World.Map, blockColor,
                        coords, BlockChangeContext.Drawn,
                        ref blocks, ref blocksDenied, undoState);
                    blockCount++;
                }
            }
        }
コード例 #2
0
 private static void MazeCuboidHandler(Player p, Command cmd)
 {
     try {
         MazeCuboidDrawOperation op = new MazeCuboidDrawOperation(p);
         BuildingCommands.DrawOperationBegin(p, cmd, op);
     } catch (Exception e) {
         Logger.Log(LogType.Error, "Error: " + e.Message);
     }
 }
コード例 #3
0
 // Sets up all the command hooks
 internal static void Init()
 {
     ModerationCommands.Init();
     BuildingCommands.Init();
     InfoCommands.Init();
     WorldCommands.Init();
     ZoneCommands.Init();
     MaintenanceCommands.Init();
     ChatCommands.Init();
 }
コード例 #4
0
 // Sets up all the command hooks
 internal static void Init()
 {
     ModerationCommands.Init();
     BuildingCommands.Init();
     InfoCommands.Init();
     WorldCommands.Init();
     ZoneCommands.Init();
     MaintenanceCommands.Init();
     ChatCommands.Init();
     Logger.Log(LogType.Debug,
                "CommandManager: {0} commands registered ({1} hidden, {2} aliases)",
                Commands.Count,
                GetCommands(true).Length,
                Aliases.Count);
 }