Extension on /copy

Post all ideas and suggestions for fCraft here
Post Reply
User avatar
Pavoneo
Offline
Posts: 26
Joined: September 25th, 2011, 2:17 pm

Extension on /copy

Post by Pavoneo »

So, it's a pretty straight forward command. Basically, you could have a /r command on your copyslot. It'd be like the standard /r command we have now, but it'd be for your copy slots, it replaces the blocks on your current copyslot. /copyr or something maybe? I see myself being able to use this command all the time. Just a suggestion. :P
AtraxXx_Beer: um pav where should i set my entrance?
Pavoneo: My mouth
Pavoneo: Oh, too awkward?
Pavoneo: Ok.

BobKare
Offline
Posts: 279
Joined: May 26th, 2011, 2:15 pm

Re: Extension on /copy

Post by BobKare »

Not necessary for people with super powers.
Show

User avatar
boblol0909
SupOP
Offline
Posts: 314
Joined: June 24th, 2011, 10:27 pm

Re: Extension on /copy

Post by boblol0909 »

If anyone wants to mod theirs, here's a basic one:

Code: Select all

CommandManager.RegisterCommand(CdReplaceSlot);

static readonly CommandDescriptor CdReplaceSlot = new CommandDescriptor {
            Name = "ReplaceSlot",
            Aliases = new[] { "rs" },
            Category = CommandCategory.Building,
            Permissions = new[] { Permission.CopyAndPaste },
            Usage = "/ReplaceSlot Block1 Block2",
            Help = "Replaces all of block1 with block2 in the current copyslot.",
            Handler = ReplaceSlotHandler
        };

static void ReplaceSlotHandler(Player player, Command cmd) {
            Block block1, block2;
            block1 = cmd.NextBlock(player);
            block2 = cmd.NextBlock(player);
            if (block1 == Block.Undefined || block2 == Block.Undefined) {
                return;
            }           
            
            CopyState temp = player.GetCopyInformation();
            if (temp == null) {
                player.Message("The current copyslot is empty.");
                return;
            }
            for (int x = 0; x < temp.Dimensions.X; x++) {
                for (int y = 0; y < temp.Dimensions.Y; y++) {
                    for (int z = 0; z < temp.Dimensions.Z; z++) {
                        if (temp.Buffer[x, y, z] == block1)
                            temp.Buffer[x, y, z] = block2;
                    }
                }
            }
            player.SetCopyInformation(temp);
            player.Message(String.Format("All of block {0} replaced with {1} in copyslot {2}.", block1, block2, player.CopySlot+1));
        }

User avatar
Pavoneo
Offline
Posts: 26
Joined: September 25th, 2011, 2:17 pm

Re: Extension on /copy

Post by Pavoneo »

BobKare wrote:Not necessary for people with super powers.
Show
Yeah, I know I could do that, but what if you're in a situation where you have current blocks down, and you want to /pastenot air over it/near it any when /r'ing it, there's a bunch of blocks you wouldn't like to be /r'd and it'd just become troublesome. I know you could also paste next to it and /replace the blocks and recopy it then paste it. But that could be time consuming and if it's a large copy, it may not fit on the entire map. This is somewhat of a luxury command. :P
AtraxXx_Beer: um pav where should i set my entrance?
Pavoneo: My mouth
Pavoneo: Oh, too awkward?
Pavoneo: Ok.

BobKare
Offline
Posts: 279
Joined: May 26th, 2011, 2:15 pm

Re: Extension on /copy

Post by BobKare »

Wait... Just took a look at your username...
I know who you are! xD

Post Reply