Hammer Time

Tweak "Demolish" and "Rotate" time when using the hammer

Total Downloads: 4,351 - First Release: Feb 19, 2016 - Last Update: Jun 30, 2018

5/5, 18 likes
  1. I had demolish time set to -1 so people could do infinite demolish. Everything was working fine, but now a day later it has stopped. The only thing that has changed is that the server reset over night? What am I doing wrong? Any help would be appreciated as I am very new to this.
     
  2. You aren't doing anything wrong, this is actually a tiny limitation of the plugin's code. Basically when the server restarts the default code runs to disable the demolish option after the default set amount of time (determined by the game) and the plugin is unable to intercept this, so to be able to keep being able to demolish these pre-existing structures after a restart this plugin actually needs a few changes.
     
  3. For some reason this plugin only works for server admins. How do I get it to work for everyone?
     
  4. works for all players
     

    Attached Files:

  5. So everyone can demolish everything???....nice server setting ;)
     
  6. Thanks ^0Corn^2holio - Those were the same settings that I was already using though and for some reason I was the only one who had the option to demolish past the 10 minute mark.
     
  7. Uhh, this actually isn't true? After the server is initialized, it goes through all the blocks and sets the time according to the config. Don't mean to sound rude, but, did you actually read the plugin's code before making this reply?

    EDIT: To clarify, that's only the case if the config options are enabled for it to do so after the restart. ;)


    It may actually be an issue with not allowing non-admins to demolish after the 10 minutes, since Corn holio seems to have had the same issue at some point, I'll try to look into this, but I don't know how this would be the case.
     
    Last edited by a moderator: Jul 31, 2016
  8. Ok thanks Shady. I'll try rebooting the server and see if the problem still persists.
     

  9. So then do I have to delete it from the server and then reinstall it? Or, would it be best to just not restart the server as little as possible? And if I do re-install the plugin, will players be able to demo previously built items?

    Thanks for your help!
     
  10. I am trying to run a PVE server where players can build whatever they want and demolish anything they want with an infinite amount of time as long as they have building privileges there. I am running the hammer time plugin for this that I installed after a server restart. I changed the script to say...

    {
    "AllowDemolishAfterServerRestart": true,
    "AllowRotateAfterServerRestart": true,
    "AuthLevelOverrideDemolish": true,
    "DemolishTime": -1.0,
    "MustOwnToDemolish": true,
    "MustOwnToRotate": true,
    "RepairDamageCooldown": 8.0,
    "RotateTime": -1.0
    }

    I am not sure what I am doing wrong as this should work, but players are saying that it doesn't let them demo stuff after 10 minutes. Also, I have players who say they cannot demolish craftable items like a tool cupboard, etc. Any idea why this is happening too?
     
  11. I don't think you've ever been able to demolish deployables, that's just not how Rust works.

    As for the 10 minutes think, I'm not really sure, it has to be something that changed on the Rust side. I'll remove myself from authlevel and see if I get the same results as you guys, then see how I can work on it from there.
     
  12. Can any of you having issues with it not working after 10 minutes try using the attached one and see if the same issue still occurs?
     

    Attached Files:

  13. Maybe a solution for the initalization problem.
    I had this too on BetterLoot and FancyDrop, to catch things right after start, but not to early...
    And its a damn thing to get it managed:
    This code will with "updateScheduled=3" delay it for 3 Ticks..normal the 3 works in most cases...

    Code:
            bool initialized = false;
            int updateScheduled = 3;
          
            private void OnTick()
            {
                if (initialized) return;
                try {
                    if (updateScheduled == 0) {
                        initialized = true;
                        updateScheduled = -1;
                        UpdateInternals(); // <<  replaces OnServerInitialized
                    } else if (updateScheduled > 0) {
                        --updateScheduled;
                    }
                } catch (Exception ex) {
                    PrintError("OnTick scheduled update failed: " + ex.Message);
                }
            }        void UpdateInternals() // before OnServerInitialized
            {
                if (!DemolishAfterRestart && !RotateAfterServerRestart) return;
                var blocks = GameObject.FindObjectsOfType<BuildingBlock>();
                for(int i = 0; i < blocks.Length; i++)
                {
                    var block = blocks[i];
                    var grade = block?.grade.ToString() ?? string.Empty;
                    if (grade.ToLower().Contains("twig")) continue; //ignore twigs (performance)
                    var doRotate = RotateAfterServerRestart;
                    if (doRotate) doRotate = block?.blockDefinition?.canRotate ?? RotateAfterServerRestart;
                    if (!doRotate && !DemolishAfterRestart) continue;
                    DoInvokes(block, DemolishAfterRestart, doRotate, false);
                }
                initialized = true; // initiated
            }
     
  14. I just ran my server again today and found that the remove functionality was still only working for me even after making my friend a moderator.
    I'll try the new .cs file tomorrow and let you know if that fixes anything.
    @Rooster Cogburn- If you want to be able to remove placeables (boxes, shelves, barricades etc.) you'll need to also use the Rremove plugin. The hammer won't let you do that.
     
  15. That's strange, because I removed all power from myself and it was still working for me after 10 minutes.
     
  16. I want players to demo stuff infinitely after they build something and currently have the hammer time plugin as follows...

    {
    "AllowDemolishAfterServerRestart": true,
    "AllowRotateAfterServerRestart": true,
    "AuthLevelOverrideDemolish": true,
    "DemolishTime": -1,
    "MustOwnToDemolish": true,
    "MustOwnToRotate": true,
    "RepairDamageCooldown": 8.0,
    "RotateTime": -1
    }

    However, this does not appear to be working. Am I doing something wrong? This was installed after a server restart so that should not be an issue. If you could provide some guidance, it would be greatly appreciated!
     
  17. Did you try the one I attached to a post a few posts up? It might fix the issue.


    What I was using seemed to work every time, but I'll see about using this if it's needed. Thanks.
     
  18. Atm i can't really say if its working..for your actual version dows work 100%.
    I did gave your actual code including someone to test, and the inital function run through successful, but afterwards he told me he had zero effect.
    So, it kinda confusing to say exactly, whats the right code to use....
     
  19. So I tried the new CS file... still not working for my friend. I get the remove immediate icon but he doesn't get anything. Just the regular bomb icon that stops working after a few minutes.
     
  20. I'll look into it some more, but it's still quite strange since it's almost always been working for me.

    As an alternative, try setting the Demolish time to something higher than 600, like 900, and see if it goes that long, it might just be an issue with setting it to 0.