Modding Help Remove array element without knowing it's position in Rampaging Koala

Discussion in 'Starbound Modding' started by THAU, Sep 16, 2014.

  1. THAU

    THAU Scruffy Nerf-Herder

    Hello

    This was the old way of updating a dile from original asset :
    Code:
    {
      "__merge" : [],
      "defaultBlueprints" : {
        "tier1" : {
          "__merge" : [ 
            "list", [
              [ "update", { "item" : "bandage" }, { "item" : "nanowrap" } ],
              [ "delete", { "item" : "torch" } ],
              [ "append", { "item" : "peanutbutter" } ],
              [ "prepend", { "item" : "timer" } ]
            ] 
          ] 
        }
      }
    }
    Actually with the new system, I know that we can do that :
    Code:
    [
      { "op" : "replace", "path" : "/defaultBlueprints/tier1/45", "value" : { "item" : "nanowrap" } }
      { "op" : "remove", "path" : "/defaultBlueprints/tier1/8" }
      { "op" : "add", "path" : "/defaultBlueprints/tier1/-", "value" : { "item" : "peanutbutter" } }
    ]
    but if a mod remove the element 7, I would remove the wrong element so my patch would be easily incompatible with almost every mod.

    so comparing to the old system, I can do corectly "append" but not "update", "delete", "prepend" directly by targeting the elements.
     

Share This Page