Copy Paste

Copy and paste your buildings to save them or move them

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

5/5, 83 likes
  1. Use new version:

    Code:
    using Oxide.Core.Plugins;
    using System.Collections.Generic;
    using UnityEngine;namespace Oxide.Plugins
    {
        [Info("Paste Zone", "miRror", "1.0.1")]
     
        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>{ "height", "0" };            var success = CopyPaste.Call("TryPasteFromVector3", pos, pos, args[1], options.ToArray());            if(success is string)
                {
                    SendReply(player, (string)success);
                    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_SUCCESS", new Dictionary<string, string>() {
                    {"en", "Buildings successful pasted in zone <color=orange>{0}</color>"},
                    {"ru", "Постройка успешно вставлена в зону <color=orange>{0}</color>"},
                }},             
            };
        }
    }
    [DOUBLEPOST=1498648793][/DOUBLEPOST]Just affects parameter autoheight. At current moment it is disabled.
     
  2. Awesome, works perfectly, thanks
     
  3. Hello, did something change? I used the line below to copy for months, and now it spits up the syntax error message.

    /copy NAMEOFBASE deployables true inventories true radius 10 mechanics building
     
  4. /copy NAMEOFBASE deployables true inventories true radius 10 method building
     
  5. Ahh got it, I thought I reread the overview, must have missed the method change. Thanks!
     
  6. He can no longer recover all the minerals from a copy. How to do

     
    Last edited by a moderator: Jul 5, 2017
  7. Too many items you put in stack
     
  8. @miRror Would it be possible to tweak the plugin to accomodate height better? We have 1 large structure that loses 3 floors and the flags at the top of our pirate ships dont get included most of the time
     
  9. http://joxi.ru/Dr8n7QNF45nv82.png

    Change 0 to 1, 2, 3, -1, -2, -2.5
     
  10. No no not pastezone, it's a problem we run into with Copy/Paste. What I mean is, the actual building itself, if its really tall will lose a bunch of the upper floors on the copy, not because of stability because stability is off, but it just doesnt seem to get copied.

    We've tried various ways with method proximity and radius but get the same result every time., Will post a screenshot in a sec.
     
  11. @miRror On the right is the building we are trying to copy and on the left is the copy paste we've tried. As @Corrosive mentioned, both proximity and radius get the same result, it only copies the bottom 2-3 floors and nothing above it. We also have a similar issue with a different event arena where the copy removes anything above a certain height. Stability is not an issue as we're pasting these in zones with no stability flags. Any ideas?

    Ignore the trees as we know its no longer copying them. Takes me 30 mins every wipe to redo the missing floors :)

    P.S. We're loving PasteZone, unfortunately cannot be used with the arenas we are unable to fully copy.

    upload_2017-7-8_13-8-42.png
     
    Last edited by a moderator: Jul 8, 2017
  12. Will do update on Monday
    [DOUBLEPOST=1499522093][/DOUBLEPOST]@Lana, try /copy NAME radius 10
     
  13. It hanged the server and it "packet flooding" kicked everyone, but it copied perfectly. Thanks for that
     
  14. @miRror Any chance of adding a config file to choose if we'd like to copy the trees or not?
     
  15. Yes. Will do update on Monday
     
  16. I love what you've done with the plugin @miRror, any chance you could let me know what exactly you mean by the "Vector3 direction?" Cheers!
     
  17. From player:
    Vector3 direction = Quaternion.Euler(player.GetNetworkRotation()).ToEulerAngles();
    [DOUBLEPOST=1499700132][/DOUBLEPOST]
    Offset relative to base angle of buildings
     
  18. Thanks!
     
  19. miRror updated Copy Paste with a new update entry:

    3.2.8

     
    Last edited by a moderator: Jul 10, 2017