Tool Python script to copy steam workshop mods to mods directory for mp server

Discussion in 'Starbound Modding' started by Hemiptera, Feb 5, 2017.

  1. Hemiptera

    Hemiptera Space Hobo

    I couldn't find an easy way to get the mods I had in single player over to the server. Instead of copying them one by one I wrote a python3 script that creates symlinks to the workshop directory. The idea is that with symlinks the server mods will stay in sync with the client mods. But this has not yet been tested. It should only modify symlinks that are linked to your steam starbound workshop directory. So it should be safe to include other mods or symlinks elsewhere.

    You will of course have to run this script before starting your server when you've modified your mod subscriptions.

    How do I run it in windows:

    1. Get python. I used spyder from anaconda, but any python version will do.
    2. run spyder as administrator (right click on the link and then select run as administrator)
    3. load python script
    4. make sure the default path default='E:\\Program Files (x86)\\Steam' matches your steam directory.
    5. run the script

    How do I run it in mac/linux:

    I haven't, so this is entirely untested o_O.

    1. install python
    2. run python3 <path to script>/starbound_server_mod.py <path to steam>
    3. check and see if it works
    4. reply back with any fixes :)

    Have fun!

    Improvements for the script:

    * Test on more than one computer and on mac/linux
    * Figure out how to switch to Administrator on windows
     

    Attached Files:

  2. bk3k

    bk3k Oxygen Tank

    Very nice of you to share, but isn't it simpler to just remove the workshop folder itself and leave a symlink in its place? You only need 1 and don't require a script at all.

    edit:Since I'm not posting from my phone, let me explain how for everyone else.

    For most people(Windows users who install on the default path) the directions would be
    1. Exit the Steam client entirely.
    2. Cut the contents of
    c:\Program Files (x86)\Steam\steamapps\workshop\content\211820
    and paste them into
    c:\Program Files (x86)\Steam\steamapps\common\Starbound\mods

    3. Delete 211820 from c:\Program Files (x86)\Steam\steamapps\workshop\content
    4. Left click on the Windows button, All Programs, Accessories, then right click on Command Prompt, left click on Run as Administrator
    5. Once you have the command prompt open just paste this

    Code:
    mklink /d "c:\Program Files (x86)\Steam\steamapps\workshop\content\211820" "c:\Program Files (x86)\Steam\steamapps\common\Starbound\mods"
    You're done. Everything Steam attempts to download from the workshop will go straight into your regular \mods\ folder with no further interaction needed and no external programs running. These mods will load even if you aren't running Steam while launching Starbound.
     
    Last edited: Feb 5, 2017
    Cyel likes this.
  3. Hemiptera

    Hemiptera Space Hobo

    That works as long as you never unsubscribe. Steam didn't clean up any directories in the couple of hours I was playing with it. But what it did do was manage the subscribed mods in an acf file in
    c:\Program Files (x86)\Steam\steamapps\workshop. So if you want to keep them in sync you need to parse the acf file and use individual symlinks of the current subscriptions.

    I suppose it may have been better to symlink like you suggest and write a script to clean up unused mods.
     
    Last edited: Feb 5, 2017

Share This Page