Modding Help Support for other mods

Discussion in 'Starbound Modding' started by Naddox, Jul 24, 2016.

  1. Naddox

    Naddox Cosmic Narwhal

    Hey everyone. I am working to add support to my mod for other mods such as extended gui and instant crafting and probably others down the line. I am trying to figure out how I can patch my mod files if certain mods are also installed but I don't know how to do it.

    I don't want to make it so my mod requires those mods to be installed and I don't want to make small addon mods that patch my mod for support.

    I was figuring I need to use this code somewhere but I am not really sure how/where. Can anyone help me out?
    Code:
    {
      "requires: ["mod name here"]
      "includes: ["mod name here"]
    }
    --- Post updated ---
    Ok so I tried making a patch file that was essentially :
    Code:
    [
      {
        "requires": ["Instant Crafting"]
      }
      {
        "op": "replace",
        "path": "/duration",
        "value": 0
      }
    ]
    But this just made the recipe disappear all together.
     
  2. EZKatnipz

    EZKatnipz Big Damn Hero

    I would like to know this as well.
    Perhaps the problem with your code is that you don't have a comma after your first bracket set?
    Code:
    [
      {
        "requires": ["Instant Crafting"]
      }  <===Add the comma here====
      {
        "op": "replace",
        "path": "/duration",
        "value": 0
      }
    ]
    Edit: I found something for you, here
     
    Last edited: Aug 12, 2016
  3. Nirrudn

    Nirrudn Void-Bound Voyager

    One of the .patch ops you can do is "test." You can test if a path and/or value exists (one you know the mod you're doing compatibility patching for would have created) and if it doesn't exist, that .patch file stops there.

    See here: http://community.playstarbound.com/threads/basic-patching-now-with-path-guide-v1-9.84496/

    This won't always help, unless we do some wacky community standard like adding "modName:true" in every single patch file we make, but I thought it was worth mentioning as a general tip.
     
    Last edited: Aug 12, 2016
    Naddox likes this.
  4. Naddox

    Naddox Cosmic Narwhal

    I actually figured this out awhile ago, forgot to say so. The includes and requires has to go in the .metadata file, and the test OP is indeed needed when doing the patch. What I ended up doing was just testing for the path that I was going to patch. Like so:

    Code:
    [
    {
        "op": "test",
        "path": "/duration",
        "value": 1.5
    },
    {
        "op": "replace",
        "path": "/duration",
        "value": 0
    }
    ]
    
     
  5. The | Suit

    The | Suit Agent S. Forum Moderator

    The important thing to remember is patch ops happen in sequential order.
    So perform all the tests and - test results in the end.

    Otherwise if a test fails - everything under that test is not executed.
     

Share This Page