Copy Paste

Copy and paste your buildings to save them or move them

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

5/5, 83 likes
  1. @Reneb

    For signs:
    In LustyMap, Wulf just changed this line :
    Code:
    uint textureID = FileStorage.server.Store(stream, FileStorage.Type.png, uint.MaxValue);
    
    By this line :
    Code:
    uint textureID = FileStorage.server.Store(stream, FileStorage.Type.png, CommunityEntity.ServerInstance.net.ID);
    I dunno if it can help you..
    [DOUBLEPOST=1480774101][/DOUBLEPOST]Ah, just saw, it solved by an oxide fix x). Thanks
     
  2. I tried autoheight... it still did not work.
     
  3. so do i need to fix it? or it works?
     
  4. It works. All sign art now works.
    One guy cant paste an old file, but there is nothing anyone can do.
     
  5. Yeah everytime I try to paste a building even if I built it at maximum height off ground it still those.. isn't there a fix for that?
     
  6. Just use the height command variable.

    /paste nameofcopy height 1
    or
    /placeback nameofcopy height 1

    to make it higher you can use 2, 3, 4, etc.
     
  7. how save my building after wipe?
     
  8. Couple things came up for me. When I use radius command objects such as bushes, cactus and trees are always pasted back, please filter these out because i get floating objects in the air and have to reset environment. Also when I use autoheight it always fails with too steep error I really need this autoheight to work properly, is there any way to fix it?

    So I tried to write my own plugin and call your paste function to paste a building based on saved name, but it fails with the following, how can I successfully call it please?:

    Calling with:
    Code:
    message = PluginTest.CallHook("cmdChatPaste", message).ToString();
    Code:
    [Error] Failed to call hook 'cmdChatPaste' on plugin 'CopyPaste v3.0.19' (InvalidCastException: Cannot cast from source type to destination type.)
    (21:31:58) | [Oxide] 20:31 [Debug]   at Oxide.Plugins.CopyPaste.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
    (21:31:58) | [Oxide] 20:31 [Error] Failed to call hook 'RaidCall' on plugin 'RaidEvent v1.0.0' (NullReferenceException: Object reference not set to an instance of an object)
    (21:31:58) | [Oxide] 20:31 [Debug]   at Oxide.Plugins.RaidEvent.RaidFunction () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.RaidEvent.RaidCall (.BasePlayer player) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.RaidEvent.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
     
    Last edited by a moderator: Dec 8, 2016
  9. you can do: /paste XX height XX
    if you dont like it: /undo
    then /paste XX height MOREXX
     
  10. Yeah that's what I do now, I just don't like it. Is it ok if I modify the plugin the way I want and not distribute it? What I'd like it to do is use autoheight paste on the point a player is looking at and if possible paste the object automagically.
     
  11. Is it really to do something like that for hurtworld?
     
  12. There seems to be a problem using
    Code:
    autoheight true
    when placing buildings on higher terrain, it generally returns "The ground is too steep". This seems to be a result of FindBestHeight never setting the minHeight due to it's starting value 0f being lower than any ground point under a foundation, and then failing the check that the minHeight is much lower than the terrain, and therefore hitting this.
    Code:
                if (maxHeight - minHeight > 3f) return "The ground is too steep";
    I noticed that "FindBestHeight" initially sets the minHeight to 0f;
    Code:
    float minHeight = 0f;
    and the checks each foundation block for it's ground height. This means that if you you are using autoheight, and placing the building on terrain above ground level, it will find the ground height is higher than 0f, and never change the minHeight;
    Code:
    if (height.y < minHeight) minHeight = height.y;
    If the code is changed to something like this, then it correctly finds the min ground level on higher terrain, and autoheight works...
    Code:
            object FindBestHeight(List<Dictionary<string,object>> entities, Vector3 startPos)
            {
                float minHeight = 999f;
                float maxHeight = 0f;
                foreach(var entity in entities)
                {
                    if(((string)entity["prefabname"]).Contains("/foundation/"))
                    {
                        var foundHeight = GetGround((Vector3)entity["position"]);
                        if(foundHeight != null)
                        {
                            var height = (Vector3)foundHeight;
                            if (height.y > maxHeight) maxHeight = height.y;
                            if (height.y < minHeight) minHeight = height.y;
                        }
                    }
                }
                if (maxHeight - minHeight > 3f) return "The ground is too steep";
                return maxHeight;
            }
    For example, see with
    Code:
    float minHeight = 0f;
    2016-12-15-062841.normal.png

    and with
    Code:
    float minHeight = 999f;
    2016-12-15-062953.large.nohud.png
    [DOUBLEPOST=1481784371][/DOUBLEPOST]There would also seem to be a similar problem with maxHeight, in that it will never find a maxHeight below the terrain. However that problem is masked by a problem with the parameters to Physics.Raycast. Basically the signature is this;
    Code:
    public static bool Raycast(Vector3 origin, Vector3 direction, float maxDistance = Mathf.Infinity, int layerMask = DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal);
    so the ground layer mask, is actually being passed in as the maxDistance;

    Code:
            object GetGround(Vector3 pos)
            {
                RaycastHit hitInfo;
                if (Physics.Raycast(pos, Vector3.up, out hitInfo, groundLayer))
                {
                    return hitInfo.point;
                }
                if (Physics.Raycast(pos, Vector3.down, out hitInfo, groundLayer))
                {
                    return hitInfo.point;
                }
                return null;
            }
    and so if you actually want to be able to place a building on the terrainLayer at the bottom of the sea, then it would need to be something like this;
    Code:
                RaycastHit hitInfo;
                if (Physics.Raycast(pos, Vector3.up, out hitInfo, Mathf.Infinity, groundLayer))
                {
                    Puts("up point " + hitInfo.point + " for point "+ pos);
                    Puts("hit up point");
                    return hitInfo.point;
                }
                if (Physics.Raycast(pos, Vector3.down, out hitInfo, Mathf.Infinity, groundLayer))
                {
                    Puts("down point "+ hitInfo.point + " for point " + pos);
                    Puts("hit down point");
                    return hitInfo.point;
                }
                return null;
    and also set maxHeight;
    Code:
    float maxHeight = -999f;
    and if you want to put the building on the surface of the water anyway, something like this;

    Code:
                RaycastHit hitInfo;
                if (Physics.Raycast(pos, Vector3.up, out hitInfo, Mathf.Infinity, terrainLayer))
                {
                    return hitInfo.point;
                }
                if (Physics.Raycast(pos, Vector3.down, out hitInfo, Mathf.Infinity, terrainLayer))
                {
                    return hitInfo.point;
                }
                return null;
     
    Last edited by a moderator: Dec 15, 2016
  13. Hello, I have some errors I can't copy a build

    (16:39:59) | [Oxide] 16:40 [Error] Failed to call hook 'cmdChatCopy' on plugin 'CopyPaste v3.0.19' (JsonSerializationException: Self referencing loop detected for property 'normalized' with type 'UnityEngine.Vector3'. Path 'entities[0].position.normalized'.)
    (16:39:59) | [Oxide] 16:40 [Debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CheckForCircularReference (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x00000] in <filename unknown>:0
    at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContainerContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.Serialization.JsonContract& memberContract, System.Object& memberValue) [0x00000] in <filename unknown>:0
    at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x00000] in <filename unknown>:0
    (16:39:59) | [Oxide] 16:40 [Warning] Calling 'cmdChatCopy' on 'CopyPaste v3.0.19' took 357ms
     
  14. How can i delete a copy i made or show the list of copied templates
     
  15. From a quick look at the code, there isn't a chat command for list or delete. The simplest thing would be to look in the directory under oxide/data/copypaste which will contain all the copypaste files which you can delete individually.
     
    Last edited by a moderator: Dec 21, 2016
  16. so I have been using the mod a few weeks and I love it but now I'm at the point where I have copied loads and forgotten the names.... any command to list the names of the files you make when doing a copy?
     
  17. It looks like listing the contents of the data file directory is blocked;
    Code:
    [12/21/2016 23:25:35] [Oxide] 23:25 [Error] Failed to call hook 'cmdChatList' on plugin 'CopyPaste v3.0.18'
    (UnauthorizedAccessException: System access is restricted, you are not allowed to use System.IO.Path)
    
    So you would have to go and inspect the files in the folder directly...

    Capture111.PNG
     
  18. I could imagine a patch to copypaste which would keep track of the files created using a datafile, and then that list could be used for delete/list chat commands.
     
  19. i could, but it wouldn't track new files nor deleted files, so it's pointless
     
  20. Thanks much