Copy Paste

Copy and paste your buildings to save them or move them

Total Downloads: 21,546 - First Release: Apr 3, 2015 - Last Update: Jun 14, 2018

5/5, 83 likes
  1. thank you :)
     
  2. @miRror please please please could you add a command to paste something into the center of an existing zone or to co ords?
     
  3. Zone from ZoneManager?
     
  4. Yes, or even co ords, but into a zone would be the dream.

    This plus our town every wipe is why:

     
  5. I haven't even downloaded the plugin yet, and I'm already excited to use it!
     
  6. @miRror Any chance of that feature before out Sunday wipe? :)
     
  7. I can do an paste built into the center of zone as a separate plugin. I think that in the basic plugin, this feature will be superfluous.
     
  8. Cool, willing to pay for the separate plugin
     
    Last edited by a moderator: Jun 21, 2017
  9. You want an option that will allow you to paste in center of zone by command "/zonepaste NAME" where name is zone name?
     
  10. So it'd be

    /zonepaste zonename pastefilename

    that would paste to the center of the zone. if so yes.

    Presumably they'd paste with the same orientation so the existing spawn points wouldnt need to be redone (after the first time we used it) either, and poof, you would have cut over an hour out of our wipe set up :)
     
  11. Good, will try to do.
     
  12. Would there be any way to have a command for it take into account the position of whats in a zone and repaste something in the same position? We have boats that we paste at height -1 (so they sit on the water nicely) in one of our zones.

    If not I guess we could just keep moving the center of the closer to the water zone til we can use the function you mentioned before so that they paste in nicely.
     
  13. Can remove all of your buildings within the zone
     
  14. Any progress? :) Wipin Sunday
     
  15. everytime i try to copy a base it jsut crashes the server /copy base radius 40
     
  16. Radius doesn't work well on land. It tries to copy everything including all the trees and just won't stop. If you want to do a radius for it to do a bunch of buildings. Copy them individually and paste em out at sea. Then use radius copy to get em all. However I warn you it's gonna be unlikely they'll paste in nicely on land
     
    Last edited by a moderator: Jun 24, 2017
  17. Same here. I tried to copy one of our combat arenas and I'm having no luck. I tried using the radius but that just crashed the server same as you Wombat. Scared to touch that again. I tried to use /copy <name> but it only seems to copy the first 3 floors and nothing above that. I tried copy it from the top down, but the same thing happens. I just had to redo it manually this wipe. Would be nice if this can be updated to copy the entire structure. Thank you
     
  18. miRror updated Copy Paste with a new update entry:

    3.2.7


    [DOUBLEPOST=1498492421][/DOUBLEPOST]
    Sorry, it was not possible to answer, I will try to do today.
     
  19. @Corrosive test this:
    http://joxi.ru/MAjMa8pI4KwPg2.png

    PasteZone.cs:
    Code:
    using Oxide.Core.Plugins;
    using System.Collections.Generic;
    using UnityEngine;namespace Oxide.Plugins
    {
        [Info("Paste Zone", "miRror", "1.0.0")]    public class PasteZone : RustPlugin
        {
            [PluginReference] Plugin CopyPaste, ZoneManager;        //Hooks
        
            private void Init()
            {
                Dictionary<string, Dictionary<string, string>> compiledLangs = new Dictionary<string, Dictionary<string, string>>();
            
                foreach(var line in messages)
                {
                    foreach(var translate in line.Value)
                    {
                        if(!compiledLangs.ContainsKey(translate.Key))
                            compiledLangs[translate.Key] = new Dictionary<string, string>();
                    
                        compiledLangs[translate.Key][line.Key] = translate.Value;
                    }            
                }
            
                foreach(var cLangs in compiledLangs)
                {
                    lang.RegisterMessages(cLangs.Value, this, cLangs.Key);
                }
            }
        
            //Chat commands
        
            [ChatCommand("pastezone")]
            private void cmdChatPasteZone(BasePlayer player, string command, string[] args)
            {
                if(args.Length < 2)
                {
                    SendReply(player, Lang("FORMAT_PASTEZONE", player.UserIDString));
                    return;
                }
            
                Vector3 pos = (Vector3)ZoneManager.Call("GetZoneLocation", args[0]);
            
                if(pos == Vector3.zero)
                {
                    SendReply(player, Lang("ZONE_NOT_EXISTS", player.UserIDString));
                    return;
                }
            
                List<string> options = new List<string>{ /* "auth", "true" */ };            var success = CopyPaste.Call("TryPasteFromVector3", pos, pos, args[1], options.ToArray());            if(success is string)
                {
                    SendReply(player, Lang("PASTEZONE_FAILURE", player.UserIDString));
                    return;
                }            SendReply(player, Lang("PASTEZONE_SUCCESS", player.UserIDString, args[0]));
            }        //Other methods
        
            private string Lang(string key, string userID = null, params object[] args) => string.Format(lang.GetMessage(key, this, userID), args);    
        
            //Languages phrases
        
            private readonly Dictionary<string, Dictionary<string, string>> messages = new Dictionary<string, Dictionary<string, string>>
            {
                {"FORMAT_PASTEZONE", new Dictionary<string, string>() {
                    {"en", "Syntax: <color=orange>/pastezone ZONEID BUILDINGNAME</color>"},
                    {"ru", "Формат команды: <color=orange>/pastezone ZONEID BUILDINGNAME</color>"},
                }},
                {"ZONE_NOT_EXISTS", new Dictionary<string, string>() {
                    {"en", "Zone by ID not found"},
                    {"ru", "Зона по указанному ID не найдена"},
                }},
                {"PASTEZONE_FAILURE", new Dictionary<string, string>() {
                    {"en", "Error pasting"},
                    {"ru", "Ошибка вставки постройки"},
                }},
                {"PASTEZONE_SUCCESS", new Dictionary<string, string>() {
                    {"en", "Buildings successful pasted in zone <color=orange>{0}</color>"},
                    {"ru", "Постройка успешно вставлена в зону <color=orange>{0}</color>"},
                }},            
            };
        }
    }
     
  20. Says it pasted, got the expected frame drop but didn't paste.

    EDIT: Ah, found it, it pasted on the ground, zone is 3500 in the air (the second one is me trying it again). So yeh its not pasting in the center of a zone

    upload_2017-6-27_20-34-16.png

    Same thing happens at sea regardless of zone height

    upload_2017-6-27_20-48-31.png

    Code:
    (20:42:20) | Calling 'TryPasteFromVector3' on 'CopyPaste v3.2.6' took 1440ms
    (20:42:20) | Calling 'cmdChatPasteZone' on 'PasteZone v1.0.0' took 1442ms
    (20:44:00) | Calling 'cmdChatZone' on 'ZoneManager v2.4.20' took 244ms
    (20:44:20) | Calling 'TryPasteFromVector3' on 'CopyPaste v3.2.6' took 1184ms
    (20:44:20) | Calling 'cmdChatPasteZone' on 'PasteZone v1.0.0' took 1185ms
    (20:44:51) | Calling 'cmdChatZone' on 'ZoneManager v2.4.20' took 244ms
    (20:45:50) | Calling 'cmdChatZone' on 'ZoneManager v2.4.20' took 246ms
     
    Last edited by a moderator: Jun 27, 2017