EntityOwner

Moved

Total Downloads: 7,291 - First Release: Jul 23, 2015 - Last Update: Dec 8, 2017

5/5, 25 likes
  1. Calytic

    Calytic Community Admin Community Mod

    Calytic submitted a new resource:

    EntityOwner - Tracks ownership of placed constructions and deployables

    Read more about this resource...
     
  2. thank you calytic just what i was after awsome work dude
    [DOUBLEPOST=1437620079][/DOUBLEPOST]how do u make it so it puts everyone steam ids into a seperate data folder instead of it creating a file for everyone in the main data folder
     
  3. Calytic

    Calytic Community Admin Community Mod

  4. Version 0.1.9
    Code:
    [Oxide] 11:29 AM [Error] Failed to call hook 'OnServerInitialized' on plugin 'Entity Owner' (InvalidOperationException: Collection was modified; enumeration operation may not execute.)
     
  5. Calytic

    Calytic Community Admin Community Mod

    Calytic updated EntityOwner with a new update entry:

    OnServerInitialized attempted fix


    [DOUBLEPOST=1437624235][/DOUBLEPOST]
    Change the configuration option "useSubdirectory" to "true", create a directory called "owners" under oxide/data.

    This is not possible unless you have FTP access to your server and are willing to change the mods yourself. It might take some time (if ever) for other community mods to support EntityOwner.

    If you are comfortable making the changes and switching now, the only code you need to change is here:

    Code:
    -- ----------------------------------------------------------------------------
    -- PLUGIN:GetOwner( buildingBlock )
    -- ----------------------------------------------------------------------------
    -- Checks the owner of a specific building block in the Building Owners plugin
    -- data.
    -- ----------------------------------------------------------------------------
    function PLUGIN:GetOwner( buildingBlock )
        -- Setup the array to use to invoke the FindBlockData method from the
        -- BuildingOwners plugin.
        local arr = util.TableToArray( { buildingBlock } )
        util.ConvertAndSetOnArray( arr, 0, buildingBlock, UnityEngine.Object._type )    -- Get the owner id.
        local ownerID = plugins.CallHook( "FindEntityData", arr ) -- < -------- THIS
        -- Return the owner id.
        return ownerID
    end

    Code:
    function PLUGIN:OnServerInitialized()
        -- Check if the CheckFoundationForOwner configuration value is set to true.
        -- If it is true we need the plugin `Building Owners`.
        if self.Config.Homes.CheckFoundationForOwner then
            -- The setting CheckFoundationForOwner is true, check if
            -- `Building Owners` is installed.
            if not plugins.Exists( "EntityOwner" ) then -- < -------- THIS
                -- The plugin isn't installed, print a message in the console and
                -- disable the owner check.
                print( "m-Teleportation: To limit Homes to only be set on foundations owned by the player the plugin `Entity Owner` is required!" )
                print( "                 The owner check has temporarily been disabled to prevent problems." )
                self.Config.Homes.CheckFoundationForOwner = false
            end
        end
     
    Last edited: Jul 23, 2015
  6. i cant seem to find that line of code in the teleportation system plugin
     
  7. Calytic

    Calytic Community Admin Community Mod

    It is near the bottom..

    Code:
    -- ----------------------------------------------------------------------------
    -- PLUGIN:GetOwner( buildingBlock )
    -- ----------------------------------------------------------------------------
    -- Checks the owner of a specific building block in the Building Owners plugin
    -- data.
    -- ----------------------------------------------------------------------------
    function PLUGIN:GetOwner( buildingBlock )
        -- Setup the array to use to invoke the FindBlockData method from the
        -- BuildingOwners plugin.
        local arr = util.TableToArray( { buildingBlock } )
        util.ConvertAndSetOnArray( arr, 0, buildingBlock, UnityEngine.Object._type )    -- Get the owner id.
        local ownerID = plugins.CallHook( "FindEntityData", arr )
        -- Return the owner id.
        return ownerID
    end
     
  8. would i need to change this section as well to the name of your plugin for teleport
    function PLUGIN:OnServerInitialized()
    -- Check if the CheckFoundationForOwner configuration value is set to true.
    -- If it is true we need the plugin `Building Owners`.
    if self.Config.Homes.CheckFoundationForOwner then
    -- The setting CheckFoundationForOwner is true, check if
    -- `Building Owners` is installed.
    if not plugins.Exists( "BuildingOwners" ) then
    -- The plugin isn't installed, print a message in the console and
    -- disable the owner check.
    print( "m-Teleportation: To limit Homes to only be set on foundations owned by the player the plugin `Building Owners` is required!" )
    print( " This plugin can be downloaded at http://forum.rustoxide.com/plugins/building-owners.682/" )
    print( " The owner check has temporarily been disabled to prevent problems." )
    self.Config.Homes.CheckFoundationForOwner = false
    end
     
  9. Calytic

    Calytic Community Admin Community Mod

    Sorry - oversight on my part. Yes, without BuildingOwners installed then the ownership check would be skipped in teleportation..

    Code:
    function PLUGIN:OnServerInitialized()
        -- Check if the CheckFoundationForOwner configuration value is set to true.
        -- If it is true we need the plugin `Building Owners`.
        if self.Config.Homes.CheckFoundationForOwner then
            -- The setting CheckFoundationForOwner is true, check if
            -- `Building Owners` is installed.
            if not plugins.Exists( "EntityOwner" ) then
                -- The plugin isn't installed, print a message in the console and
                -- disable the owner check.
                print( "m-Teleportation: To limit Homes to only be set on foundations owned by the player the plugin `Entity Owner` is required!" )
                print( "                 The owner check has temporarily been disabled to prevent problems." )
                self.Config.Homes.CheckFoundationForOwner = false
            end
        end
     
  10. alll good just double checking so if i change those 2 things teleport should use entityowner instead of building owners
     
  11. Does this mean we need to keep BuildingOwners plugin installed?
     
  12. Calytic

    Calytic Community Admin Community Mod

    No, it simply means that Teleportation needs to be changed in 2 places.
    EntityOwner does not conflict with BuildingOwners and it may remain installed.
     
  13. i changed the things in the tp plugin i removed building owners etc when i try to set a home it says i need to on my own or friends foundation if i do prod2 it says it belongs to me would u mind checking this for me. see if i did it right
     

    Attached Files:

  14. Calytic

    Calytic Community Admin Community Mod

    Read up.

    Code:
    -- ----------------------------------------------------------------------------
    -- PLUGIN:GetOwner( buildingBlock )
    -- ----------------------------------------------------------------------------
    -- Checks the owner of a specific building block in the Building Owners plugin
    -- data.
    -- ----------------------------------------------------------------------------
    function PLUGIN:GetOwner( buildingBlock )
        -- Setup the array to use to invoke the FindBlockData method from the
        -- BuildingOwners plugin.
        local arr = util.TableToArray( { buildingBlock } )
        util.ConvertAndSetOnArray( arr, 0, buildingBlock, UnityEngine.Object._type )    -- Get the owner id.
        local ownerID = plugins.CallHook( "FindEntityData", arr ) -- < -------- THIS
        -- Return the owner id.
        return ownerID
    end
     
  15. any way to incorporate who has accessed boxes? i know there is already boxlooters, but an all-in-0ne would be nice. if it's not in your vision, i'll stick with /box :)
     
  16. i got it working perfect now with teleportation plugin this new entity owners is great cheers
     
  17. Instead of making another plugin with 1 thing better and other things worse or missing, you could have taken over thé buildingowners.
    I can already tell you that your plugin will create HUMONGOUS amount of lags, cause the way you save it saves every single entities.
    So if you have 250 000 entities, it would mean ... well maybe like a 30seconds save time ...
    Even my building owners takes 3-4secs to save the data for 250k entities and it only saves buildings ...

    You have to rethink the way you save entities, again the best thing would have been to just take over the plugin i made and add the things you wanted to it, maybe rethink some of the code as i'm not a C# programmer so don't know all the subtilities,

    but the way you save it is not viable and will just break/lag servers out.
     
  18. Calytic

    Calytic Community Admin Community Mod

    I appreciate your input but I don't think you looked at it closely enough. OwnerProfiles are only saved when something in them has changed. All OwnerProfiles are stored in separate files and can be loaded without loading every single file. The KnownPlayers list can be periodically cleared by checking Last Login < 2 weeks ago (or however long), this coming soon. The hooks only sets ownership on items placed by the player (not every entity in the world). And, I check OnGroundMissing and EntityDestroyed to clear out entities from profiles as they exit the game world.

    Because I'm using separate files per player, there is a lot of flexibility when choosing which profiles to load/unload.

    Also it is likely I will add whitelisting/blacklisting to the Entity saving to prevent the /own function from giving you ownership of entities you shouldn't really own. Currently the plugin only excludes owning other players.

    I'm sure it can be tweaked to be more performant but generally it's pretty zippy and fault tolerant.

    BoxLooters does well enough on its own IMHO. This mod only tracks the ownership of the original builder (the tool cupboard thing is simply an added value). It might be possible to use EntityOwner to make private chests/chest sharing, therein removing the need for box looters generally.

    What's worse or missing? I didn't want to take over BuildingOwners because the way I save data was totally incompatible. This mod can run in parallel with BuildingOwners - no problem. That way people can safely upgrade without losing all their existing data or mod integrations.
     
    Last edited: Jul 23, 2015
  19. ha ... ok, i got it XD
    Very cleaver way to do so (lots of files, but only few of them are used at the same time)
    so how to you prod an entity or a building then? i tried to look at the code but seems that a lot of things are called XD too hard to read without concentrating on it :p