public ReplaceBrushBrush([NotNull] ReplaceBrushBrush other) { if (other == null) { throw new ArgumentNullException("other"); } Block = other.Block; Replacement = other.Replacement; ReplacementInstance = other.ReplacementInstance; }
//copy-paste from BuildingCommands private static void DrawOperationBegin(Player player, Command cmd, DrawOperation op) { IBrushInstance instance = player.Brush.MakeInstance(player, cmd, op); if (instance != null) { op.Brush = instance; player.SelectionStart(op.ExpectedMarks, new SelectionCallback(DrawOperationCallback), op, new Permission[] { Permission.DrawAdvanced }); player.Message("{0}: Click {1} blocks or use &H/Mark&S to make a selection.", new object[] { op.Description, op.ExpectedMarks }); } }
public RandomMazeDrawOperation(Player player, Command cmd) : base(player) { int xSize = CommandOrDefault(cmd, DefaultXSize); int ySize = CommandOrDefault(cmd, DefaultYSize); int zSize = CommandOrDefault(cmd, DefaultZSize); ReadFlags(cmd); _cellSize = DefaultCellSize; _playersBrush = player.Brush.MakeInstance(player, cmd, this); _maze = new Maze(xSize, ySize, zSize); }
public ReplaceBrushBrush( [NotNull] ReplaceBrushBrush other ) { if( other == null ) throw new ArgumentNullException( "other" ); Block = other.Block; Replacement = other.Replacement; ReplacementInstance = other.ReplacementInstance; }
public IBrushInstance MakeInstance( [NotNull] Player player, [NotNull] Command cmd, [NotNull] DrawOperation op ) { if( player == null ) throw new ArgumentNullException( "player" ); if( cmd == null ) throw new ArgumentNullException( "cmd" ); if( op == null ) throw new ArgumentNullException( "op" ); if( cmd.HasNext ) { Block block = cmd.NextBlock( player ); if( block == Block.Undefined ) return null; string brushName = cmd.Next(); if( brushName == null || !CommandManager.IsValidCommandName( brushName ) ) { player.Message( "ReplaceBrush usage: &H/Brush rb <Block> <BrushName>" ); return null; } IBrushFactory brushFactory = BrushManager.GetBrushFactory( brushName ); if( brushFactory == null ) { player.Message( "Unrecognized brush \"{0}\"", brushName ); return null; } IBrush replacement = brushFactory.MakeBrush( player, cmd ); if( replacement == null ) { return null; } Block = block; Replacement = replacement; } ReplacementInstance = Replacement.MakeInstance( player, cmd, op ); if( ReplacementInstance == null ) return null; return new ReplaceBrushBrush( this ); }