1. Good day,

    I have recently started up my own Rust server and although I am still looking at the final direction I am going to go with it there is some things I would like to improve on the QoL for players.

    I know there are many plugins that does similar or close to what I need, but rather than having 2 or 3 plugins to do something I am looking to create something specific to achieve my goals.

    At this point I have a fresh server install with Oxide only.

    My first goal I want to achieve is something similar to Hammer Time for Rust | Oxide, which will allow players to demolish and rotate building blocks at any given time. I have read through the code for the plugin and I do understand some of it, but it is not ideal for what I want to achieve.

    To be able to demolish and rotate structures the following criteria should be met:
    1. The player trying to rotate or demolish the structure should be in a shared list from the player who placed it (this will stop raiders from getting cupboard access and just using demolish to clear a base).
    2. The player trying to rotate or demolish the structure should be authorized by the tool cupboard. The reasoning behind this is, if there are friends which shouldn't be building or demolishing they cannot go around and muck things up.
    I am not looking for someone to write the plugin for me, just some advice or sample code how to check/do these things.

    So far I have gathered I will need to:
    1. On Entity creation store the Entity Id and Owner Id relation.
    2. Create a list to store Owner Id and Player Id relation.
    3. Check if the Player Id (one using demolish or rotate) is in the list as per point 2 and if the Entity Id belongs to the Owner Id as per point 1.
    4. Check if the Player Id has building privileges.
    Any advice will be appreciated.

    Regards
     
  2. The first can be done on the go by using the OwnerID variable attached to the building block in question, therefore sparing you from the need to store the owner information yourself.
    You can use friendsapi and clans to handle the friends of the owner. Then all you would need to do is call either or both of those plugins and see if the player is friends with the owner of the block.
    Tool cupboard check can be done easily and there is plenty of examples floating around.
     
  3. Good day,

    Thanks for the response. I did consider the friends or clan API prior, but considering that some people might play with friends on in a clan they would build a compound each with their own base (or 2 or 3) people together apart from the rest.

    So I felt a separate list for this would be more acceptable than using a API that might be used by other plugins and then forces players to give out access to other people they may not want to have on there.

    I will look at the friends API and how they have done that and work from there.

    Going forward, is there a way to hook into the Building Menu (right click with Hammer). I know there is the OnHammerHit which I can hook, but I would rather have the flags set on right click.

    Currently I am right now using a RaycastHit in OnPlayerInput (checks for right click and if active item is the hammer) to check if there is something in range, but has yet figured out how to get the entity and see if it is a block. Though, if there is a way to hook into the Building Menu it would be better to use.

    Regards