1. This forum is obsolete and read-only. Feel free to contact us at support.keenswh.com

Removing mods from a dedicated server

Discussion in 'Groups & Dedicated Servers' started by Sierra, Aug 28, 2014.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Sierra

    Sierra Trainee Engineer

    Messages:
    10
    So the Mining Colony whitelist server is going through a mod restructure. We want to remove a few small mods nobody really uses (and one that we've decided should not be allowed). The problem is the world is big and populated (this is whitelist, the low grief means people actually get big and cool sh*t built). Our admins have enough to do already as the server is barely stable. Is there an 'easy' way like a script to clear out all entities of a mod (or at least delete all CubeGrid entities containing them) or do we have to do it the hard way with going through the files or using SE Toolbox?
    Thanks,
    -Sierra
     
  2. gimmilfactory

    gimmilfactory Junior Engineer

    Messages:
    523
    If you remove a mod, it should just tell you that some blocks in the world where not able to be loaded, and that it will save it that way. That is how it works on client, so why wouldn't it on DS?
    It would then be just a matter of removing the files that it downloaded from your saves/mods folder (I think it creates some there), I haven't tried any of this.
     
  3. SpyderTheSir

    SpyderTheSir Apprentice Engineer

    Messages:
    153
    Hi Sierra,

    I'm working on a powershell script that should be able to do what you need. It's only an hour or so's work so far, so not really fit for consumption on anything other than a testing world.

    The below is a excerpt, a quick and dirty 'Remove all Rotors' function. The only drawback I've found so far is that if you have a rotor with just a top and nothing on it, it will leave the now empty <CubeBlocks></Cubeblocks> behind. I manually removed these with NotePad++, as I didn't know if they'd have any bad effect. I intend to add that to the script at some point.

    Code:
    Param(  [string]$filePath = "C:\Temp\SANDBOX_0_0_0_.sbs"          #Change this to your sandbox location, and remember to take a backup
    )
     
    [xml]$myXML = Get-Content $filePath
    $ns = New-Object System.Xml.XmlNamespaceManager($myXML.NameTable)
    $ns.AddNamespace("xsi", "https://www.w3.org/2001/XMLSchema-instance")
    $sb = "//SectorObjects/MyObjectBuilder_EntityBase/CubeBlocks/MyObjectBuilder_CubeBlock"
    
    
    function deleteTheRotors {
        $Rotors=($myXML.SelectNodes("$sb[(@xsi:type='MyObjectBuilder_MotorRotor') or (@xsi:type='MyObjectBuilder_MotorStator')]", $ns))
        Write-Output "You have $($Rotors.count) stators and motors in your world, this should be about $($Rotors.Count/2) Rotors if they are all built and one piece"
        if ((Read-Host "Press Y to confirm deletion!").ToLower() -eq "y") {
            foreach ($Rotor in $Rotors) {
                [void]$Rotor.ParentNode.RemoveChild($Rotor)
            }
            Write-Output "Deleted!"
        } else {
            Write-Output "No change"
        }
    }
    
    deleteTheRotors
    Change this part:
    (@xsi:type='MyObjectBuilder_MotorRotor') or (@xsi:type='MyObjectBuilder_MotorStator')
    to the block description you need.

    Copy that, save it out as a .ps1 file, COPY your world to c:\temp and run it.

    No warranty, backup your stuff first :)
     
  4. havok

    havok Apprentice Engineer

    Messages:
    285
    you dont need that, 1st reply was correct, remove the mods from the list and the blocks will simply disapear from your game, unless your wanting to add blocks where the removed ones were to ensure things to break apart what you want is already easy as pie, tested on my dedicated server
     
  5. Newskin

    Newskin Trainee Engineer

    Messages:
    92
    Thanks for the info.
     
Thread Status:
This last post in this thread was made more than 31 days old.