Modding Help How do I patch the Ore Distributions?

Discussion in 'Starbound Modding' started by North\WestTrees, Jun 26, 2019.

  1. North\WestTrees

    North\WestTrees Orbital Explorer

    I am trying to figure out how I can add a new line and patch the oredistributions.configfunctions file.
    I am eager to learn how to mod Sarbound but need some guidance when it comes to how to do things in the code side of things.

    I know I need to use this line of code here but not sure how to set it up. I tried my self but the game crashed.

    {"op" : "add",
    "path" : "/path", // not sure what I would need to target if I am creating a new line.
    "value" :
    {
    // Code needs to go here.
    }
     
  2. bk3k

    bk3k Oxygen Tank

    A small slice of a real example
    Code:
    [
      { 
        "op": "add",
        "path":"/surface/0/1/-",
        "value":  [ "ise4tin", 0.60]
      }
    ]
    
    Here is probably what you want to use until you're more comfortable typing these by hand.

    You can feed it the original, and the modified version. It will build a patch for you. Not always the most optimal patch, but it works. And it won't do anything fancy like Starbound's supported conditional patch batches. This tool can also test your patches for you and tells you where you are making JSON syntax errors.
     
  3. North\WestTrees

    North\WestTrees Orbital Explorer

    Thank you for your help, I managed to fix the crash from happening and I got most of the mod working,
    however, I no longer have custom ore spawning in the asteroids.
    If you have some time to take a quick look at the code below to confirm I am not going crazy?

    /biomes/oredistributions.configfunctions.patch | Ore Distribution File
    Code:
    [
      {
        "op":"add",
        "path":"/betterasteroids",
        "value": [ [0.5, [ ["copper", 0.35], ["silver",0.35], ["gold", 0.35],["diamond", 0.10], ["iron", 0.30], ["tungsten", 0.30],["titanium", 0.30],["durasteel", 0.30],["aegisalt", 0.30],["ferozium", 0.30],[ "violium", 0.30 ], [ "solarium", 0.30 ] ] ] ]
      }
    ]
    NOTES:
    Only copper, silver, and gold are spawning.

    /biomes/surface/asteroidfield.biome.patch | Biome File
    Code:
    [
      {
        "op": "replace",
        "path":"/ores",
        "value":  "betterasteroids"
      }
    ]
    NOTES:
    I have a hard copy that uses the same system and it works by replacing the ore value with a new value in the oredistributions folder so it should still work unless there is a typo that the online application did not fore see.

    /terrain/disperse/asteroids.terrain.patch | Terrain File (Working Fine)
    Code:
    [
      {
        "op":"replace",
        "path":"/source/sources/0/freq",
        "value": 0.025
      },
      {
        "op":"replace",
        "path":"/source/sources/0/amp",
        "value": 1.5
      },
      {
        "op":"replace",
        "path":"/source/sources/1/freq",
        "value": 0.05
      },
      {
        "op":"replace",
        "path":"/source/sources/1/amp",
        "value": 1.5
      }
    ]
    The mod works fine if the files are without the .patch extension I may have coded it wrong maybe, I found a video on YouTube explaining the patches a bit and then found an older post which should still work which had a bit easier JSON code testing site on it and it said all the code worked fine, it looked fine nothing was out of place in the code viewer, and the game does not crash. I have no clue what's wrong. I am happy that I got this far though.

    Thanks in advance for further help :)

    The video I watched was this one below.


    And the tutorial I figured most of the other bits are from below.
    https://community.playstarbound.com/threads/basic-patching-now-with-path-guide-v1-9.84496/

    And finally, the code viewer that was suggested on the forum thread above is below.
    http://json-schema-validator.herokuapp.com/jsonpatch.jsp
     

Share This Page