Modding Help Help with patches

Discussion in 'Starbound Modding' started by irRegularGuy646, May 7, 2020.

  1. irRegularGuy646

    irRegularGuy646 Scruffy Nerf-Herder

    i'm trying to make a patch for climbingrope.activeitem so that when you pick up climbingrope you unlock the recipes for 2 modded items, but i haven't been able to get a patch to work. please help.

    my sad attempt at a patch so far:

    Code:
    [
     {
     "op":"add","path":"/climbingrope/-","value":"learnBlueprintsOnPickup" : [ "rappelrope", "strongrope" ]
     }
     ]
    
     
  2. bk3k

    bk3k Oxygen Tank

    Here is a patch maker - https://chbrown.github.io/rfc6902/
    But I can make something better that takes advantage of SB's expanded patching ability.

    Code:
    [
      [
        { "op": "test", "path": "/learnBlueprintsOnPickup", "inverse": true },
        { "op": "add", "path": "/learnBlueprintsOnPickup", "value": [] }
      ],
      [
        { "op": "add", "path": "/learnBlueprintsOnPickup/-", "value": "rappelrope" },
        { "op": "add", "path": "/learnBlueprintsOnPickup/-", "value":"strongrope" }
      ]
    ]
    The difference between that patch and what the automatic patch makers would produce - that splits the patch into 2 batches. The first batch may or may not apply, but the second one would unconditionally.
    What that does - it creates learnBlueprintsOnPickup if it doesn't already exists. Another mod may or may not have already made it so that's more versitile.
    Then it adds your items into learnBlueprintsOnPickup.

    Now as a matter of good practice, I'd avoid the names
    "rappelrope" and "strongrope"
    in favor of something like
    "TD_rappelrope", "TD_strongrope"
    because those names are far less likely to exist in other mods and therefore less likely to have compatibility issues. I append everything with either my handle, or an acronym of the mod name.
     
    projectmayhem and The | Suit like this.
  3. irRegularGuy646

    irRegularGuy646 Scruffy Nerf-Herder

    thank you. i took your advice and renamed it by adding "mr_" in front of all of the ropes ids
     
    Last edited: May 7, 2020

Share This Page