EasyRemove for Admins

Firestorm

New Member
Member
Oct 16, 2014
9
0
1
This is probably a stupid question, but where is BuildingPart.cs located. I spent the last 10 minute looking for it
 

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
Well you can, but when a BuildingPart's health is set of BuildingPart.MaxHealth, when you try to break it (without remove), it gives some outofindex error/warning on the server console, which I am guessing is never good. It's just as easy to set it by hand but up to you.

You can do pull request o_O
 

Firestorm

New Member
Member
Oct 16, 2014
9
0
1
Thanks, I will have to contact my hosting company to see if I can get access. Doesn't appear I have access to those files, which is why I couldn't find it. Thanks for the location coersum!
 

CorrosionX

Plugin Developer
Plugin Developer
Sep 3, 2014
212
85
18
California
Well you can, but when a BuildingPart's health is set of BuildingPart.MaxHealth, when you try to break it (without remove), it gives some outofindex error/warning on the server console, which I am guessing is never good. It's just as easy to set it by hand but up to you.

You can do pull request o_O
Yes, any one can. :cool:
Create a GitHub account, and then you click the pencil/edit button. it saves a copy to your person hub, then lets you edit it, and once complete can request a pull to merge with original. Owner can approve or deny changes, or modify them.

Thanks, I will have to contact my hosting company to see if I can get access. Doesn't appear I have access to those files, which is why I couldn't find it. Thanks for the location coersum!
They most likely wont allow you to, cause it would have to be custom compiled. I requested it to be added to Pluton, so possibly on future build you will be able to :)
 
  • Like
Reactions: Firestorm

Firestorm

New Member
Member
Oct 16, 2014
9
0
1
They most likely wont allow you to, cause it would have to be custom compiled. I requested it to be added to Pluton, so possibly on future build you will be able to :)
Thanks corrosion! I won't bother putting in the request and hopefully they will add it to a future build. Thanks for the response and loving the plugin so far.
 

CorrosionX

Plugin Developer
Plugin Developer
Sep 3, 2014
212
85
18
California
so is the instant build ready to go ? or there still needs fixin?
I was told MaxHealth cannot be changed. However, the Set Health can, and will be added. Might not be until a few other things are added. You can modify the code yourself if you cant wait. :)
 

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
Just in case you wanted to use it, I set instabuild on the building update instead than in onFramedeployed because we can't get Player info on FrameDeployed, just BuildingPar.

Python:
    def On_BuildingUpdate(self, be):
        if be.Builder.Admin:
            if be.Tool.Name == "Hammer": #straight to lvl 6 with one hit
                be.BuildingPart.Health = 515
            else: #salvaged hammer gives you 1 level per hit
                if (be.BuildingPart.Health + 85) > 515:
                    be.BuildingPart.Health = 515
                else:
                    be.BuildingPart.Health += 85
Also used the 2 diff building Hammer because sometimes I like to have the textures of other levels :)

End result (sorry I stripped your code away to add other stuff) for my personal use (or anyone that wants it:
Python:
__author__ = 'CorrosionX- modified by Coersum'
__version__ = "1.0.2"
# With major help from balu92
import clr
import sys
clr.AddReferenceByPartialName("UnityEngine")
clr.AddReferenceByPartialName("Pluton")
import UnityEngine
import Pluton


class EasyRemove:
    def On_PluginInit(self):
        DataStore.Flush("Remove")

    def On_BuildingUpdate(self, be):
        if be.Builder.Admin:
            if be.Tool.Name == "Hammer":
                be.BuildingPart.Health = 515
            else: #salvaged hammer gives you 1 level per hit
                if (be.BuildingPart.Health + 85) > 515:
                    be.BuildingPart.Health = 515
                else:
                    be.BuildingPart.Health += 85

    def On_BuildingPartAttacked(self, attacked):
        player = attacked.Attacker.ToPlayer()
        if player is not None and Server.Players[player.userID].Admin:
            gid = player.userID
            if DataStore.Get("remove", gid) is not None:
                Util.DestroyEntity(attacked.Victim.buildingBlock)

    def On_Command(self, cmd):
        if cmd.User.Admin:
            if cmd.cmd == "remove":
                isdestroying = DataStore.Get("remove", cmd.User.GameID)
                if isdestroying is not None:
                    DataStore.Remove("remove", cmd.User.GameID)
                    cmd.User.Message("Remove De-Activated!")
                else:
                    DataStore.Add("remove", cmd.User.GameID, True)
                    cmd.User.Message("Remove Activated!")
With this, as admin (unless changed), you put down a frame, hit it with hammer for instant lvl 6, or hit it with salvaged hammer and get 1 level per hit (capped so we don't get the outofboundindex error) and destroy with weapon as long as we keep /remove on (seemed I had to /remove anytime I made a mistake because the timer had gone off)
 
Last edited:

RedDevil6193

New Member
Member
Oct 11, 2014
20
2
3
37
Just in case you wanted to use it, I set instabuild on the building update instead than in onFramedeployed because we can't get Player info on FrameDeployed, just BuildingPar.

Python:
    def On_BuildingUpdate(self, be):
        if be.Builder.Admin:
            if be.Tool.Name == "Hammer": #straight to lvl 6 with one hit
                be.BuildingPart.Health = 515
            else: #salvaged hammer gives you 1 level per hit
                if (be.BuildingPart.Health + 85) > 515:
                    be.BuildingPart.Health = 515
                else:
                    be.BuildingPart.Health += 85
Also used the 2 diff building Hammer because sometimes I like to have the textures of other levels :)

End result (sorry I stripped your code away to add other stuff) for my personal use (or anyone that wants it:
Python:
__author__ = 'CorrosionX- modified by Coersum'
__version__ = "1.0.2"
# With major help from balu92
import clr
import sys
clr.AddReferenceByPartialName("UnityEngine")
clr.AddReferenceByPartialName("Pluton")
import UnityEngine
import Pluton


class EasyRemove:
    def On_PluginInit(self):
        DataStore.Flush("Remove")

    def On_BuildingUpdate(self, be):
        if be.Builder.Admin:
            if be.Tool.Name == "Hammer":
                be.BuildingPart.Health = 515
            else: #salvaged hammer gives you 1 level per hit
                if (be.BuildingPart.Health + 85) > 515:
                    be.BuildingPart.Health = 515
                else:
                    be.BuildingPart.Health += 85

    def On_BuildingPartAttacked(self, attacked):
        player = attacked.Attacker.ToPlayer()
        if player is not None and Server.Players[player.userID].Admin:
            gid = player.userID
            if DataStore.Get("remove", gid) is not None:
                Util.DestroyEntity(attacked.Victim.buildingBlock)

    def On_Command(self, cmd):
        if cmd.User.Admin:
            if cmd.cmd == "remove":
                isdestroying = DataStore.Get("remove", cmd.User.GameID)
                if isdestroying is not None:
                    DataStore.Remove("remove", cmd.User.GameID)
                    cmd.User.Message("Remove De-Activated!")
                else:
                    DataStore.Add("remove", cmd.User.GameID, True)
                    cmd.User.Message("Remove Activated!")
With this, as admin (unless changed), you put down a frame, hit it with hammer for instant lvl 6, or hit it with salvaged hammer and get 1 level per hit (capped so we don't get the outofboundindex error) and destroy with weapon as long as we keep /remove on (seemed I had to /remove anytime I made a mistake because the timer had gone off)
[10/17/2014 5:23:01 AM] [Exception] [ Plugin->Invoke | Plugin->OnBuildingUpdate | <>c__DisplayClass46-><InstallHooks>b__17 | AnonymousObserver`1->Next | AbstractObserver`1->OnNext | Subject`1->OnNext | Hooks->EntityBuildingUpdate | BuildingBlock->OnAttacked_Build | BuildingBlock->OnAttacked | Component->SendMessage | BasePlayer->DoAttackShared | BasePlayer->OnAttack | Node->Call | Router->Route | Server->ReceivedMessage | Server->Cycle | ServerMgr->Update | ]
System.MissingMemberException: can't assign to read-only property Health of type 'BuildingPart'
at (wrapper dynamic-method) object.CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object,int) <0x000ec>
at (wrapper dynamic-method) object.On_BuildingUpdate$41 (System.Runtime.CompilerServices.Closure,IronPython.Runtime.PythonFunction,object,object) <0x0042c>



yeah it didnt work, remove works build doesnt. i didnt restart server i just reloaded the plugin.
 
Last edited:

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
[10/17/2014 5:23:01 AM] [Exception] [ Plugin->Invoke | Plugin->OnBuildingUpdate | <>c__DisplayClass46-><InstallHooks>b__17 | AnonymousObserver`1->Next | AbstractObserver`1->OnNext | Subject`1->OnNext | Hooks->EntityBuildingUpdate | BuildingBlock->OnAttacked_Build | BuildingBlock->OnAttacked | Component->SendMessage | BasePlayer->DoAttackShared | BasePlayer->OnAttack | Node->Call | Router->Route | Server->ReceivedMessage | Server->Cycle | ServerMgr->Update | ]
System.MissingMemberException: can't assign to read-only property Health of type 'BuildingPart'
at (wrapper dynamic-method) object.CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object,int) <0x000ec>
at (wrapper dynamic-method) object.On_BuildingUpdate$41 (System.Runtime.CompilerServices.Closure,IronPython.Runtime.PythonFunction,object,object) <0x0042c>



yeah it didnt work, remove works build doesnt. i didnt restart server i just reloaded the plugin.
As we talked about earlier in the thread, you need to have certain setter/getters that are not in the current build of Pluton (might or might not ever be added). You'd have to look up in the thread and add them yourself then recompile Pluton
 

RedDevil6193

New Member
Member
Oct 11, 2014
20
2
3
37
As we talked about earlier in the thread, you need to have certain setter/getters that are not in the current build of Pluton (might or might not ever be added). You'd have to look up in the thread and add them yourself then recompile Pluton
oh ok i guess i can wait until next pluton update, the way rust goes i assume it be very soon lol. Thanks for help.
 

CorrosionX

Plugin Developer
Plugin Developer
Sep 3, 2014
212
85
18
California
As we talked about earlier in the thread, you need to have certain setter/getters that are not in the current build of Pluton (might or might not ever be added). You'd have to look up in the thread and add them yourself then recompile Pluton
Thanks for your help. I have confirmed than set health for buildings will be added, no time frame was given as obviously not a priority. :)
 

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
Yes, any one can. :cool:
Create a GitHub account, and then you click the pencil/edit button. it saves a copy to your person hub, then lets you edit it, and once complete can request a pull to merge with original. Owner can approve or deny changes, or modify them.



They most likely wont allow you to, cause it would have to be custom compiled. I requested it to be added to Pluton, so possibly on future build you will be able to :)
So I can't find the answer anywhere so I figured you might know. I forked Pluton, made commits to my own version as I need a few things not in main Pluton. I was wondering, how do I apply commits made from the original Notulp/Pluton after I forked it, to mine ? (from the github.com)
 

CorrosionX

Plugin Developer
Plugin Developer
Sep 3, 2014
212
85
18
California
copy the files you changed. overwrite with new pluton then copy files back over. Keep an eye on changes so you dont override new stuff. :)
 

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
Ah so I have to do it by hand? I thought maybe there was some semi-auto way to do it. I can just enter the commits for the Notulp Pluton into mine manually and commit to my fork I guess :)
 

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
Soooo it seems, instantly giving a buildingpart max HP makes it that we can't build on top of it, I think it doesn't know it's there because it has not went through at least lvl1. So I modified my version to hit a wall 6 times, the buildingpart levels with each hit and so we can build on it then.

Also instant full health makes other things like foundation bug :)